Просмотр исходного кода

dpkg: On --verify error out on not-installed packages

This makes the behaviour of this command consistent with other commands
taking package names as arguments.
Guillem Jover лет назад: 12
Родитель
Сommit
15e690628d
2 измененных файлов с 10 добавлено и 1 удалено
  1. 1 0
      debian/changelog
  2. 9 1
      src/verify.c

+ 1 - 0
debian/changelog

@@ -82,6 +82,7 @@ dpkg (1.17.7) UNRELEASED; urgency=low
   * Add support for Packages-files in dpkg --update-avail and --merge-avail
     from pipes, or standard input if the argument is omitted or is ‘-’.
     Closes: #357093, #367297
+  * Error out on not-installed packages passed to «dpkg --verify».
 
   [ Updated dpkg translations ]
   * German (Sven Joachim).

+ 9 - 1
src/verify.c

@@ -134,6 +134,7 @@ int
 verify(const char *const *argv)
 {
 	struct pkginfo *pkg;
+	int rc = 0;
 
 	modstatdb_open(msdbrw_readonly);
 	ensure_diversions();
@@ -156,6 +157,13 @@ verify(const char *const *argv)
 				badusage(_("--%s needs a valid package name but '%.250s' is not: %s"),
 				         cipaction->olong, thisarg, err.str);
 
+			if (pkg->status == stat_notinstalled) {
+				notice(_("package '%s' is not installed"),
+				       pkg_name(pkg, pnaw_nonambig));
+				rc = 1;
+				continue;
+			}
+
 			verify_package(pkg);
 		}
 	}
@@ -164,5 +172,5 @@ verify(const char *const *argv)
 
 	m_output(stdout, _("<standard output>"));
 
-	return 0;
+	return rc;
 }