Browse Source

Provide a "autopurge" shortcut

This adds a new "autopurge" command that will is a shortcut for
"autoremove --purge"

Thanks: Michael Vogt for the initial work
tags/debian/1.8.0_alpha3
Julian Andres Klode 2 years ago
parent
commit
1453544655
5 changed files with 25 additions and 2 deletions
  1. +2
    -2
      apt-private/private-cmndline.cc
  2. +6
    -0
      apt-private/private-install.cc
  3. +1
    -0
      cmdline/apt-get.cc
  4. +1
    -0
      cmdline/apt.cc
  5. +15
    -0
      test/integration/test-apt-get-autoremove

+ 2
- 2
apt-private/private-cmndline.cc View File

@@ -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);


+ 6
- 0
apt-private/private-install.cc View File

@@ -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, "+",


+ 1
- 0
cmdline/apt-get.cc View File

@@ -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)")},


+ 1
- 0
cmdline/apt.cc View File

@@ -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


+ 15
- 0
test/integration/test-apt-get-autoremove View File

@@ -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

Loading…
Cancel
Save