diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/debputy/deb_packaging_support.py | 66 | ||||
-rw-r--r-- | src/debputy/lsp/lsp_debian_control_reference_data.py | 22 |
2 files changed, 56 insertions, 32 deletions
diff --git a/src/debputy/deb_packaging_support.py b/src/debputy/deb_packaging_support.py index 863e394..79f5a38 100644 --- a/src/debputy/deb_packaging_support.py +++ b/src/debputy/deb_packaging_support.py @@ -927,6 +927,8 @@ def setup_control_files( substvars = binary_package_data.substvars snippets = STD_CONTROL_SCRIPTS + generated_triggers = list(binary_package_data.ctrl_creator.generated_triggers()) + if binary_package.is_udeb: # FIXME: Add missing udeb scripts snippets = ["postinst"] @@ -989,16 +991,24 @@ def setup_control_files( ) else: - if package_state.maintscript_snippets: - for script, snippet_container in package_state.maintscript_snippets.items(): - for snippet in snippet_container.all_snippets(): - source = snippet.definition_source - _error( - f"This integration mode cannot use maintscript snippets" - f' (since dh_installdeb has already been called). However, "{source}" triggered' - f" a snippet for {script}. Please remove the offending definition if it is from" - f" the manifest or file a bug if it is caused by a built-in rule." - ) + for script, snippet_container in package_state.maintscript_snippets.items(): + for snippet in snippet_container.all_snippets(): + source = snippet.definition_source + _error( + f"This integration mode cannot use maintscript snippets" + f' (since dh_installdeb has already been called). However, "{source}" triggered' + f" a snippet for {script}. Please remove the offending definition if it is from" + f" the manifest or file a bug if it is caused by a built-in rule." + ) + + for trigger in generated_triggers: + source = f"{trigger.provider.plugin_name}:{trigger.provider_source_id}" + _error( + f"This integration mode must not generate triggers" + f' (since dh_installdeb has already been called). However, "{source}" created' + f" a trigger. Please remove the offending definition if it is from" + f" the manifest or file a bug if it is caused by a built-in rule." + ) dh_staging_dir = os.path.join("debian", binary_package.name, "DEBIAN") try: @@ -1034,37 +1044,29 @@ def setup_control_files( ) return - generated_triggers = list(binary_package_data.ctrl_creator.generated_triggers()) if generated_triggers: - if not allow_ctrl_file_management: - for trigger in generated_triggers: - source = f"{trigger.provider.plugin_name}:{trigger.provider_source_id}" - _error( - f"This integration mode must not generate triggers" - f' (since dh_installdeb has already been called). However, "{source}" created' - f" a trigger. Please remove the offending definition if it is from" - f" the manifest or file a bug if it is caused by a built-in rule." + assert not allow_ctrl_file_management + dest_file = os.path.join(control_output_dir, "triggers") + with open(dest_file, "at", encoding="utf-8") as fd: + fd.writelines( + textwrap.dedent( + f"""\ + # Added by {t.provider_source_id} from {t.provider.plugin_name} + {t.dpkg_trigger_type} {t.dpkg_trigger_target} + """ ) + for t in generated_triggers + ) + os.chmod(fd.fileno(), 0o644) - if generated_triggers: - dest_file = os.path.join(control_output_dir, "triggers") - with open(dest_file, "at", encoding="utf-8") as fd: - fd.writelines( - textwrap.dedent( - f"""\ - # Added by {t.provider_source_id} from {t.provider.plugin_name} - {t.dpkg_trigger_type} {t.dpkg_trigger_target} - """ - ) - for t in generated_triggers - ) - os.chmod(fd.fileno(), 0o644) + if allow_ctrl_file_management: install_or_generate_conffiles( binary_package, control_output_dir, fs_root, manifest.debian_dir, ) + _generate_control_files( binary_package_data.source_package, binary_package, diff --git a/src/debputy/lsp/lsp_debian_control_reference_data.py b/src/debputy/lsp/lsp_debian_control_reference_data.py index f4791cb..2cc85bb 100644 --- a/src/debputy/lsp/lsp_debian_control_reference_data.py +++ b/src/debputy/lsp/lsp_debian_control_reference_data.py @@ -1689,6 +1689,28 @@ BINARY_FIELDS = _fields( ), ), DctrlKnownField( + "XB-Installer-Menu-Item", + FieldValueClass.SINGLE_VALUE, + # TODO: udeb only + hover_text=textwrap.dedent( + """\ + This field is only relevant for `udeb` packages (debian-installer). + + The field is used to declare where in the installer menu this package's menu item should + be placed (assuming it has any menu item). For packages targeting the Debian archive, + any new package should have its menu item number aligned with the debian-installer team + before upload. + + A menu item is 4-5 digits (In the range `1000 <= X <= 99999`). In rare cases, the menu + item can be architecture dependent. For architecture dependent menu item values, use a + custom substvar. + + See https://d-i.debian.org/doc/internals/apa.html for the full list of menu item ranges + and for how to request a number. + """ + ), + ), + DctrlKnownField( "X-DH-Build-For-Type", FieldValueClass.SINGLE_VALUE, default_value="host", |