[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#461658: apt: add an autopurge option



Package: apt
Version: 0.7.10
Severity: wishlist
Tags: patch

i find myself doing "apt-get autoremove --purge" rather often, and would
prefer to not type so much -- something like "apt-get autopurge" would
be much more preferable.  i have taken it upon myself to implement this
"autopurge" feature.  see the attached patch.

-- Package-specific info:

-- (no /etc/apt/preferences present) --


-- (/etc/apt/sources.list present, but not submitted) --


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.23-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt depends on:
ii  debian-archive-keyring  2007.07.31       GnuPG archive keys of the Debian a
ii  libc6                   2.7-6            GNU C Library: Shared libraries
ii  libgcc1                 1:4.3-20080116-1 GCC support library
ii  libstdc++6              4.3-20080116-1   The GNU Standard C++ Library v3

apt recommends no packages.

-- no debconf information
--- apt-0.7.10/cmdline/apt-get.cc	2008-01-07 15:24:26.000000000 -0500
+++ apt-0.7.10-autopurge/cmdline/apt-get.cc	2008-01-19 23:44:56.000000000 -0500
@@ -1433,7 +1433,7 @@
    if (!hideAutoRemove) 
       ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions);
    if (!doAutoRemove && !hideAutoRemove && autoremovelist.size() > 0)
-      c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
+      c1out << _("Use 'apt-get autoremove' or 'apt-get autopurge' to remove them.") << std::endl;
 
    // Now see if we destroyed anything
    if (Cache->BrokenCount() != 0)
@@ -1550,6 +1550,12 @@
       _config->Set("APT::Get::AutomaticRemove", "true");
       DefRemove = true;
    }
+   else if (strcasecmp(CmdL.FileList[0], "autopurge") == 0)
+   {
+      _config->Set("APT::Get::AutomaticRemove", "true");
+      _config->Set("APT::Get::Purge", "true");
+      DefRemove = true;
+   }
    // new scope for the ActionGroup
    {
       pkgDepCache::ActionGroup group(Cache);
@@ -2618,8 +2624,9 @@
       "   upgrade - Perform an upgrade\n"
       "   install - Install new packages (pkg is libc6 not libc6.deb)\n"
       "   remove - Remove packages\n"
-      "   autoremove - Remove all automatic unused packages\n"
+      "   autoremove - Automatically remove all unused packages\n"
       "   purge - Remove and purge packages\n"
+      "   autopurge - Automatically remove and purge all unused packages\n"
       "   source - Download source archives\n"
       "   build-dep - Configure build-dependencies for source packages\n"
       "   dist-upgrade - Distribution upgrade, see apt-get(8)\n"
@@ -2732,6 +2739,7 @@
                                    {"purge",&DoInstall},
 				   {"autoremove",&DoInstall},
 				   {"purge",&DoInstall},
+				   {"autopurge",&DoInstall},
                                    {"dist-upgrade",&DoDistUpgrade},
                                    {"dselect-upgrade",&DoDSelectUpgrade},
 				   {"build-dep",&DoBuildDep},
--- apt-0.7.10/doc/apt-get.8.xml	2007-11-12 14:48:22.000000000 -0500
+++ apt-0.7.10-autopurge/doc/apt-get.8.xml	2008-01-19 23:50:34.000000000 -0500
@@ -49,6 +49,7 @@
          <arg>clean</arg>
          <arg>autoclean</arg>
          <arg>autoremove</arg>
+         <arg>autopurge</arg>
       </group>   
    </cmdsynopsis>
  </refsynopsisdiv>
@@ -215,6 +216,12 @@
      <listitem><para><literal>autoremove</literal> is used to remove packages that were automatically
      installed to satisfy dependencies for some package and that are no more needed.</para></listitem>
      </varlistentry>
+
+     <varlistentry><term>autopurge</term>
+     <listitem><para><literal>autopurge</literal> is used to remove and purge packages that were automatically
+     installed to satisfy dependencies for some package and that are no more needed.</para></listitem>
+     </varlistentry>
+
    </variablelist>
  </refsect1>
  

Reply to: