xbps-bin: while installing binpkgs, detect properly in some cases its return value.

--HG--
extra : convert_revision : 89cb21eed183c1d9702613690fb7f48f8cceb5e2
This commit is contained in:
Juan RP 2009-02-22 06:00:08 +01:00
parent 2cfb55735b
commit eb2e824a33
2 changed files with 8 additions and 9 deletions

View file

@ -173,17 +173,16 @@ main(int argc, char **argv)
/* Install into root directory by default. */ /* Install into root directory by default. */
if (strcasecmp(argv[0], "install") == 0) { if (strcasecmp(argv[0], "install") == 0) {
rv = xbps_install_binary_pkg(argv[1], root, flags); rv = xbps_install_binary_pkg(argv[1], root, flags);
if (rv != 0 && rv != EEXIST) { if (rv != 0) {
if (rv == ENOENT) { if (rv == EAGAIN) {
printf("Unable to locate %s in " printf("Unable to locate %s in "
"repository pool.\n", argv[1]); "repository pool.\n", argv[1]);
exit(EXIT_FAILURE); } else if (rv == ENOENT) {
dict = xbps_get_pkg_deps_dictionary();
if (dict)
show_missing_deps(dict, argv[1]);
} }
dict = xbps_get_pkg_deps_dictionary();
if (dict && errno == ENOENT)
show_missing_deps(dict, argv[1]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
printf("Package %s installed successfully.\n", argv[1]); printf("Package %s installed successfully.\n", argv[1]);

View file

@ -105,8 +105,8 @@ xbps_install_binary_pkg(const char *pkgname, const char *destdir, int flags)
*/ */
rv = xbps_callback_array_iter_in_repolist(install_binpkg_repo_cb, rv = xbps_callback_array_iter_in_repolist(install_binpkg_repo_cb,
(void *)&cb); (void *)&cb);
if (rv == 0 && errno == EAGAIN) if (rv == 0 && errno != 0)
return ENOENT; return errno;
return rv; return rv;
} }