Skip to content

Commit

Permalink
fix: Honor APT::Get::Purge setting when removing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
paddy-hack committed Aug 25, 2023
1 parent 5f979a2 commit 791fd71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions unattended-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,7 @@ def do_auto_remove(cache, # type: UnattendedUpgradesCache

pkgs_removed = [] # type: List[str]
pkgs_kept_installed = [] # type: List[str]
purge = apt_pkg.config.find_b("APT::Get::Purge", False)
if minimal_steps:
for pkgname in auto_removable:
if should_stop():
Expand All @@ -1904,7 +1905,7 @@ def do_auto_remove(cache, # type: UnattendedUpgradesCache
logging.debug("marking %s for removal" % pkgname)
if pkgname in pkgs_removed:
continue
cache[pkgname].mark_delete()
cache[pkgname].mark_delete(purge)
if not is_autoremove_valid(cache, pkgname, auto_removable):
# this situation can occur when removing newly unused packages
# would also remove old unused packages which are not set
Expand All @@ -1923,7 +1924,7 @@ def do_auto_remove(cache, # type: UnattendedUpgradesCache
cache.clear()
else:
for pkgname in auto_removable:
cache[pkgname].mark_delete()
cache[pkgname].mark_delete(purge)
if is_autoremove_valid(cache, "", auto_removable):
# do it in one step
if not dry_run:
Expand Down

0 comments on commit 791fd71

Please sign in to comment.