Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Check if a package is installed by name not by origin
Baptiste Daroussin committed 11 years ago
commit e955688be445aee180cf8e6b7ad5e5d61e13f6b8
parent c7356c8
3 files changed +4 -4
modified libpkg/pkg.c
@@ -1792,12 +1792,12 @@ pkg_try_installed(struct pkgdb *db, const char *origin,
}

int
-
pkg_is_installed(struct pkgdb *db, const char *origin)
+
pkg_is_installed(struct pkgdb *db, const char *name)
{
	struct pkg *pkg = NULL;
	int ret = EPKG_FATAL;

-
	ret = pkg_try_installed(db, origin, &pkg, PKG_LOAD_BASIC);
+
	ret = pkg_try_installed(db, name, &pkg, PKG_LOAD_BASIC);
	pkg_free(pkg);

	return (ret);
modified libpkg/pkg.h.in
@@ -788,7 +788,7 @@ int pkg_try_installed(struct pkgdb *db, const char *origin,
 * Match will be case sensitive or insensitive depending on
 * pkgdb_case_sensitive()
 */
-
int pkg_is_installed(struct pkgdb *db, const char *origin);
+
int pkg_is_installed(struct pkgdb *db, const char *name);

/**
 * Create a repository database.
modified src/check.c
@@ -70,7 +70,7 @@ check_deps(struct pkgdb *db, struct pkg *p, struct deps_head *dh, bool noinstall

	while (pkg_deps(p, &dep) == EPKG_OK) {
		/* do we have a missing dependency? */
-
		if (pkg_is_installed(db, pkg_dep_origin(dep)) != EPKG_OK) {
+
		if (pkg_is_installed(db, pkg_dep_name(dep)) != EPKG_OK) {
			if (quiet)
				pkg_sbuf_printf(out, "%n\t%sn\n", p, dep);
			else