Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge remote-tracking branch 'upstream/master'
Shawn Webb committed 2 years ago
commit 2b5cea297c72654d0847d4b8f1e0a3df3727d7ba
parent 0caa230
4 files changed +15 -9
modified .gitignore
@@ -56,6 +56,8 @@ scripts/sbin/pkg2ng
/external/linenoise/Makefile
/external/libcurl/Makefile
/external/libucl/Makefile
+
/external/libucl/aclocal.m4
+
/external/libucl/autom4te.cache
/external/yxml/Makefile
/external/liblua/Makefile
/external/libmachista/Makefile
modified README.md
@@ -29,7 +29,7 @@ Table of Contents:
SourceHut CI:
[![builds.sr.ht status](https://builds.sr.ht/~bapt/pkg/commits/master/freebsd.svg)](https://builds.sr.ht/~bapt/pkg/commits/master/freebsd?)
[![builds.sr.ht status](https://builds.sr.ht/~bapt/pkg/commits/master/alpine.svg)](https://builds.sr.ht/~bapt/pkg/commits/master/alpine?)
-
[![builds.sr.ht status](https://builds.sr.ht/~bapt/pkg/commits/master/alpine.svg)](https://builds.sr.ht/~bapt/pkg/commits/master/debian?)
+
[![builds.sr.ht status](https://builds.sr.ht/~bapt/pkg/commits/master/debian.svg)](https://builds.sr.ht/~bapt/pkg/commits/master/debian?)

<a name="libpkg"></a>
### libpkg
modified src/lock.c
@@ -61,7 +61,7 @@ do_lock(struct pkgdb *db, struct pkg *pkg)
		if (!quiet)
			pkg_printf("%n-%v: already locked\n",
			       pkg, pkg);
-
		return (EPKG_OK);
+
		return (EPKG_FATAL);
	}

	if (!query_yesno(false, "%n-%v: lock this package? ",
@@ -81,7 +81,7 @@ do_unlock(struct pkgdb *db, struct pkg *pkg)
	if (!pkg_is_locked(pkg)) {
		if (!quiet)
			pkg_printf("%n-%v: already unlocked\n", pkg, pkg);
-
		return (EPKG_OK);
+
		return (EPKG_FATAL);
	}

	if (!query_yesno(false, "%n-%v: unlock this package? ",
@@ -102,6 +102,7 @@ do_lock_unlock(struct pkgdb *db, int match, const char *pkgname,
	struct pkg	*pkg = NULL;
	int		 retcode;
	int		 exitcode = EXIT_SUCCESS;
+
	bool		 gotone = false;
	tll(struct pkg *)pkgs = tll_init();

	if (pkgdb_obtain_lock(db, PKGDB_LOCK_EXCLUSIVE) != EPKG_OK) {
@@ -117,6 +118,7 @@ do_lock_unlock(struct pkgdb *db, int match, const char *pkgname,
	}

	while (pkgdb_it_next(it, &pkg, 0) == EPKG_OK) {
+
		gotone = true;
		tll_push_back(pkgs, pkg);
		pkg = NULL;
	}
@@ -132,6 +134,10 @@ do_lock_unlock(struct pkgdb *db, int match, const char *pkgname,
		}
	}

+
	/* No package was found matching that name. */
+
        if (gotone == false)
+
	        exitcode = EXIT_FAILURE;
+

cleanup:
	tll_free_and_free(pkgs, pkg_free);
	pkgdb_it_free(it);
@@ -287,9 +293,7 @@ exec_lock_unlock(int argc, char **argv, enum action action)
			exitcode = do_lock_unlock(db, match, NULL, action);
		} else {
			for (i = 0; i < argc; i++) {
-
				retcode = do_lock_unlock(db, match, argv[i], action);
-
				if (retcode != EXIT_SUCCESS)
-
					exitcode = retcode;
+
				exitcode = do_lock_unlock(db, match, argv[i], action);
			}
		}
	}
@@ -299,5 +303,5 @@ exec_lock_unlock(int argc, char **argv, enum action action)

	pkgdb_close(db);

-
	return (exitcode == EPKG_OK ? EXIT_SUCCESS : EXIT_FAILURE);
+
	return (exitcode);
}
modified tests/frontend/lock.sh
@@ -42,7 +42,7 @@ lock_body() {
	atf_check \
	    -o inline:"sqlite3-3.8.6: already locked\n" \
	    -e empty \
-
	    -s exit:0 \
+
	    -s exit:1 \
	    pkg lock -y sqlite3

	atf_check \
@@ -60,7 +60,7 @@ lock_body() {
	atf_check \
	    -o inline:"sqlite3-3.8.6: already unlocked\n" \
	    -e empty \
-
	    -s exit:0 \
+
	    -s exit:1 \
	    pkg unlock -y sqlite3

	atf_check \