diff options
-rw-r--r-- | apt-private/private-cmndline.cc | 4 | ||||
-rw-r--r-- | apt-private/private-install.cc | 6 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 1 | ||||
-rw-r--r-- | cmdline/apt.cc | 1 | ||||
-rwxr-xr-x | debian/apt.systemd.daily | 2 | ||||
-rwxr-xr-x | test/integration/test-apt-get-autoremove | 15 | ||||
-rwxr-xr-x | test/integration/test-pdiff-usage | 8 |
7 files changed, 33 insertions, 4 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 5ad3b65d3..101e0ae40 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -176,7 +176,7 @@ static bool addArgumentsAPTHelper(std::vector<CommandLine::Args> &Args, char con static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade", - "dselect-upgrade", "autoremove", "full-upgrade")) + "dselect-upgrade", "autoremove", "autopurge", "full-upgrade")) { addArg(0, "show-progress", "DpkgPM::Progress", 0); addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0); @@ -240,7 +240,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const addArg(0, "color", "APT::Moo::Color", 0); if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade", - "dselect-upgrade", "autoremove", "auto-remove", "clean", "autoclean", "auto-clean", "check", + "dselect-upgrade", "autoremove", "auto-remove", "autopurge", "clean", "autoclean", "auto-clean", "check", "build-dep", "full-upgrade", "source")) { addArg('s', "simulate", "APT::Get::Simulate", 0); diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 4e888a9bd..1713ff308 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -599,6 +599,12 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg _config->Set("APT::Get::AutomaticRemove", "true"); fallback = MOD_REMOVE; } + else if (strcasecmp(CmdL.FileList[0], "autopurge") == 0) + { + _config->Set("APT::Get::AutomaticRemove", "true"); + _config->Set("APT::Get::Purge", true); + fallback = MOD_REMOVE; + } std::list<APT::VersionSet::Modifier> mods; mods.push_back(APT::VersionSet::Modifier(MOD_INSTALL, "+", diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 39855e05a..6d25ed509 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -409,6 +409,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/ {"purge", &DoInstall, _("Remove packages and config files")}, {"autoremove", &DoInstall, _("Remove automatically all unused packages")}, {"auto-remove", &DoInstall, nullptr}, + {"autopurge",&DoInstall, nullptr}, {"markauto", &DoMarkAuto, nullptr}, {"unmarkauto", &DoMarkAuto, nullptr}, {"dist-upgrade", &DoDistUpgrade, _("Distribution upgrade, see apt-get(8)")}, diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 6bf85467e..776b100bf 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -66,6 +66,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/ {"remove", &DoInstall, _("remove packages")}, {"autoremove", &DoInstall, _("Remove automatically all unused packages")}, {"auto-remove", &DoInstall, nullptr}, + {"autopurge",&DoInstall, nullptr}, {"purge", &DoInstall, nullptr}, // system wide stuff diff --git a/debian/apt.systemd.daily b/debian/apt.systemd.daily index b532bd151..c6fbca03f 100755 --- a/debian/apt.systemd.daily +++ b/debian/apt.systemd.daily @@ -470,7 +470,7 @@ if [ "$1" = "update" ] || [ -z "$1" ] ; then debug_echo "download upgradable (not run)" fi - if which unattended-upgrade >/dev/null 2>&1 && unattended-upgrade --help | grep -q download-only && check_stamp $DOWNLOAD_UPGRADEABLE_STAMP $UnattendedUpgradeInterval; then + if which unattended-upgrade >/dev/null 2>&1 && env LC_ALL=C.UTF-8 unattended-upgrade --help | grep -q download-only && check_stamp $DOWNLOAD_UPGRADEABLE_STAMP $UnattendedUpgradeInterval; then if unattended-upgrade --download-only $XUUPOPT; then update_stamp $DOWNLOAD_UPGRADEABLE_STAMP debug_echo "unattended-upgrade -d (success)" diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index 4dba4f164..5546958a0 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -219,5 +219,20 @@ Remv foo-multi2-2 [1] Remv foo-plus-1 [1] Remv foo-plus-2 [1]' apt autoremove -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + foo-multi1-1* foo-multi1-2* foo-multi2-1* foo-multi2-2* foo-plus-1* + foo-plus-2* +0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded. +Purg foo-multi1-1 [1] +Purg foo-multi1-2 [1] +Purg foo-multi2-1 [1] +Purg foo-multi2-2 [1] +Purg foo-plus-1 [1] +Purg foo-plus-2 [1]' apt autopurge -s + testdpkgstatus 'pi' '1' 'unrelated' testsuccess apt purge unrelated -y diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 7cda2ee45..c5726dd08 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -251,7 +251,13 @@ SHA256-Download: cp Packages-future aptarchive/Packages rm -f rootdir/var/lib/apt/lists/*_Contents-* webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/hacked-i386.gz' - testfailure apt update "$@" + # This should work in at least 4% of the cases... + for i in $(seq 25); do + testfailure apt update "$@" + if ! grep 'rred:600' rootdir/tmp/testfailure.output; then + break + fi + done webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/Contents-i386.gz' cp rootdir/tmp/testfailure.output patchdownload.output testfailure grep 'rred:600' patchdownload.output |