From 928d7c4965792da8d18ffcbf3bfff7a4ccfb1c56 Mon Sep 17 00:00:00 2001 From: Kivi Kaitaniemi Date: Tue, 27 Jan 2026 23:45:56 +0200 Subject: [PATCH] Don't try to remove empty build dependencies from chroot #44 --- .../decman-pacman/src/decman/plugins/aur/__init__.py | 2 +- plugins/decman-pacman/src/decman/plugins/aur/fpm.py | 11 +++++++---- plugins/decman-pacman/src/decman/plugins/pacman.py | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/decman-pacman/src/decman/plugins/aur/__init__.py b/plugins/decman-pacman/src/decman/plugins/aur/__init__.py index 848529a..1f9d3bc 100644 --- a/plugins/decman-pacman/src/decman/plugins/aur/__init__.py +++ b/plugins/decman-pacman/src/decman/plugins/aur/__init__.py @@ -188,7 +188,7 @@ class AUR(plugins.Plugin): ) for package in to_remove: dependants = pm.get_dependants(package) - if any(dependant in dependants_to_keep for dependant in dependants): + if dependants & dependants_to_keep: to_set_as_dependencies.add(package) else: actually_to_remove.add(package) diff --git a/plugins/decman-pacman/src/decman/plugins/aur/fpm.py b/plugins/decman-pacman/src/decman/plugins/aur/fpm.py index c51cee3..2614967 100644 --- a/plugins/decman-pacman/src/decman/plugins/aur/fpm.py +++ b/plugins/decman-pacman/src/decman/plugins/aur/fpm.py @@ -625,8 +625,6 @@ class PackageBuilder: add_package_to_cache(self._store, pkgname, version, dest) - output.print_info("Removing build dependencies from chroot.") - if len(chroot_new_pacman_pkgs) != 0: to_remove = set() for p in chroot_new_pacman_pkgs: @@ -635,8 +633,13 @@ class PackageBuilder: _, cmd_output = command.check_run_result(cmd, command.run(cmd)) real_pkgname = cmd_output.strip() to_remove.add(real_pkgname) - cmd = self._commands.remove_chroot(self.chroot_dir, to_remove) - command.prg(cmd, pty=config.debug_output) + + if to_remove: + output.print_info("Removing build dependencies from chroot.") + cmd = self._commands.remove_chroot(self.chroot_dir, to_remove) + command.prg(cmd, pty=config.debug_output) + else: + output.print_debug("No build dependencies to remove from chroot.") output.print_info(f"Finished building: '{' '.join(package_names)}'.") diff --git a/plugins/decman-pacman/src/decman/plugins/pacman.py b/plugins/decman-pacman/src/decman/plugins/pacman.py index 894ec73..ace02ee 100644 --- a/plugins/decman-pacman/src/decman/plugins/pacman.py +++ b/plugins/decman-pacman/src/decman/plugins/pacman.py @@ -102,7 +102,7 @@ class Pacman(plugins.Plugin): dependants_to_keep = self.packages | currently_installed_foreign for package in to_remove: dependants = pm.get_dependants(package) - if any(dependant in dependants_to_keep for dependant in dependants): + if dependants & dependants_to_keep: to_set_as_dependencies.add(package) else: actually_to_remove.add(package)