summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-private/private-cmndline.cc4
-rw-r--r--apt-private/private-install.cc6
-rw-r--r--cmdline/apt-get.cc1
-rw-r--r--cmdline/apt.cc1
-rwxr-xr-xtest/integration/test-apt-get-autoremove15
5 files changed, 25 insertions, 2 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/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