Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
universe: fix package selection
Baptiste Daroussin committed 11 months ago
commit ff2168a24f1cb8ef1d3a1766ebe11a9562873325
parent 021456d
3 files changed +5 -4
modified libpkg/pkg_add.c
@@ -1081,8 +1081,8 @@ pkg_extract_finalize(struct pkg *pkg, tempdirs_t *tempdirs)
	return (EPKG_OK);
}

-
static bool
-
should_append_pkg(pkgs_t *localpkgs, struct pkg *p)
+
bool
+
append_pkg_if_newer(pkgs_t *localpkgs, struct pkg *p)
{
	/* only keep the highest version is we fine one */
	struct pkg **lp = pkgs_insert_sorted(localpkgs, p);
@@ -1176,7 +1176,7 @@ scan_local_pkgs(struct pkg_add_db *db, bool fromstdin, struct localhashes *l, co
						struct pkg *p = NULL;
						if (pkg_open(&p, g.gl_pathv[i],
									PKG_OPEN_MANIFEST_COMPACT) == EPKG_OK) {
-
							if (should_append_pkg(&db->localpkgs, p)) {
+
							if (append_pkg_if_newer(&db->localpkgs, p)) {
								p->repopath = xstrdup(g.gl_pathv[i]);
							}
						}
modified libpkg/pkg_jobs_universe.c
@@ -136,7 +136,7 @@ pkg_jobs_universe_get_remote(struct pkg_jobs_universe *universe,
	while (pkgdb_it_next(it, &pkg, flag) == EPKG_OK) {
		if (result == NULL)
			result = xcalloc(1, sizeof(pkgs_t));
-
		vec_push(result, pkg);
+
		append_pkg_if_newer(result, pkg);
		pkg = NULL;
	}

modified libpkg/private/pkg.h
@@ -244,6 +244,7 @@ typedef vec_t(struct pkg *) pkgs_t;
DEFINE_VEC_INSERT_SORTED_PROTO(pkgs_t, pkgs, struct pkg *);
struct pkg **pkgs_search(pkgs_t *, char *);
void pkgs_sort(pkgs_t *);
+
bool append_pkg_if_newer(pkgs_t *pkgs, struct pkg *p);

typedef enum {
	SCRIPT_UNKNOWN = 0,