Coverage for src/debputy/plugin/api/parser_tables.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2026-07-22 10:58 +0000

1import textwrap 

2 

3from debputy.installations import InstallRule 

4from debputy.maintscript_snippet import ( 

5 DpkgMaintscriptHelperCommand, 

6 MaintscriptCondition, 

7) 

8from debputy.manifest_conditions import ManifestCondition 

9from debputy.plugin.api import reference_documentation 

10from debputy.plugins.debputy.to_be_api_types import BuildRule, TestRule 

11from debputy.transformation_rules import TransformationRule 

12from debputy.util import manifest_format_doc 

13 

14SUPPORTED_DISPATCHABLE_TABLE_PARSERS = { 

15 InstallRule: "installations", 

16 TransformationRule: "packages.{{PACKAGE}}.transformations", 

17 DpkgMaintscriptHelperCommand: "packages.{{PACKAGE}}.conffile-management", 

18 ManifestCondition: "*.when", 

19 BuildRule: "builds", 

20 TestRule: "builds.*.test_rule", 

21 MaintscriptCondition: "packages.{{PACKAGE}}.maintscript-snippets", 

22} 

23 

24OPARSER_MANIFEST_ROOT = "<ROOT>" 

25OPARSER_PACKAGES_ROOT = "packages" 

26OPARSER_PACKAGES = "packages.{{PACKAGE}}" 

27OPARSER_MANIFEST_DEFINITIONS = "definitions" 

28 

29SUPPORTED_DISPATCHABLE_OBJECT_PARSERS = { 

30 OPARSER_MANIFEST_ROOT: reference_documentation( 

31 reference_documentation_url=manifest_format_doc(""), 

32 ), 

33 OPARSER_MANIFEST_DEFINITIONS: reference_documentation( 

34 title="Packager provided definitions", 

35 description="Reusable packager provided definitions such as manifest variables.", 

36 reference_documentation_url=manifest_format_doc( 

37 "packager-provided-definitions" 

38 ), 

39 ), 

40 OPARSER_PACKAGES: reference_documentation( 

41 title="Binary package rules", 

42 description=textwrap.dedent("""\ 

43 Inside the manifest, the `packages` mapping can be used to define requests for the binary packages 

44 you want `debputy` to produce. Each key inside `packages` must be the name of a binary package 

45 defined in `debian/control`. The value is a dictionary defining which features that `debputy` 

46 should apply to that binary package. An example could be: 

47 

48 packages: 

49 foo: 

50 transformations: 

51 - create-symlink: 

52 path: usr/share/foo/my-first-symlink 

53 target: /usr/share/bar/symlink-target 

54 - create-symlink: 

55 path: usr/lib/{{DEB_HOST_MULTIARCH}}/my-second-symlink 

56 target: /usr/lib/{{DEB_HOST_MULTIARCH}}/baz/symlink-target 

57 bar: 

58 transformations: 

59 - create-directories: 

60 - some/empty/directory.d 

61 - another/empty/integration-point.d 

62 - create-directories: 

63 path: a/third-empty/directory.d 

64 owner: www-data 

65 group: www-data 

66 

67 In this case, `debputy` will create some symlinks inside the `foo` package and some directories for 

68 the `bar` package. The following subsections define the keys you can use under each binary package. 

69 """), 

70 reference_documentation_url=manifest_format_doc("binary-package-rules"), 

71 ), 

72}