diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:23:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:23:10 +0000 |
commit | 401def0241bce74e3e093ea9dac16d141d818d43 (patch) | |
tree | f004a9eb89e1cd971db91d5409448f04598d3ed6 | |
parent | Adding upstream version 0.1.46. (diff) | |
download | debputy-401def0241bce74e3e093ea9dac16d141d818d43.tar.xz debputy-401def0241bce74e3e093ea9dac16d141d818d43.zip |
Adding upstream version 0.1.47.upstream/0.1.47
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | GETTING-STARTED-WITH-dh-debputy.md | 7 | ||||
-rw-r--r-- | INTEGRATION-MODES.md | 149 | ||||
-rw-r--r-- | MANIFEST-FORMAT.md | 2 | ||||
-rw-r--r-- | docs/IMPLEMENTATION-DECISIONS.md | 7 | ||||
-rw-r--r-- | src/debputy/commands/debputy_cmd/__main__.py | 3 | ||||
-rw-r--r-- | src/debputy/commands/debputy_cmd/output.py | 29 | ||||
-rw-r--r-- | src/debputy/dh_migration/migration.py | 27 | ||||
-rw-r--r-- | src/debputy/dh_migration/migrators.py | 3 | ||||
-rw-r--r-- | src/debputy/dh_migration/migrators_impl.py | 8 | ||||
-rw-r--r-- | src/debputy/dh_migration/models.py | 2 | ||||
-rw-r--r-- | src/debputy/linting/lint_report_junit.py | 3 | ||||
-rw-r--r-- | src/debputy/linting/lint_util.py | 5 | ||||
-rw-r--r-- | src/debputy/lsp/lsp_debian_changelog.py | 2 | ||||
-rw-r--r-- | src/debputy/lsp/lsp_debian_control.py | 29 | ||||
-rw-r--r-- | src/debputy/lsp/lsp_debian_control_reference_data.py | 8 | ||||
-rw-r--r-- | src/debputy/lsp/lsp_generic_deb822.py | 10 | ||||
-rw-r--r-- | src/debputy/plugin/debputy/build_system_rules.py | 2 | ||||
-rw-r--r-- | src/debputy/util.py | 1 | ||||
-rw-r--r-- | tests/test_migrations.py | 9 | ||||
-rw-r--r-- | tests/test_substitute.py | 3 |
20 files changed, 282 insertions, 27 deletions
diff --git a/GETTING-STARTED-WITH-dh-debputy.md b/GETTING-STARTED-WITH-dh-debputy.md index 7b6796b..5825b49 100644 --- a/GETTING-STARTED-WITH-dh-debputy.md +++ b/GETTING-STARTED-WITH-dh-debputy.md @@ -44,10 +44,17 @@ your packaging. At the time of writing, your options are: converted at this time. Note that this mode does *not* interact well with most third-party `dh` addons. You are recommended to start with source packages without third-party `dh` addons. + 3) `full`: This mode exists but is beyond the scope of this guide. In this mode, `dh` and `debian/rules` + are removed from the build process. If `full` integration is your goal, using `dh-sequence-zz-debputy` + is a good starting point, as any actions needed for `dh-sequence-zz-debputy` will also be needed for + the `full` integration mode. + Since you can always migrate from "less integrated" to "more integrated", you are recommended to start with `dh-sequence-zz-debputy-rrr` first. If that works, you can re-run the migration with `dh-sequence-zz-debputy` as the target to see if further integration seems feasible / desirable. +For more details on integration modes, please see [INTEGRATION-MODES.md](INTEGRATION-MODES.md) + Note: More options may appear in the future. ## Step 2: Have `debputy` convert relevant `debhelper` files diff --git a/INTEGRATION-MODES.md b/INTEGRATION-MODES.md new file mode 100644 index 0000000..35e56a1 --- /dev/null +++ b/INTEGRATION-MODES.md @@ -0,0 +1,149 @@ +debputy - Integration modes +=========================== + +_This is [reference documentation] and is primarily useful if you want to know more on integration modes_ +_If you want to migrate to one of these integration modes, then [GETTING-STARTED-WITH-dh-debputy.md](GETTING-STARTED-WITH-dh-debputy.md) might be better._ + +<!-- To writers and reviewers: Check the documentation against https://documentation.divio.com/ --> + + +The debputy tool is a Debian package builder, and it has multiple levels of +"integration" with the package build. Each integration mode has different +pros and cons, which will be covered in this document. + +The integration modes are: + + * `dh-sequence-zz-debputy-rrr` + * `dh-sequence-zz-debputy` (or `dh-sequence-debputy`) + * `full` + +The integration modes that start with `dh-sequence-` are named such because +they leverage `dh` and its add-on system. The `dh-sequence-zz-` is a trick +to convince `dh` to load the add-ons last when they are activated via +`Build-Depends`, which is part of `debputy`'s strategy for maximizing +compatibility with other `dh` add-ons. + +Integration mode - `dh-sequence-zz-debputy-rrr` +----------------------------------------------- + +This integration mode is a minimal integration mode aimed exactly at removing the +(implicit) requirement for `fakeroot` in packages that need static ownership in +the `.deb`. + +It trades many of `debputy` features for compatibility with `debhelper` and ease +of transitions. + +This integration mode is relevant for you when: + + * You want to get rid of the implicit `fakeroot` requirement, and you need static + ownership, OR + * You want to transition to `debputy` in the long term, but more involved integration + modes do not support what you need, OR + * The mode has a particular feature you want that `debhelper` does not provide. + + +Pros: + + * You can use `debputy` to assign static ownerships without needing `fakeroot`, + which is not possible with `debhelper`. + * You get maximum compatibility with existing `dh` add-ons. + * Migration is generally possible with minimal or small changes. + * It is accessible in `bullseye-backports` + +Cons: + + * Many of `debputy`'s features cannot be used. + * Most limitations of `debhelper` still applies (though these limitations are the + status quo, so the package would have a solution to them if needed). + * You still longer a turning complete configuration language for your package helper + (`debian/rules`) with poor introspection. + +To migrate, please use: + + debputy migrate-from-dh --migration-target dh-sequence-zz-debputy-rrr + +Note: The `debputy migrate-from-dh` command accepts a `--no-act --acceptable-migration-issues=ALL`, +if you want to see how involved the migration will be. + +For documentation, please see: + * [GETTING-STARTED-WITH-dh-debputy.md] for a more detailed migration guide (how-to guide). + * https://wiki.debian.org/BuildingWithoutFakeroot + + +Integration mode - `dh-sequence-zz-debputy` +------------------------------------------- + +This integration mode is a more involved integration mode of `debputy` that partly leverages +`dh`. In this mode, `debputy` will take over all the logic of installing files into the +respective package staging directories (`debian/<pkg>`). Roughly speaking, the original +`debhelper` runs until `dh_auto_install` and then `debputy` takes over. + +This integration mode is relevant when: + + * You want to migrate to the `full` integration mode, but you would like to split the migration + in two, OR + * You want to use more of `debputy`'s features and do not use any unsupported `dh` add-ons without + wanting to migrate the build part. + +Pros: + + * You can use the most features of `debputy`. Only the build and environment related ones are + not accessible. + * It is accessible in `bullseye-backports` + +Cons: + + * Almost all `dh` add-ons will stop working since they rely on being able to see the content + of `debian/<pkg>`. Since `debputy` will populate *and* assemble the `.deb`, there is never + a window for the affected add-on to work. Any features provided by these add-ons would have + to be provided by a `debputy` plugin (or `debputy` itself). + * Your only `debhelper` limitations is `dh` notorious lack of proper multi-build support. + * You still longer a turning complete configuration language for your package helper + (`debian/rules`) with poor introspection. + +To migrate, please use: + + debputy migrate-from-dh --migration-target dh-sequence-zz-debputy + +Note: The `debputy migrate-from-dh` command accepts a `--no-act --acceptable-migration-issues=ALL`, +if you want to see how involved the migration will be. It will also detect possible incompatible +`dh` add-ons if you are concerned about whether your package can be supported. + +For documentation, please see: + * [GETTING-STARTED-WITH-dh-debputy.md] for a more detailed migration guide (how-to guide). + + +Integration mode - `full` +------------------------- + +This is the integration mode that `debputy` is about. In the `full` integration mode, `debputy` +replaces `dh` as the package helper. It even removes `debian/rules` replacing it with `dpkg`'s +new `Build-Driver` feature. + +Pros: + + * You can use all features from `debputy` including its native multi-build support. + * You can still leverage `debhelper` build systems (anything integrating with the `dh_auto_*` + tools.) via the `debhelper` build system. + * You no longer have a turning complete configuration language for your package helper + (`debian/rules`) with poor introspection. + +Cons: + + * (Temporary) Incomplete `debputy migrate-from-dh` support + * It is a new ecosystem missing a lot of the third-party features you would find for `dh`. + Only `debhelper` build systems (`dh_auto_*`) can be reused. + * It requires Debian `trixie` or later due to `Build-Driver` (`dpkg-dev`) + * You no longer have the flexibility of a turning complete configuration language for your + package helper, which some people might miss. :) + +To migrate, please use: + + debputy migrate-from-dh --migration-target full + +Note: The `debputy migrate-from-dh` command accepts a `--no-act --acceptable-migration-issues=ALL`, +if you want to see how involved the migration will be. It will also detect possible incompatible +`dh` add-ons if you are concerned about whether your package can be supported. + + +[reference documentation]: https://documentation.divio.com/reference/ diff --git a/MANIFEST-FORMAT.md b/MANIFEST-FORMAT.md index b7d8262..aeb737f 100644 --- a/MANIFEST-FORMAT.md +++ b/MANIFEST-FORMAT.md @@ -1,6 +1,6 @@ # The debputy manifest format -_This is [reference guide] and is primarily useful if you have an idea of what you are looking for._ +_This is [reference documentation] and is primarily useful if you have an idea of what you are looking for._ _If you are new to `debputy`, maybe you want to read [GETTING-STARTED-WITH-dh-debputy.md](GETTING-STARTED-WITH-dh-debputy.md) first._ <!-- To writers and reviewers: Check the documentation against https://documentation.divio.com/ --> diff --git a/docs/IMPLEMENTATION-DECISIONS.md b/docs/IMPLEMENTATION-DECISIONS.md index b1d3b57..b238d27 100644 --- a/docs/IMPLEMENTATION-DECISIONS.md +++ b/docs/IMPLEMENTATION-DECISIONS.md @@ -212,7 +212,7 @@ When loading the python code for plugins, there were multiple ways to initialize 1. The plugin could have an initialization function that is called by `debputy` 2. The plugin could use `@some_feature` annotations on types to be registered. This is similar - in spirit to the `add-on` system where module load is considered the initialization event. + in spirit to the `dh` add-on system where module load is considered the initialization event. The 1. option was chosen because it is more reliable at directing the control flow and enables the plugin module to be importable by non-`debputy` code. The latter might not seem directly @@ -228,3 +228,8 @@ property (see above) or be "safety is opt-in rather than always on/opt-out" by h "This is plugin X code coming now" - the absence of a marker then causing misattribution). If these problems could be solved, the annotation based loading could be considered. + +Note: This is not to say that `@feature` cannot be used at all in the plugin code. The annotation +can be used to add metadata to things that simplify the logic required by the initialization +function. The annotation would have to be stateless and cannot make assumptions about which +plugin is being loaded while it is run. diff --git a/src/debputy/commands/debputy_cmd/__main__.py b/src/debputy/commands/debputy_cmd/__main__.py index 1432327..58a6fb4 100644 --- a/src/debputy/commands/debputy_cmd/__main__.py +++ b/src/debputy/commands/debputy_cmd/__main__.py @@ -32,7 +32,7 @@ from debputy.commands.debputy_cmd.context import ( ROOT_COMMAND, CommandArg, ) -from debputy.commands.debputy_cmd.output import _stream_to_pager +from debputy.commands.debputy_cmd.output import _stream_to_pager, _output_styling from debputy.dh_migration.migrators import MIGRATORS from debputy.exceptions import ( DebputyRuntimeError, @@ -1002,6 +1002,7 @@ def _migrate_from_dh(context: CommandContext) -> None: ) ) migrate_from_dh( + _output_styling(context.parsed_args, sys.stdout), manifest, acceptable_migration_issues, parsed_args.destructive, diff --git a/src/debputy/commands/debputy_cmd/output.py b/src/debputy/commands/debputy_cmd/output.py index 5159980..334eab4 100644 --- a/src/debputy/commands/debputy_cmd/output.py +++ b/src/debputy/commands/debputy_cmd/output.py @@ -192,6 +192,9 @@ class OutputStylingBase: def render_url(self, link_url: str) -> str: return link_url + def bts(self, bugno) -> str: + return f"https://bugs.debian.org/{bugno}" + class ANSIOutputStylingBase(OutputStylingBase): def __init__( @@ -260,6 +263,25 @@ class ANSIOutputStylingBase(OutputStylingBase): link_url = f"https://manpages.debian.org/{page}.{section}" return URL_START + f"{link_url}\a{link_text}" + URL_END + def bts(self, bugno) -> str: + if not self._support_clickable_urls: + return super().bts(bugno) + return self.render_url(f"https://bugs.debian.org/{bugno}") + + +def no_fancy_output( + stream: IO[str] = None, + output_format: str = str, + optimize_for_screen_reader: bool = False, +) -> OutputStylingBase: + if stream is None: + stream = sys.stdout + return OutputStylingBase( + stream, + output_format, + optimize_for_screen_reader=optimize_for_screen_reader, + ) + def _output_styling( parsed_args: argparse.Namespace, @@ -270,9 +292,12 @@ def _output_styling( output_format = "text" optimize_for_screen_reader = os.environ.get("OPTIMIZE_FOR_SCREEN_READER", "") != "" if not stream.isatty(): - return OutputStylingBase( - stream, output_format, optimize_for_screen_reader=optimize_for_screen_reader + return no_fancy_output( + stream, + output_format, + optimize_for_screen_reader=optimize_for_screen_reader, ) + return ANSIOutputStylingBase( stream, output_format, optimize_for_screen_reader=optimize_for_screen_reader ) diff --git a/src/debputy/dh_migration/migration.py b/src/debputy/dh_migration/migration.py index 62f739e..7b06135 100644 --- a/src/debputy/dh_migration/migration.py +++ b/src/debputy/dh_migration/migration.py @@ -8,6 +8,7 @@ from typing import Optional, List, Callable, Set, Container, Mapping, FrozenSet from debian.deb822 import Deb822 from debputy.commands.debputy_cmd.context import CommandContext +from debputy.commands.debputy_cmd.output import OutputStylingBase from debputy.dh.debhelper_emulation import CannotEmulateExecutableDHConfigFile from debputy.dh_migration.migrators import MIGRATORS from debputy.dh_migration.migrators_impl import ( @@ -46,6 +47,7 @@ SUPPORTED_MIGRATIONS: Mapping[ def _print_migration_summary( + fo: OutputStylingBase, migrations: List[FeatureMigration], compat: int, min_compat_level: int, @@ -59,9 +61,11 @@ def _print_migration_summary( continue underline = "-" * len(migration.tagline) if migration.warnings: + if warning_count: + _warn("") _warn(f"Summary for migration: {migration.tagline}") - _warn(f"-----------------------{underline}") - _warn(" /!\\ ATTENTION /!\\") + if not fo.optimize_for_screen_reader: + _warn(f"-----------------------{underline}") warning_count += len(migration.warnings) for warning in migration.warnings: _warn(f" * {warning}") @@ -70,7 +74,8 @@ def _print_migration_summary( if warning_count: _warn("") _warn("Supported debhelper compat check") - _warn("--------------------------------") + if not fo.optimize_for_screen_reader: + _warn("--------------------------------") warning_count += 1 _warn( f"The migration tool assumes debhelper compat {min_compat_level}+ semantics, but this package" @@ -85,7 +90,8 @@ def _print_migration_summary( if warning_count: _warn("") _warn("Missing debputy plugin check") - _warn("----------------------------") + if not fo.optimize_for_screen_reader: + _warn("----------------------------") _warn( f"The migration tool could not read d/control and therefore cannot tell if all the required" f" plugins have been requested. Please ensure that the package Build-Depends on: {needed_plugins}" @@ -100,7 +106,8 @@ def _print_migration_summary( if warning_count: _warn("") _warn("Missing debputy plugin check") - _warn("----------------------------") + if not fo.optimize_for_screen_reader: + _warn("----------------------------") _warn( f"The migration tool asserted that the following `debputy` plugins would be required, which" f" are not explicitly requested. Please add the following to Build-Depends: {needed_plugins}" @@ -207,6 +214,7 @@ def _check_migration_target( def migrate_from_dh( + fo: OutputStylingBase, manifest: HighLevelManifest, acceptable_migration_issues: AcceptableMigrationIssues, permit_destructive_changes: Optional[bool], @@ -225,7 +233,7 @@ def migrate_from_dh( try: for migrator in MIGRATORS[migration_target]: - feature_migration = FeatureMigration(migrator.__name__) + feature_migration = FeatureMigration(migrator.__name__, fo) migrator( debian_dir, manifest, @@ -291,7 +299,12 @@ def migrate_from_dh( ) _print_migration_summary( - migrations, compat, min_compat, required_plugins, requested_plugins + fo, + migrations, + compat, + min_compat, + required_plugins, + requested_plugins, ) migration_count = sum((m.performed_changes for m in migrations), 0) diff --git a/src/debputy/dh_migration/migrators.py b/src/debputy/dh_migration/migrators.py index 8a057b7..3c2d6e0 100644 --- a/src/debputy/dh_migration/migrators.py +++ b/src/debputy/dh_migration/migrators.py @@ -1,5 +1,6 @@ -from typing import Callable, List, Mapping +from typing import Callable, List, Mapping, Protocol, Optional +from debputy.commands.debputy_cmd.output import OutputStylingBase from debputy.dh_migration.migrators_impl import ( migrate_links_files, migrate_maintscript, diff --git a/src/debputy/dh_migration/migrators_impl.py b/src/debputy/dh_migration/migrators_impl.py index 97b0fd2..ca44b68 100644 --- a/src/debputy/dh_migration/migrators_impl.py +++ b/src/debputy/dh_migration/migrators_impl.py @@ -24,6 +24,7 @@ from debian.deb822 import Deb822 from debputy import DEBPUTY_DOC_ROOT_DIR from debputy.architecture_support import dpkg_architecture_table +from debputy.commands.debputy_cmd.output import OutputStylingBase from debputy.deb_packaging_support import dpkg_field_list_pkg_dep from debputy.dh.debhelper_emulation import ( dhe_filedoublearray, @@ -1500,16 +1501,18 @@ def detect_obsolete_substvars( seen_obsolete_relationship_substvars.update(obsolete_substvars_in_field) package = p.get("Package", "(Missing package name!?)") + fo = feature_migration.fo if obsolete_fields: fields = ", ".join(obsolete_fields) feature_migration.warn( f"The following relationship fields can be removed from {package}: {fields}." - f" (The content in them would be applied automatically.)" + f" (The content in them would be applied automatically. Note: {fo.bts('1067653')})" ) if seen_obsolete_relationship_substvars: v = ", ".join(sorted(seen_obsolete_relationship_substvars)) feature_migration.warn( f"The following relationship substitution variables can be removed from {package}: {v}" + f" (Note: {fo.bts('1067653')})" ) @@ -1552,6 +1555,9 @@ def detect_dh_addons_with_full_integration( feature_migration.warn( "TODO: Not implemented: Please ensure there is a Build-Dependency on `debputy (>= 0.1.45~)" ) + feature_migration.warn( + "TODO: Not implemented: Please ensure there is a Build-Dependency on `dpkg-dev (>= 1.22.7~)" + ) def detect_dh_addons_with_zz_integration( diff --git a/src/debputy/dh_migration/models.py b/src/debputy/dh_migration/models.py index ace4185..c093633 100644 --- a/src/debputy/dh_migration/models.py +++ b/src/debputy/dh_migration/models.py @@ -3,6 +3,7 @@ import re from typing import Sequence, Optional, FrozenSet, Tuple, List, cast from debputy.architecture_support import DpkgArchitectureBuildProcessValuesTable +from debputy.commands.debputy_cmd.output import OutputStylingBase from debputy.highlevel_manifest import MutableYAMLManifest from debputy.substitution import Substitution @@ -38,6 +39,7 @@ class ConflictingChange(RuntimeError): @dataclasses.dataclass(slots=True) class FeatureMigration: tagline: str + fo: OutputStylingBase successful_manifest_changes: int = 0 already_present: int = 0 warnings: List[str] = dataclasses.field(default_factory=list) diff --git a/src/debputy/linting/lint_report_junit.py b/src/debputy/linting/lint_report_junit.py index 2ad993a..4df6879 100644 --- a/src/debputy/linting/lint_report_junit.py +++ b/src/debputy/linting/lint_report_junit.py @@ -69,9 +69,10 @@ class JunitLintReport(LintReport): range_desc = "entire file" else: range_desc = str(diagnostic.range) + code = f" [{diagnostic.code}]" if diagnostic.code else "" output = textwrap.dedent( f"""\ - {filename} [{severity}] ({range_desc}): {diagnostic.message} + {filename}{code} ({severity}) {range_desc}: {diagnostic.message} """ ) case.add_failure_info( diff --git a/src/debputy/linting/lint_util.py b/src/debputy/linting/lint_util.py index 017a1dc..feca476 100644 --- a/src/debputy/linting/lint_util.py +++ b/src/debputy/linting/lint_util.py @@ -431,8 +431,11 @@ class TermLintReport(LintReport): if diagnostic_result.result_state == LintDiagnosticResultState.FIXABLE: has_fixit = " [Correctable via --auto-fix]" + + code = f"[{diagnostic.code}]: " if diagnostic.code else "" + msg = f"{code}{diagnostic.message}" print( - f"{tag}: File: {filename}:{start_line+1}:{start_position}:{end_line+1}:{end_position}: {diagnostic.message}{has_fixit}", + f"{tag}: File: {filename}:{start_line+1}:{start_position}:{end_line+1}:{end_position}: {msg}{has_fixit}", ) if diagnostic_result.missing_severity: _warn( diff --git a/src/debputy/lsp/lsp_debian_changelog.py b/src/debputy/lsp/lsp_debian_changelog.py index bde15b5..e3d2154 100644 --- a/src/debputy/lsp/lsp_debian_changelog.py +++ b/src/debputy/lsp/lsp_debian_changelog.py @@ -142,7 +142,7 @@ def _check_footer_line( if day_name not in _KNOWN_WEEK_DAYS: yield Diagnostic( position_codec.range_to_client_units(lines, day_name_range_server_units), - "Expected a three letter date here (Mon, Tue, ..., Sun).", + "Expected a three letter date here using US English format (Mon, Tue, ..., Sun).", severity=DiagnosticSeverity.Error, source="debputy", ) diff --git a/src/debputy/lsp/lsp_debian_control.py b/src/debputy/lsp/lsp_debian_control.py index ac08266..e33292d 100644 --- a/src/debputy/lsp/lsp_debian_control.py +++ b/src/debputy/lsp/lsp_debian_control.py @@ -432,6 +432,18 @@ def _render_package_lookup( f"This build-dependency will activate the `dh` sequence called `{sequence}`." ) segments.append("") + + elif ( + known_field.name == "Build-Depends" + and name.startswith("debputy-plugin-") + and len(name) > 15 + ): + plugin_name = name[15:] + segments.append( + f"This build-dependency will activate the `debputy` plugin called `{plugin_name}`." + ) + segments.append("") + segments.extend( [ f"Synopsis: {provider.synopsis}", @@ -492,6 +504,23 @@ def _render_package_by_name( ) + _disclaimer(is_empty) ) + if ( + known_field.name == "Build-Depends" + and name.startswith("debputy-plugin-") + and len(name) > 15 + ): + plugin_name = name[15:] + return ( + textwrap.dedent( + f"""\ + # {name} + + This build-dependency will activate the `debputy` plugin called `{plugin_name}`. + + """ + ) + + _disclaimer(is_empty) + ) return ( textwrap.dedent( f"""\ diff --git a/src/debputy/lsp/lsp_debian_control_reference_data.py b/src/debputy/lsp/lsp_debian_control_reference_data.py index 91eb6c2..8f8fb10 100644 --- a/src/debputy/lsp/lsp_debian_control_reference_data.py +++ b/src/debputy/lsp/lsp_debian_control_reference_data.py @@ -314,7 +314,7 @@ ALL_PRIORITIES = allowed_values( ), Keyword( "important", - synopsis_doc="[RARE]: Bare minimum of bare minimum of commonly-expected and necessary tools", + synopsis_doc="[RARE]: Bare minimum of commonly-expected and necessary tools", hover_text=textwrap.dedent( """\ The *important* packages are a bare minimum of commonly-expected and necessary tools. @@ -4339,7 +4339,8 @@ _DTESTSCTRL_FIELDS = _fields( FieldValueClass.COMMA_SEPARATED_LIST, default_value="@", synopsis_doc="Dependencies for running the tests", - hover_text="""\ + hover_text=textwrap.dedent( + """\ Declares that the specified packages must be installed for the test to go ahead. This supports all features of dpkg dependencies, including the architecture qualifiers (see @@ -4372,7 +4373,8 @@ _DTESTSCTRL_FIELDS = _fields( the source tree's Build-Dependencies are *not* necessarily installed, and if you specify any Depends, no binary packages from the source are installed unless explicitly requested. - """, + """ + ), ), DTestsCtrlKnownField( "Features", diff --git a/src/debputy/lsp/lsp_generic_deb822.py b/src/debputy/lsp/lsp_generic_deb822.py index 4340abc..cde6e8b 100644 --- a/src/debputy/lsp/lsp_generic_deb822.py +++ b/src/debputy/lsp/lsp_generic_deb822.py @@ -380,11 +380,17 @@ def deb822_hover( return None hover_text = keyword.hover_text if hover_text is not None: - hover_text = f"# Value `{keyword.value}` (Field: {known_field.name})\n\n{hover_text}" + header = "`{VALUE}` (Field: {FIELD_NAME})".format( + VALUE=keyword.value, + FIELD_NAME=known_field.name, + ) + hover_text = f"# {header})\n\n{hover_text}" else: hover_text = known_field.hover_text if hover_text is None: - hover_text = f"The field {current_field} had no documentation." + hover_text = ( + f"No documentation is available for the field {current_field}." + ) hover_text = f"# {known_field.name}\n\n{hover_text}" if hover_text is None: diff --git a/src/debputy/plugin/debputy/build_system_rules.py b/src/debputy/plugin/debputy/build_system_rules.py index 454b2db..043b8fa 100644 --- a/src/debputy/plugin/debputy/build_system_rules.py +++ b/src/debputy/plugin/debputy/build_system_rules.py @@ -930,6 +930,8 @@ class DebhelperBuildSystemRule(StepBasedBuildSystemRule): try: v = subprocess.check_output( ["dh_assistant", "which-build-system"], + # Packages without `debhelper-compat` will trigger an error, which will just be noise + stderr=subprocess.DEVNULL, cwd=source_root.fs_path, ) except subprocess.CalledProcessError: diff --git a/src/debputy/util.py b/src/debputy/util.py index 0824569..76f4076 100644 --- a/src/debputy/util.py +++ b/src/debputy/util.py @@ -863,6 +863,7 @@ def change_log_level( ) -> None: if _DEFAULT_LOGGER is not None: _DEFAULT_LOGGER.setLevel(log_level) + logging.getLogger("").setLevel(log_level) def current_log_level() -> Optional[int]: diff --git a/tests/test_migrations.py b/tests/test_migrations.py index b179cab..0704c60 100644 --- a/tests/test_migrations.py +++ b/tests/test_migrations.py @@ -4,6 +4,7 @@ from typing import Callable, Optional, List, Tuple, Sequence import pytest +from debputy.commands.debputy_cmd.output import no_fancy_output from debputy.dh_migration.migrators import Migrator from debputy.dh_migration.migrators_impl import ( migrate_tmpfile, @@ -99,7 +100,7 @@ def run_migrator( *, migration_target=INTEGRATION_MODE_DH_DEBPUTY, ) -> FeatureMigration: - feature_migration = FeatureMigration(migrator.__name__) + feature_migration = FeatureMigration(migrator.__name__, no_fancy_output()) migrator( path, manifest, @@ -1308,7 +1309,7 @@ def test_detect_obsolete_substvars( ) msg = ( "The following relationship substitution variables can be removed from foo:" - " ${misc:Depends}, ${shlibs:Depends}, ${so:Depends}" + " ${misc:Depends}, ${shlibs:Depends}, ${so:Depends} (Note: https://bugs.debian.org/1067653)" ) assert migration.anything_to_do assert migration.warnings == [msg] @@ -1356,7 +1357,7 @@ def test_detect_obsolete_substvars_remove_field( ) msg = ( "The following relationship fields can be removed from foo: Pre-Depends." - " (The content in them would be applied automatically.)" + " (The content in them would be applied automatically. Note: https://bugs.debian.org/1067653)" ) assert migration.anything_to_do assert migration.warnings == [msg] @@ -1406,7 +1407,7 @@ def test_detect_obsolete_substvars_remove_field_essential( ) msg = ( "The following relationship fields can be removed from foo: Pre-Depends." - " (The content in them would be applied automatically.)" + " (The content in them would be applied automatically. Note: https://bugs.debian.org/1067653)" ) assert migration.anything_to_do assert migration.warnings == [msg] diff --git a/tests/test_substitute.py b/tests/test_substitute.py index a83cc7f..81eb2e0 100644 --- a/tests/test_substitute.py +++ b/tests/test_substitute.py @@ -1,6 +1,7 @@ import pytest from debputy.architecture_support import faked_arch_table +from debputy.commands.debputy_cmd.output import no_fancy_output from debputy.dh_migration.models import ( DHMigrationSubstitution, AcceptableMigrationIssues, @@ -55,7 +56,7 @@ def test_substitution_match(debputy_plugin_feature_set, value, expected) -> None def test_migrate_substitution() -> None: - feature_migration = FeatureMigration("test migration") + feature_migration = FeatureMigration("test migration", no_fancy_output()) subst = DHMigrationSubstitution( MOCK_DPKG_ARCH_TABLE, AcceptableMigrationIssues(frozenset()), |