Coverage for src/debputy/plugin/api/parser_tables.py: 100%
14 statements
« prev ^ index » next coverage.py v7.8.2, created at 2026-04-19 20:37 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2026-04-19 20:37 +0000
1import textwrap
3from debputy.installations import InstallRule
4from debputy.maintscript_snippet import DpkgMaintscriptHelperCommand
5from debputy.manifest_conditions import ManifestCondition
6from debputy.plugin.api import reference_documentation
7from debputy.plugins.debputy.to_be_api_types import BuildRule, TestRule
8from debputy.transformation_rules import TransformationRule
9from debputy.util import manifest_format_doc
11SUPPORTED_DISPATCHABLE_TABLE_PARSERS = {
12 InstallRule: "installations",
13 TransformationRule: "packages.{{PACKAGE}}.transformations",
14 DpkgMaintscriptHelperCommand: "packages.{{PACKAGE}}.conffile-management",
15 ManifestCondition: "*.when",
16 BuildRule: "builds",
17 TestRule: "builds.*.test_rule",
18}
20OPARSER_MANIFEST_ROOT = "<ROOT>"
21OPARSER_PACKAGES_ROOT = "packages"
22OPARSER_PACKAGES = "packages.{{PACKAGE}}"
23OPARSER_MANIFEST_DEFINITIONS = "definitions"
25SUPPORTED_DISPATCHABLE_OBJECT_PARSERS = {
26 OPARSER_MANIFEST_ROOT: reference_documentation(
27 reference_documentation_url=manifest_format_doc(""),
28 ),
29 OPARSER_MANIFEST_DEFINITIONS: reference_documentation(
30 title="Packager provided definitions",
31 description="Reusable packager provided definitions such as manifest variables.",
32 reference_documentation_url=manifest_format_doc(
33 "packager-provided-definitions"
34 ),
35 ),
36 OPARSER_PACKAGES: reference_documentation(
37 title="Binary package rules",
38 description=textwrap.dedent("""\
39 Inside the manifest, the `packages` mapping can be used to define requests for the binary packages
40 you want `debputy` to produce. Each key inside `packages` must be the name of a binary package
41 defined in `debian/control`. The value is a dictionary defining which features that `debputy`
42 should apply to that binary package. An example could be:
44 packages:
45 foo:
46 transformations:
47 - create-symlink:
48 path: usr/share/foo/my-first-symlink
49 target: /usr/share/bar/symlink-target
50 - create-symlink:
51 path: usr/lib/{{DEB_HOST_MULTIARCH}}/my-second-symlink
52 target: /usr/lib/{{DEB_HOST_MULTIARCH}}/baz/symlink-target
53 bar:
54 transformations:
55 - create-directories:
56 - some/empty/directory.d
57 - another/empty/integration-point.d
58 - create-directories:
59 path: a/third-empty/directory.d
60 owner: www-data
61 group: www-data
63 In this case, `debputy` will create some symlinks inside the `foo` package and some directories for
64 the `bar` package. The following subsections define the keys you can use under each binary package.
65 """),
66 reference_documentation_url=manifest_format_doc("binary-package-rules"),
67 ),
68}