The following commit has been merged in the master branch:
commit 535325ba3d607cfe816ce7cf8d91d185ab87ca9b
Author: Guillem Jover <[email protected]>
Date:   Tue Apr 23 15:04:02 2013 +0200

    dpkg: Clarify that --set-selections needs an up-to-date available db
    
    Document this in the man page, and warn whenever we find unknown
    packages during the --set-selections processing.
    
    Closes: #703092

diff --git a/debian/changelog b/debian/changelog
index add0b68..5e00810 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 dpkg (1.17.0) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
   * Switch update-alternatives back to a fatal error on out of range priority
     on --install.
   * Document dpkg-deb --debug in --help output.
@@ -94,6 +95,9 @@ dpkg (1.17.0) UNRELEASED; urgency=low
     not yet supported). Thanks to Matthias Klose <[email protected]>.
     Closes: #711936
   * Add GCJFLAGS support to dpkg-buildflags. Closes: #708375
+  * Clarify that dpkg --set-selections needs an up-to-date available db,
+    by documenting it on the dpkg(1) man page, and warning whenever dpkg
+    finds unknown packages while setting the selections. Closes: #703092
 
   [ Updated programs translations ]
   * Fix typo in Spanish translation of update-alternatives.
diff --git a/man/dpkg.1 b/man/dpkg.1
index c1bdd32..aeaac24 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -246,6 +246,11 @@ Set package selections using file read from stdin. This 
file should be
 in the format '\fIpackage\fP \fIstate\fP', where state is one of
 \fBinstall\fP, \fBhold\fP, \fBdeinstall\fP or \fBpurge\fP. Blank lines
 and comment lines beginning with '#' are also permitted.
+
+The available database needs to be up-to-date for this command to be
+useful, otherwise unknown packages will be ignored with a warning. See
+the \fB\-\-update\-avail\fP and \fB\-\-merge\-avail\fP commands for more
+information.
 .TP
 .B \-\-clear\-selections
 Set the requested state of every non-essential package to deinstall.
diff --git a/src/select.c b/src/select.c
index c16f50b..fc27bea 100644
--- a/src/select.c
+++ b/src/select.c
@@ -112,6 +112,7 @@ setselections(const char *const *argv)
   int c, lno;
   struct varbuf namevb = VARBUF_INIT;
   struct varbuf selvb = VARBUF_INIT;
+  bool db_possibly_outdated = false;
 
   if (*argv)
     badusage(_("--%s takes no arguments"), cipaction->olong);
@@ -163,6 +164,7 @@ setselections(const char *const *argv)
 
     if (!pkg_is_informative(pkg, &pkg->installed) &&
         !pkg_is_informative(pkg, &pkg->available)) {
+      db_possibly_outdated = true;
       warning(_("package not in database at line %d: %.250s"), lno, 
namevb.buf);
       continue;
     }
@@ -180,6 +182,10 @@ setselections(const char *const *argv)
   varbuf_destroy(&namevb);
   varbuf_destroy(&selvb);
 
+  if (db_possibly_outdated)
+    warning(_("found unknown packages; this might mean the available 
database\n"
+              "is outdated, and needs to be updated through a frontend 
method"));
+
   return 0;
 }
 

-- 
dpkg's main repository


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

Reply via email to