Show an informative error if binpkg cannot be found in repos.
--HG-- extra : convert_revision : 0c1e639cb598b19d258c1e1413dd1cb5930c4c61
This commit is contained in:
parent
afa0eeae72
commit
b55346ae64
2 changed files with 13 additions and 5 deletions
|
@ -138,8 +138,13 @@ main(int argc, char **argv)
|
|||
if (strcasecmp(argv[0], "install") == 0) {
|
||||
rv = xbps_install_binary_pkg(argv[1], root);
|
||||
if (rv) {
|
||||
printf("ERROR: unable to install %s.\n", argv[1]);
|
||||
exit(rv);
|
||||
if (rv == ENOENT)
|
||||
printf("Unable to locate %s in "
|
||||
"repository pool.\n", argv[1]);
|
||||
else
|
||||
printf("Unable to install %s (%s).\n",
|
||||
argv[1], strerror(rv));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("Package %s installed successfully.\n", argv[1]);
|
||||
} else {
|
||||
|
@ -149,9 +154,9 @@ main(int argc, char **argv)
|
|||
printf("Package %s is not installed.\n",
|
||||
argv[1]);
|
||||
else
|
||||
printf("ERROR: unable to remove %s.\n",
|
||||
argv[1]);
|
||||
exit(rv);
|
||||
printf("Unable to remove %s (%s).\n",
|
||||
argv[1], strerror(rv));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("Package %s removed successfully.\n", argv[1]);
|
||||
}
|
||||
|
|
|
@ -87,6 +87,8 @@ xbps_install_binary_pkg(const char *pkgname, const char *destdir)
|
|||
*/
|
||||
rv = xbps_callback_array_iter_in_repolist(install_binpkg_repo_cb,
|
||||
(void *)&cb);
|
||||
if (errno == ENOENT)
|
||||
rv = ENOENT;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -120,6 +122,7 @@ install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done)
|
|||
pkgrd = xbps_find_pkg_in_dict(repod, "packages", pkgname);
|
||||
if (pkgrd == NULL) {
|
||||
prop_object_release(repod);
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue