query: only strip leading local/ for db packages

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2022-02-06 10:30:37 -08:00 committed by Allan McRae
parent 40583ebe89
commit 293762ea8b

View file

@ -468,11 +468,6 @@ int pacman_query(alpm_list_t *targets)
for(i = targets; i; i = alpm_list_next(i)) { for(i = targets; i; i = alpm_list_next(i)) {
const char *strname = i->data; const char *strname = i->data;
/* strip leading part of "local/pkgname" */
if(strncmp(strname, LOCAL_PREFIX, strlen(LOCAL_PREFIX)) == 0) {
strname += strlen(LOCAL_PREFIX);
}
if(config->op_q_isfile) { if(config->op_q_isfile) {
alpm_pkg_load(config->handle, strname, 1, 0, &pkg); alpm_pkg_load(config->handle, strname, 1, 0, &pkg);
@ -482,6 +477,11 @@ int pacman_query(alpm_list_t *targets)
alpm_strerror(alpm_errno(config->handle))); alpm_strerror(alpm_errno(config->handle)));
} }
} else { } else {
/* strip leading part of "local/pkgname" */
if(strncmp(strname, LOCAL_PREFIX, strlen(LOCAL_PREFIX)) == 0) {
strname += strlen(LOCAL_PREFIX);
}
pkg = alpm_db_get_pkg(db_local, strname); pkg = alpm_db_get_pkg(db_local, strname);
if(pkg == NULL) { if(pkg == NULL) {
pkg = alpm_find_satisfier(alpm_db_get_pkgcache(db_local), strname); pkg = alpm_find_satisfier(alpm_db_get_pkgcache(db_local), strname);