From 18070eaf0b846bbee6c41d61aea69a979f33e202 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 27 Oct 2015 22:59:10 +0100 Subject: [PATCH] Check if a package is already installed by name, not by origin --- libpkg/pkg.c | 4 ++-- libpkg/pkg_add.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libpkg/pkg.c b/libpkg/pkg.c index 3d44ad7dbc..d650243cde 100644 --- a/libpkg/pkg.c +++ b/libpkg/pkg.c @@ -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); diff --git a/libpkg/pkg_add.c b/libpkg/pkg_add.c index 2ecde5337f..eedb8cda56 100644 --- a/libpkg/pkg_add.c +++ b/libpkg/pkg_add.c @@ -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);