diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:22:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 10:22:14 +0000 |
commit | f4d48b8f28f9bfb94f76af49d7aa94b5b26f91f0 (patch) | |
tree | 5c66f83463b33b0ebd806fe8ccb4d53053b9bbdf | |
parent | Adding debian version 0.1.42. (diff) | |
download | debputy-f4d48b8f28f9bfb94f76af49d7aa94b5b26f91f0.tar.xz debputy-f4d48b8f28f9bfb94f76af49d7aa94b5b26f91f0.zip |
Merging upstream version 0.1.43.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r-- | src/debputy/commands/debputy_cmd/__main__.py | 17 | ||||
-rw-r--r-- | src/debputy/deb_packaging_support.py | 2 | ||||
-rw-r--r-- | src/debputy/packaging/makeshlibs.py | 22 | ||||
-rw-r--r-- | src/debputy/util.py | 12 |
4 files changed, 40 insertions, 13 deletions
diff --git a/src/debputy/commands/debputy_cmd/__main__.py b/src/debputy/commands/debputy_cmd/__main__.py index 731576e..27d52ca 100644 --- a/src/debputy/commands/debputy_cmd/__main__.py +++ b/src/debputy/commands/debputy_cmd/__main__.py @@ -92,6 +92,8 @@ from debputy.util import ( escape_shell, program_name, integrated_with_debhelper, + change_log_level, + PRINT_COMMAND, ) @@ -652,6 +654,16 @@ def _run_tests_for_plugin(context: CommandContext) -> None: def _dh_integration_generate_debs(context: CommandContext) -> None: integrated_with_debhelper() parsed_args = context.parsed_args + log_level: Optional[int] = None + if os.environ.get("DH_VERBOSE", "") != "": + log_level = PRINT_COMMAND + if parsed_args.debug_mode: + log_level = logging.INFO + if log_level is not None: + _warn( + f"LOG LEVEL: {log_level} -- {logging.WARNING} -- {PRINT_COMMAND} -- {logging.INFO}" + ) + change_log_level(log_level) integration_mode = context.resolve_integration_mode() is_dh_rrr_only_mode = integration_mode == INTEGRATION_MODE_DH_DEBPUTY_RRR if is_dh_rrr_only_mode: @@ -662,9 +674,6 @@ def _dh_integration_generate_debs(context: CommandContext) -> None: _error( f"Plugins are not supported in the zz-debputy-rrr sequence. Detected plugins: {plugin_names}" ) - debug_materialization = ( - os.environ.get("DH_VERBOSE", "") != "" or parsed_args.debug_mode - ) plugins = context.load_plugins().plugin_data for plugin in plugins.values(): @@ -733,7 +742,7 @@ def _dh_integration_generate_debs(context: CommandContext) -> None: manifest, package_data_table, is_dh_rrr_only_mode, - debug_materialization=debug_materialization, + debug_materialization=log_level is not None, ) diff --git a/src/debputy/deb_packaging_support.py b/src/debputy/deb_packaging_support.py index 897c2b6..875b3b1 100644 --- a/src/debputy/deb_packaging_support.py +++ b/src/debputy/deb_packaging_support.py @@ -1337,6 +1337,8 @@ def _generate_dbgsym_control_file_if_relevant( component = section.split("/", 1)[1] + "/" if multi_arch != "same": extra_params.append("-UMulti-Arch") + else: + extra_params.append(f"-DMulti-Arch={multi_arch}") extra_params.append("-UReplaces") extra_params.append("-UBreaks") dbgsym_control_dir = os.path.join(dbgsym_root_dir, "DEBIAN") diff --git a/src/debputy/packaging/makeshlibs.py b/src/debputy/packaging/makeshlibs.py index 127a64d..a020545 100644 --- a/src/debputy/packaging/makeshlibs.py +++ b/src/debputy/packaging/makeshlibs.py @@ -200,12 +200,19 @@ def generate_shlib_dirs( ) -> None: dir_scanned: Dict[str, Dict[str, Set[str]]] = {} dirs: Dict[str, str] = {} + warn_dirs = { + "/usr/lib", + "/lib", + f"/usr/lib/{pkg.deb_multiarch}", + f"/lib/{pkg.deb_multiarch}", + } for soname_info in soname_info_list: elf_binary = soname_info.path p = assume_not_none(elf_binary.parent_dir) - matches = dir_scanned.get(p.absolute) - materialized_dir = dirs.get(p.absolute) + abs_parent_path = p.absolute + matches = dir_scanned.get(abs_parent_path) + materialized_dir = dirs.get(abs_parent_path) if matches is None: matches = collections.defaultdict(set) for child in p.iterdir: @@ -216,17 +223,18 @@ def generate_shlib_dirs( # The shlib symlinks (we are interested in) are relative to the same folder continue matches[target].add(child.name) - dir_scanned[p.absolute] = matches + dir_scanned[abs_parent_path] = matches symlinks = matches.get(elf_binary.name) if not symlinks: - _warn( - f"Could not find any SO symlinks pointing to {elf_binary.absolute} in {pkg.name} !?" - ) + if abs_parent_path in warn_dirs: + _warn( + f"Could not find any SO symlinks pointing to {elf_binary.absolute} in {pkg.name} !?" + ) continue if materialized_dir is None: materialized_dir = tempfile.mkdtemp(prefix=f"{pkg.name}_", dir=root_dir) materialized_dirs.append(materialized_dir) - dirs[p.absolute] = materialized_dir + dirs[abs_parent_path] = materialized_dir os.symlink(elf_binary.fs_path, os.path.join(materialized_dir, elf_binary.name)) for link in symlinks: diff --git a/src/debputy/util.py b/src/debputy/util.py index 860280e..ebd38c2 100644 --- a/src/debputy/util.py +++ b/src/debputy/util.py @@ -105,6 +105,7 @@ _PROFILE_GROUP_SPLIT = re.compile(r">\s+<") _DEFAULT_LOGGER: Optional[logging.Logger] = None _STDOUT_HANDLER: Optional[logging.StreamHandler[Any]] = None _STDERR_HANDLER: Optional[logging.StreamHandler[Any]] = None +PRINT_COMMAND = logging.INFO + 5 def assume_not_none(x: Optional[T]) -> T: @@ -225,8 +226,8 @@ def escape_shell(*args: str) -> str: return " ".join(_escape_shell_word(w) for w in args) -def print_command(*args: str, print_at_log_level: int = logging.INFO) -> None: - if logging.getLogger().isEnabledFor(print_at_log_level): +def print_command(*args: str, print_at_log_level: int = PRINT_COMMAND) -> None: + if _DEFAULT_LOGGER and _DEFAULT_LOGGER.isEnabledFor(print_at_log_level): print(f" {escape_shell(*args)}") @@ -728,6 +729,13 @@ def package_cross_check_precheck( return a_may_see_b, b_may_see_a +def change_log_level( + log_level: int, +) -> None: + if _DEFAULT_LOGGER is not None: + _DEFAULT_LOGGER.setLevel(log_level) + + def setup_logging( *, log_only_to_stderr: bool = False, |