Coverage for src/debputy/plugin/api/parser_tables.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.0, created at 2025-01-27 13:59 +0000
« prev ^ index » next coverage.py v7.6.0, created at 2025-01-27 13:59 +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.plugin.debputy.to_be_api_types import BuildRule
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}
19OPARSER_MANIFEST_ROOT = "<ROOT>"
20OPARSER_PACKAGES_ROOT = "packages"
21OPARSER_PACKAGES = "packages.{{PACKAGE}}"
22OPARSER_MANIFEST_DEFINITIONS = "definitions"
24SUPPORTED_DISPATCHABLE_OBJECT_PARSERS = {
25 OPARSER_MANIFEST_ROOT: reference_documentation(
26 reference_documentation_url=manifest_format_doc(""),
27 ),
28 OPARSER_MANIFEST_DEFINITIONS: reference_documentation(
29 title="Packager provided definitions",
30 description="Reusable packager provided definitions such as manifest variables.",
31 reference_documentation_url=manifest_format_doc(
32 "packager-provided-definitions"
33 ),
34 ),
35 OPARSER_PACKAGES: reference_documentation(
36 title="Binary package rules",
37 description=textwrap.dedent(
38 """\
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 ),
67 reference_documentation_url=manifest_format_doc("binary-package-rules"),
68 ),
69}