Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Report when a package is not found in the repositories
Marin Atanasov Nikolov committed 14 years ago
commit 8c046fd978caaef7f8181faf4f89b1ff15123de4
parent 1d12017
2 files changed +6 -11
modified libpkg/pkgdb.c
@@ -2049,7 +2049,7 @@ report_already_installed(sqlite3 *s)

	while (sqlite3_step(stmt) != SQLITE_DONE) {
		origin = sqlite3_column_text(stmt, 0);
-
		printf("%s is already installed and at the latest version\n", origin);
+
		pkg_emit_error("%s is already installed and at the latest version", origin);
	}

	sqlite3_finalize(stmt);
@@ -2288,6 +2288,10 @@ pkgdb_query_installs(struct pkgdb *db, match_t match, int nbpkgs, char **pkgs, c
		}
		sqlite3_bind_text(stmt, 1, pkgs[i], -1, SQLITE_STATIC);
		while (sqlite3_step(stmt) != SQLITE_DONE);
+

+
		/* report if package was not found in the database */
+
		if (sqlite3_changes(db->sqlite) == 0)
+
			pkg_emit_error("Package '%s' was not found in the repositories", pkgs[i]);
	}

	sqlite3_finalize(stmt);
modified pkg/install.c
@@ -123,17 +123,8 @@ exec_install(int argc, char **argv)
	}
	pkgdb_it_free(it);

-
	if (pkg_jobs_is_empty(jobs)) {
-
		if (argc == 0) {
-
			if (!quiet)
-
				printf("Nothing to do\n");
-
			retcode = EXIT_SUCCESS;
-
		} else {
-
			fprintf(stderr, "Package(s) not found in the repositories\n");
-
			retcode = EXIT_FAILURE;
-
		}
+
	if (pkg_jobs_is_empty(jobs))
		goto cleanup;
-
	}

	/* print a summary before applying the jobs */
	pkg = NULL;