summaryrefslogtreecommitdiffstats
path: root/src/debputy/dh_migration/migrators_impl.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/debputy/dh_migration/migrators_impl.py')
-rw-r--r--src/debputy/dh_migration/migrators_impl.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/debputy/dh_migration/migrators_impl.py b/src/debputy/dh_migration/migrators_impl.py
index cb05e50..450b5a9 100644
--- a/src/debputy/dh_migration/migrators_impl.py
+++ b/src/debputy/dh_migration/migrators_impl.py
@@ -21,6 +21,7 @@ from typing import (
from debian.deb822 import Deb822
+from debputy import DEBPUTY_DOC_ROOT_DIR
from debputy.architecture_support import dpkg_architecture_table
from debputy.deb_packaging_support import dpkg_field_list_pkg_dep
from debputy.debhelper_emulation import (
@@ -124,6 +125,14 @@ DH_COMMANDS_REPLACED = {
),
}
+_GS_DOC = f"{DEBPUTY_DOC_ROOT_DIR}/GETTING-STARTED-WITH-dh-debputy.md"
+MIGRATION_AID_FOR_OVERRIDDEN_COMMANDS = {
+ "dh_installinit": f"{_GS_DOC}#covert-your-overrides-for-dh_installsystemd-dh_installinit-if-any",
+ "dh_installsystemd": f"{_GS_DOC}#covert-your-overrides-for-dh_installsystemd-dh_installinit-if-any",
+ "dh_fixperms": f"{_GS_DOC}#convert-your-overrides-or-excludes-for-dh_fixperms-if-any",
+ "dh_gencontrol": f"{_GS_DOC}#convert-your-overrides-for-dh_gencontrol-if-any",
+}
+
@dataclasses.dataclass(frozen=True, slots=True)
class UnsupportedDHConfig:
@@ -1362,19 +1371,26 @@ def migrate_dh_hook_targets(
if command not in replaced_commands:
continue
hook_target = hook_target_def["target-name"]
- if sample_hook_target is None:
- sample_hook_target = hook_target
- feature_migration.warn(
- f"TODO: MANUAL MIGRATION required for hook target {hook_target}"
- )
+ advice = MIGRATION_AID_FOR_OVERRIDDEN_COMMANDS.get(command)
+ if advice is None:
+ if sample_hook_target is None:
+ sample_hook_target = hook_target
+ feature_migration.warn(
+ f"TODO: MANUAL MIGRATION required for hook target {hook_target}"
+ )
+ else:
+ feature_migration.warn(
+ f"TODO: MANUAL MIGRATION required for hook target {hook_target}. Please see {advice}"
+ f" for migration advice."
+ )
if (
feature_migration.warnings
and "dh-hook-targets" not in acceptable_migration_issues
+ and sample_hook_target is not None
):
- assert sample_hook_target
raise UnsupportedFeature(
f"The debian/rules file contains one or more non empty dh hook targets that will not"
- f" be run with the requested debputy dh sequence. One of these would be"
+ f" be run with the requested debputy dh sequence with no known migration advice. One of these would be"
f" {sample_hook_target}.",
["dh-hook-targets"],
)