[Piuparts-devel] [Git][debian/piuparts][develop] 2 commits: Remember systemd-tmpfiles when installing logrotate
Nicolas Dandrimont (@olasd)
gitlab at salsa.debian.org
Sun Mar 16 22:32:40 GMT 2025
Nicolas Dandrimont pushed to branch develop at Debian / piuparts
Commits:
d3b44248 by Nicolas Dandrimont at 2025-03-09T13:35:37+01:00
Remember systemd-tmpfiles when installing logrotate
Looks like under certain circumstances, installing logrotate in a
minimal chroot installs systemd, so the logrotate file check needs to
remember systemd tmpfiles if it hadn't been done earlier.
- - - - -
345d5865 by Nicolas Dandrimont at 2025-03-09T13:40:56+01:00
Make allow-remove-essential an explicit option for remove_packages
This can turn off essential package removal when we only try to remove
the package under test, in which case we usually ignore errors.
Thanks to Guillem Jover <guillem at debian.org> for the report.
- - - - -
1 changed file:
- piuparts.py
Changes:
=====================================
piuparts.py
=====================================
@@ -1674,12 +1674,14 @@ class Chroot:
else:
logging.info(msg)
- def remove_packages(self, packages, ignore_errors=False):
+ def remove_packages(self, packages, allow_remove_essential=True, ignore_errors=False):
"""Remove packages in a chroot."""
+ base_command = ["apt-get", "remove"]
+ if allow_remove_essential:
+ base_command.append("--allow-remove-essential")
if packages:
self.run(
- ["apt-get", "remove", "--allow-remove-essential"]
- + ["%s-" % x if x.endswith("+") else x for x in unqualify(packages)],
+ base_command + ["%s-" % x if x.endswith("+") else x for x in unqualify(packages)],
ignore_errors=ignore_errors,
)
@@ -2138,6 +2140,9 @@ class Chroot:
list of packages that were installed"""
old_selections = self.get_selections()
self.run(["apt-get", "install", "-y", "logrotate"])
+ # If systemd wasn't installed yet, logrotate installs it, so we get to
+ # update our list of known systemd-tmpfiles cruft
+ self.remember_systemd_tmpfiles()
diff = diff_selections(self, old_selections)
return diff.keys()
@@ -2607,7 +2612,7 @@ def install_purge_test(chroot, chroot_state, package_files, packages, extra_pack
chroot.install_packages(package_files, packages, with_scripts=True)
if settings.install_remove_install:
- chroot.remove_packages(packages, ignore_errors=True)
+ chroot.remove_packages(packages, allow_remove_essential=False, ignore_errors=True)
logging.info("Reinstalling after remove")
chroot.install_packages(package_files, packages, with_scripts=True)
chroot.install_packages(package_files, packages, with_scripts=True, reinstall=True)
@@ -2649,7 +2654,7 @@ def install_upgrade_test(chroot, chroot_state, package_files, packages, old_pack
file_owners_before = chroot.get_files_owned_by_packages()
if settings.install_remove_install:
- chroot.remove_packages(packages, ignore_errors=True)
+ chroot.remove_packages(packages, allow_remove_essential=False, ignore_errors=True)
# Then from the package files.
os.environ["PIUPARTS_PHASE"] = "upgrade"
@@ -2801,7 +2806,7 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
chroot.install_packages_by_name(known_packages)
if settings.install_remove_install:
- chroot.remove_packages(packages, ignore_errors=True)
+ chroot.remove_packages(packages, allow_remove_essential=False, ignore_errors=True)
distupgrade_packages = []
chroot.check_for_no_processes()
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/1db83cba78a7742c782f3324fecf35adf7cdae20...345d58658976fdf52a0e93f1baa1dfe05503965d
--
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/1db83cba78a7742c782f3324fecf35adf7cdae20...345d58658976fdf52a0e93f1baa1dfe05503965d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20250316/8ca2d195/attachment-0001.htm>
More information about the Piuparts-devel
mailing list