Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Update errors are now not fatal.
Vsevolod Stakhov committed 11 years ago
commit d806bea284f5dbbe58f3eee5f784f5e0cda60576
parent 46654bb
8 files changed +17 -15
modified src/fetch.c
@@ -168,7 +168,7 @@ exec_fetch(int argc, char **argv)

	/* first update the remote repositories if needed */
	if (auto_update &&
-
	    (retcode = pkgcli_update(false, reponame)) != EPKG_OK)
+
	    (retcode = pkgcli_update(false, false, reponame)) != EPKG_OK)
		return (retcode);

	if (pkgdb_open_all(&db, PKGDB_REMOTE, reponame) != EPKG_OK)
modified src/install.c
@@ -193,7 +193,7 @@ exec_install(int argc, char **argv)

	/* first update the remote repositories if needed */
	if (auto_update &&
-
	    (updcode = pkgcli_update(false, reponame)) != EPKG_OK)
+
	    (updcode = pkgcli_update(false, false, reponame)) != EPKG_OK)
		return (updcode);

	if (pkgdb_open_all(&db,
modified src/pkgcli.h
@@ -128,7 +128,7 @@ void usage_stats(void);
/* pkg update */
int exec_update(int, char **);
void usage_update(void);
-
int pkgcli_update(bool, const char *);
+
int pkgcli_update(bool, bool, const char *);

/* pkg updating */
int exec_updating(int, char **);
modified src/rquery.c
@@ -217,7 +217,7 @@ exec_rquery(int argc, char **argv)
	/* first update the remote repositories if needed */
	old_quiet = quiet;
	quiet = true;
-
	if (auto_update && (ret = pkgcli_update(false, reponame)) != EPKG_OK)
+
	if (auto_update && (ret = pkgcli_update(false, false, reponame)) != EPKG_OK)
		return (ret);
	quiet = old_quiet;

modified src/search.c
@@ -420,7 +420,7 @@ exec_search(int argc, char **argv)
	/* first update the remote repositories if needed */
	old_quiet = quiet;
	quiet = true;
-
	if (auto_update && (ret = pkgcli_update(false, reponame)) != EPKG_OK)
+
	if (auto_update && (ret = pkgcli_update(false, false, reponame)) != EPKG_OK)
		return (ret);
	quiet = old_quiet;

modified src/update.c
@@ -46,7 +46,7 @@
 * Fetch repository calalogues.
 */
int
-
pkgcli_update(bool force, const char *reponame)
+
pkgcli_update(bool force, bool strict, const char *reponame)
{
	int retcode = EPKG_FATAL, update_count = 0, total_count = 0;
	struct pkg_repo *r = NULL;
@@ -82,19 +82,19 @@ pkgcli_update(bool force, const char *reponame)
		if (retcode == EPKG_UPTODATE) {
			if (!quiet)
				printf("%s repository is up-to-date\n", pkg_repo_name(r));
-
			total_count ++;
-
		}
-
		else if (retcode == EPKG_OK) {
-
			total_count ++;
		}
+
		else if (retcode != EPKG_OK && strict)
+
			retcode = EPKG_FATAL;

+
		total_count ++;
		if (retcode != EPKG_OK)
			continue;

		update_count ++;
	}

-
	retcode = EPKG_OK;
+
	if (!strict || retcode == EPKG_UPTODATE)
+
		retcode = EPKG_OK;

	if (total_count == 0) {
		if (!quiet)
@@ -103,7 +103,8 @@ pkgcli_update(bool force, const char *reponame)
	}
	else if (update_count == 0) {
		if (!quiet)
-
			printf("All repositories are up-to-date\n");
+
			if (retcode == EPKG_OK)
+
				printf("All repositories are up-to-date\n");
	}

	return (retcode);
@@ -164,7 +165,8 @@ exec_update(int argc, char **argv)
	} else if (ret != EPKG_OK)
		return (EX_IOERR);

-
	ret = pkgcli_update(force, reponame);
+
	/* For pkg-update update op is strict */
+
	ret = pkgcli_update(force, true, reponame);

	return ((ret == EPKG_OK) ? EX_OK : EX_SOFTWARE);
}
modified src/upgrade.c
@@ -150,7 +150,7 @@ exec_upgrade(int argc, char **argv)
	
	/* first update the remote repositories if needed */
	if (auto_update &&
-
	    (updcode = pkgcli_update(false, reponame)) != EPKG_OK)
+
	    (updcode = pkgcli_update(false, false, reponame)) != EPKG_OK)
		return (updcode);

	if (pkgdb_open_all(&db, PKGDB_REMOTE, reponame) != EPKG_OK)
modified src/version.c
@@ -493,7 +493,7 @@ do_source_remote(unsigned int opt, char limchar, char *pattern, match_t match,
	   user is forced to have a repo.sqlite */

	if (auto_update) {
-
		retcode = pkgcli_update(false, reponame);
+
		retcode = pkgcli_update(false, false, reponame);
		if (retcode != EPKG_OK)
			return (retcode);
	}