pacman_query: move error messages into relevant if statements
This ensures any additions to these test do not have to rely on the correct error condition being set by libalpm. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
a194fb434e
commit
502e0d1db0
1 changed files with 16 additions and 16 deletions
|
@ -460,13 +460,16 @@ int pacman_query(alpm_list_t *targets)
|
||||||
|
|
||||||
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);
|
||||||
} else {
|
|
||||||
pkg = alpm_db_get_pkg(db_local, strname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pkg == NULL) {
|
if(pkg == NULL) {
|
||||||
switch(alpm_errno(config->handle)) {
|
pm_printf(ALPM_LOG_ERROR,
|
||||||
case ALPM_ERR_PKG_NOT_FOUND:
|
_("could not load package '%s': %s\n"), strname,
|
||||||
|
alpm_strerror(alpm_errno(config->handle)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pkg = alpm_db_get_pkg(db_local, strname);
|
||||||
|
|
||||||
|
if(pkg == NULL) {
|
||||||
pm_printf(ALPM_LOG_ERROR,
|
pm_printf(ALPM_LOG_ERROR,
|
||||||
_("package '%s' was not found\n"), strname);
|
_("package '%s' was not found\n"), strname);
|
||||||
if(!config->op_q_isfile && access(strname, R_OK) == 0) {
|
if(!config->op_q_isfile && access(strname, R_OK) == 0) {
|
||||||
|
@ -474,13 +477,10 @@ int pacman_query(alpm_list_t *targets)
|
||||||
_("'%s' is a file, you might want to use %s.\n"),
|
_("'%s' is a file, you might want to use %s.\n"),
|
||||||
strname, "-p/--file");
|
strname, "-p/--file");
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pm_printf(ALPM_LOG_ERROR,
|
|
||||||
_("could not load package '%s': %s\n"), strname,
|
|
||||||
alpm_strerror(alpm_errno(config->handle)));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pkg == NULL) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue