Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge pull request #420 from smortex/consistent-error-reporting
Matthew Seaman committed 13 years ago
commit 80bc46ab51d830e198a070509199f3327a194071
parent 72008a9
2 files changed +10 -2
modified libpkg/pkgdb.c
@@ -2919,6 +2919,7 @@ pkgdb_query_installs(struct pkgdb *db, match_t match, int nbpkgs, char **pkgs,
	struct sbuf	*sql = NULL;
	const char	*how = NULL;
	const char	*reponame = NULL;
+
	bool             pkg_not_found = false;

	if ((it = pkgdb_query_newpkgversion(db, repo)) != NULL) {
		pkg_emit_newpkgversion();
@@ -3019,13 +3020,20 @@ pkgdb_query_installs(struct pkgdb *db, match_t match, int nbpkgs, char **pkgs,
		while (sqlite3_step(stmt) != SQLITE_DONE);

		/* report if package was not found in the database */
-
		if (sqlite3_changes(db->sqlite) == 0)
+
		if (sqlite3_changes(db->sqlite) == 0) {
			pkg_emit_package_not_found(pkgs[i]);
+
			pkg_not_found = true;
+
		}
	}

	sqlite3_finalize(stmt);
	sbuf_clear(sql);

+
	if (pkg_not_found) {
+
		sbuf_delete(sql);
+
		return (NULL);
+
	}
+

	/*
	 * Report and remove packages already installed and at the latest
	 * version and without option change
modified pkg/event.c
@@ -201,7 +201,7 @@ event_callback(void *data, struct pkg_event *ev)
		break;
	case PKG_EVENT_NOT_FOUND:
		printf("Package '%s' was not found in "
-
		    "the repositories", ev->e_not_found.pkg_name);
+
		    "the repositories\n", ev->e_not_found.pkg_name);
		break;
	case PKG_EVENT_MISSING_DEP:
		fprintf(stderr, "missing dependency %s-%s",