Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix a misleading statement when updating.
Brad Davis committed 9 years ago
commit a75d4eb0247260eb9ba449703ba3f5551d3cf024
parent 8b3e439
4 files changed +52 -15
modified src/update.c
@@ -73,34 +73,46 @@ pkgcli_update(bool force, bool strict, const char *reponame)
		if (!quiet)
			printf("Updating %s repository catalogue...\n",
			    pkg_repo_name(r));
+

		retcode = pkg_update(r, force);
+

		if (retcode == EPKG_UPTODATE) {
-
			if (!quiet)
-
				printf("%s repository is up-to-date.\n",
+
			update_count++;
+
			retcode = EPKG_OK;
+
			if (!quiet) {
+
				printf("%s repository is up to date.\n",
				    pkg_repo_name(r));
+
			}
		}
		else if (retcode != EPKG_OK && strict)
			retcode = EPKG_FATAL;

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

-
		update_count ++;
	}

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

	if (total_count == 0) {
-
		if (!quiet)
-
			printf("No repositories are enabled.\n");
		retcode = EPKG_FATAL;
+
		if (!quiet) {
+
			printf("No repositories are enabled.\n");
+
		}
	}
-
	else if (update_count == 0) {
-
		if (!quiet)
-
			if (retcode == EPKG_OK)
-
				printf("All repositories are up-to-date.\n");
+
	else if (update_count == total_count) {
+
		if (!quiet) {
+
			printf("All repositories are up to date.\n");
+
		}
+
	}
+
	else if (total_count == 1) {
+
		if (!quiet) {
+
			printf("Error updating repositories!\n");
+
		}
+
	}
+
	else {
+
		if (!quiet) {
+
			printf("Error updating repositories!\n");
+
		}
+
		if (strict) {
+
			retcode = EPKG_FATAL;
+
		}
	}

	return (retcode);
modified tests/Makefile.am
@@ -104,6 +104,7 @@ tests_scripts= \
		frontend/set.sh \
		frontend/version.sh \
		frontend/vital.sh \
+
		frontend/update.sh \
		frontend/test_environment.sh \
		frontend/issue1374.sh \
		frontend/issue1425.sh \
modified tests/frontend/Kyuafile.in
@@ -32,6 +32,7 @@ atf_test_program{name='rootdir'}
atf_test_program{name='rubypuppet'}
atf_test_program{name='search'}
atf_test_program{name='set'}
+
atf_test_program{name='update'}
atf_test_program{name='version'}
atf_test_program{name='vital'}
atf_test_program{name='issue1374'}
added tests/frontend/update.sh
@@ -0,0 +1,23 @@
+
#! /usr/bin/env atf-sh
+

+
. $(atf_get_srcdir)/test_environment.sh
+

+
tests_init \
+
	update_error
+

+
update_error_body() {
+

+
	mkdir repos
+
	mkdir empty
+
	cat > repos/test.conf << EOF
+
test: {
+
  url: "file://empty/",
+
}
+
EOF
+

+
	atf_check \
+
		-o match:"Unable to update repository test" \
+
		-e match:"pkg: file://empty//packagesite.txz: No such file or directory" \
+
		-s exit:70 \
+
		pkg -R repos update
+
}