Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Honor APT::Get::Purge setting when removing packages #348

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=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=purge)
if is_autoremove_valid(cache, "", auto_removable):
# do it in one step
if not dry_run:
Expand Down