The following commit has been merged in the master branch:
commit 224f0285abc304bec059e6144778177c2eed06ee
Author: Guillem Jover <[email protected]>
Date:   Sun Jul 12 20:11:53 2009 +0200

    Obsolete --forget-old-unavail
    
    On parse mark not-installed leftover packages for automatic removal from
    the database on next dump. The states we consider for removal are
    want_purge, want_deinstall and want_hold. The latter being the ancient
    default for not-installed packages.
    
    This makes the --forget-old-unavail option not useful anymore, so switch
    it to be a no-op, and target it for future removal as obsolescent.
    
    Closes: #33394, #429262

diff --git a/README.feature-removal-schedule b/README.feature-removal-schedule
index 54ec7a7..33e68ab 100644
--- a/README.feature-removal-schedule
+++ b/README.feature-removal-schedule
@@ -54,6 +54,15 @@ Why:
  Obsoleted long time ago (2005-01-22). Remaining packages should switch to
  use 'dpkg --print-architecture'.
 
+What --forget-old-unavail (dpkg option)
+Status: obsolete
+When: 1.16.x
+Warning: program
+Why:
+ Purged packages are properly cleaned up now by dpkg, and old unavailable
+ leftovers are automatically cleaned up on database parsing. So there's no
+ need anymore for this manual action.
+
 History of feature removals
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/debian/changelog b/debian/changelog
index 350b8b1..438e75c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,9 @@ dpkg (1.15.4) UNRELEASED; urgency=low
   * Properly mark packages being purged for disappearance from the database.
     This will make the status database not be left behind with traces of old
     not-installed packages.
+  * On parse mark not-installed leftover packages for automatic removal from
+    the database on next dump. This obsoletes the --forget-old-unavail option,
+    thus making it now a no-op. Closes: #33394, #429262
 
   [ Raphael Hertzog ]
   * Replace install-info by a wrapper around GNU's install-info. The wrapper
diff --git a/dselect/methods/disk/update b/dselect/methods/disk/update
index 9d91723..0c7d247 100755
--- a/dselect/methods/disk/update
+++ b/dselect/methods/disk/update
@@ -83,8 +83,6 @@ do
        esac    
 done
 
-dpkg --forget-old-unavail
-
 echo -n 'Update OK.  Hit RETURN.  '
 read response
 
diff --git a/lib/parse.c b/lib/parse.c
index a61c8c7..8c60205 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -313,6 +313,19 @@ int parsedb(const char *filename, enum parsedbflags flags,
       newpifp->conffiles= NULL;
     }
 
+    /* XXX: Mark not-installed leftover packages for automatic removal on
+     * next database dump. This code can be removed after dpkg 1.16.x, when
+     * there's guarantee that no leftover is found on the status file on
+     * major distributions. */
+    if (!(flags & pdb_recordavailable) &&
+        newpig.status == stat_notinstalled &&
+        newpig.eflag == eflagv_ok &&
+        (newpig.want == want_purge ||
+         newpig.want == want_deinstall ||
+         newpig.want == want_hold)) {
+      newpig.want = want_unknown;
+    }
+
     pigp= findpackage(newpig.name);
     pifp= (flags & pdb_recordavailable) ? &pigp->available : &pigp->installed;
     if (!pifp->valid) blankpackageperfile(pifp);
diff --git a/man/dpkg.1 b/man/dpkg.1
index 271f2de..4d32777 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -203,7 +203,8 @@ available with information from the package 
\fIpackage_file\fP. If
 must refer to a directory instead.
 .TP
 .B \-\-forget\-old\-unavail
-Forget about uninstalled unavailable packages.
+Now \fBobsolete\fP and a no-op as \fBdpkg\fP will automatically forget
+uninstalled unavailable packages.
 .TP
 .B \-\-clear\-avail
 Erase the existing information about what packages are available.
diff --git a/src/update.c b/src/update.c
index 48eeebc..d7737b5 100644
--- a/src/update.c
+++ b/src/update.c
@@ -98,35 +98,8 @@ void updateavailable(const char *const *argv) {
 }
 
 void forgetold(const char *const *argv) {
-  struct pkgiterator *it;
-  struct pkginfo *pkg;
-  enum pkgwant oldwant;
-
   if (*argv) badusage(_("--forget-old-unavail takes no arguments"));
 
-  modstatdb_init(admindir, f_noact ? msdbrw_readonly : msdbrw_write);
-
-  it= iterpkgstart();
-  while ((pkg= iterpkgnext(it))) {
-    debug(dbg_eachfile,"forgetold checking %s",pkg->name);
-    if (informative(pkg,&pkg->available)) {
-      debug(dbg_eachfile,"forgetold ... informative available");
-      continue;
-    }
-    if (pkg->want != want_purge && pkg->want != want_deinstall) {
-      debug(dbg_eachfile,"forgetold ... informative want");
-      continue;
-    }
-    oldwant= pkg->want;
-    pkg->want= want_unknown;
-    if (informative(pkg,&pkg->installed)) {
-      debug(dbg_eachfile,"forgetold ... informative installed");
-      pkg->want= oldwant;
-      continue;
-    }
-    debug(dbg_general,"forgetold forgetting %s",pkg->name);
-  }
-  iterpkgend(it);
-  
-  modstatdb_shutdown();
+  warning(_("obsolete '--%s' option, unavailable packages are automatically 
cleaned up."),
+          cipaction->olong);
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to