Don't try to remove empty build dependencies from chroot #44

This commit is contained in:
Kivi Kaitaniemi
2026-01-27 23:45:56 +02:00
parent 360e0fcf9e
commit 928d7c4965
3 changed files with 9 additions and 6 deletions
@@ -188,7 +188,7 @@ class AUR(plugins.Plugin):
) )
for package in to_remove: for package in to_remove:
dependants = pm.get_dependants(package) 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) to_set_as_dependencies.add(package)
else: else:
actually_to_remove.add(package) actually_to_remove.add(package)
@@ -625,8 +625,6 @@ class PackageBuilder:
add_package_to_cache(self._store, pkgname, version, dest) add_package_to_cache(self._store, pkgname, version, dest)
output.print_info("Removing build dependencies from chroot.")
if len(chroot_new_pacman_pkgs) != 0: if len(chroot_new_pacman_pkgs) != 0:
to_remove = set() to_remove = set()
for p in chroot_new_pacman_pkgs: for p in chroot_new_pacman_pkgs:
@@ -635,8 +633,13 @@ class PackageBuilder:
_, cmd_output = command.check_run_result(cmd, command.run(cmd)) _, cmd_output = command.check_run_result(cmd, command.run(cmd))
real_pkgname = cmd_output.strip() real_pkgname = cmd_output.strip()
to_remove.add(real_pkgname) to_remove.add(real_pkgname)
if to_remove:
output.print_info("Removing build dependencies from chroot.")
cmd = self._commands.remove_chroot(self.chroot_dir, to_remove) cmd = self._commands.remove_chroot(self.chroot_dir, to_remove)
command.prg(cmd, pty=config.debug_output) 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)}'.") output.print_info(f"Finished building: '{' '.join(package_names)}'.")
@@ -102,7 +102,7 @@ class Pacman(plugins.Plugin):
dependants_to_keep = self.packages | currently_installed_foreign dependants_to_keep = self.packages | currently_installed_foreign
for package in to_remove: for package in to_remove:
dependants = pm.get_dependants(package) 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) to_set_as_dependencies.add(package)
else: else:
actually_to_remove.add(package) actually_to_remove.add(package)