Merge ~juliank/ubiquity:autopurge into ubiquity:master

Proposed by Julian Andres Klode
Status: Merged
Approved by: Jean-Baptiste Lallement
Approved revision: 8f93fc0060a933dcce637418871a24fd409865d0
Merge reported by: Jean-Baptiste Lallement
Merged at revision: 8f93fc0060a933dcce637418871a24fd409865d0
Proposed branch: ~juliank/ubiquity:autopurge
Merge into: ubiquity:master
Diff against target: 32 lines (+13/-0)
2 files modified
debian/changelog (+7/-0)
scripts/plugininstall.py (+6/-0)
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
Review via email: mp+376507@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

Maybe this is a bit crude, and it should only do the new autoremovable hack that unattended-upgrades does, as we otherwise might end up removing auto-removable packages unrelated to the list of packages we are removing.

OTOH, that might complicate things, and we'd end up with unrelated autoremovable packages on the target.

Revision history for this message
Julian Andres Klode (juliank) wrote :

Verified that the fix worked by copying plugininstall.py to today's kubuntu live image and then running ubiquity: I see log entries about which packages where autopurged, and I can run autoremove in the target without any packages being removed :-)

Revision history for this message
Julian Andres Klode (juliank) wrote :

I kept the log message, as it might otherwise be quite hard to figure out that a package was removed due to autopurge.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for the patch. I verified the fix on Ubuntu with a normal and a minimal installation with Ubuntu focal 20191211 and it works as expected.

The list of packages autoremoved looks ok, and there is no package left to autoremove after installation.

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index bfb24ce..94095e3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+ubiquity (20.04.4) UNRELEASED; urgency=medium
7+
8+ * When removing packages, also remove automatically installed packages that
9+ are no longer required (LP: #1798992)
10+
11+ -- Julian Andres Klode <juliank@ubuntu.com> Mon, 09 Dec 2019 10:43:45 +0100
12+
13 ubiquity (20.04.3) focal; urgency=medium
14
15 [ Michael Hudson-Doyle ]
16diff --git a/scripts/plugininstall.py b/scripts/plugininstall.py
17index e772cbf..c3c648d 100755
18--- a/scripts/plugininstall.py
19+++ b/scripts/plugininstall.py
20@@ -1008,6 +1008,12 @@ class Install(install_misc.InstallBase):
21 with cache.actiongroup():
22 install_misc.get_remove_list(cache, to_remove, recursive)
23
24+ with cache.actiongroup():
25+ for cachedpkg in cache:
26+ if cachedpkg.is_auto_removable and not cachedpkg.marked_delete:
27+ syslog.syslog("Autopurge %s" % cachedpkg.name)
28+ cachedpkg.mark_delete(auto_fix=False, purge=True)
29+
30 self.db.progress('SET', 1)
31 self.progress_region(1, 5)
32 fetchprogress = install_misc.DebconfAcquireProgress(

Subscribers

People subscribed via source and target branches