Skip to content

Commit

Permalink
Check if a package is already installed by name, not by origin
Browse files Browse the repository at this point in the history
  • Loading branch information
bapt committed Oct 27, 2015
1 parent 329c214 commit 18070ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libpkg/pkg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1644,12 +1644,12 @@ pkg_recompute(struct pkgdb *db, struct pkg *pkg)
}

int
pkg_try_installed(struct pkgdb *db, const char *origin,
pkg_try_installed(struct pkgdb *db, const char *names,
struct pkg **pkg, unsigned flags) {
struct pkgdb_it *it = NULL;
int ret = EPKG_FATAL;

if ((it = pkgdb_query(db, origin, MATCH_EXACT)) == NULL)
if ((it = pkgdb_query(db, name, MATCH_EXACT)) == NULL)
return (EPKG_FATAL);

ret = pkgdb_it_next(it, pkg, flags);
Expand Down
2 changes: 1 addition & 1 deletion libpkg/pkg_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ pkg_add_check_pkg_archive(struct pkgdb *db, struct pkg *pkg,
}

/* XX check */
ret = pkg_try_installed(db, pkg->origin, &pkg_inst, PKG_LOAD_BASIC);
ret = pkg_try_installed(db, pkg->name, &pkg_inst, PKG_LOAD_BASIC);
if (ret == EPKG_OK) {
if ((flags & PKG_ADD_FORCE) == 0) {
pkg_emit_already_installed(pkg_inst);
Expand Down

0 comments on commit 18070ea

Please sign in to comment.