Kaynağa Gözat

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
Guillem Jover 17 yıl önce
ebeveyn
işleme
224f0285ab
6 değiştirilmiş dosya ile 29 ekleme ve 32 silme
  1. 9 0
      README.feature-removal-schedule
  2. 3 0
      debian/changelog
  3. 0 2
      dselect/methods/disk/update
  4. 13 0
      lib/parse.c
  5. 2 1
      man/dpkg.1
  6. 2 29
      src/update.c

+ 9 - 0
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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

+ 3 - 0
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

+ 0 - 2
dselect/methods/disk/update

@@ -83,8 +83,6 @@ do
 	esac	
 done
 
-dpkg --forget-old-unavail
-
 echo -n 'Update OK.  Hit RETURN.  '
 read response
 

+ 13 - 0
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);

+ 2 - 1
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.

+ 2 - 29
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);
 }