Coverage for src/debputy/plugin/api/parser_tables.py: 100%
14 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-09-07 09:27 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-09-07 09:27 +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 """\
40 Inside the manifest, the `packages` mapping can be used to define requests for the binary packages
41 you want `debputy` to produce. Each key inside `packages` must be the name of a binary package
42 defined in `debian/control`. The value is a dictionary defining which features that `debputy`
43 should apply to that binary package. An example could be:
45 packages:
46 foo:
47 transformations:
48 - create-symlink:
49 path: usr/share/foo/my-first-symlink
50 target: /usr/share/bar/symlink-target
51 - create-symlink:
52 path: usr/lib/{{DEB_HOST_MULTIARCH}}/my-second-symlink
53 target: /usr/lib/{{DEB_HOST_MULTIARCH}}/baz/symlink-target
54 bar:
55 transformations:
56 - create-directories:
57 - some/empty/directory.d
58 - another/empty/integration-point.d
59 - create-directories:
60 path: a/third-empty/directory.d
61 owner: www-data
62 group: www-data
64 In this case, `debputy` will create some symlinks inside the `foo` package and some directories for
65 the `bar` package. The following subsections define the keys you can use under each binary package.
66 """
67 ),
68 reference_documentation_url=manifest_format_doc("binary-package-rules"),
69 ),
70}