xbps_transaction: return proper errors if pkg is missing from repos.

This commit is contained in:
Juan RP
2012-11-28 17:35:03 +01:00
parent b743ee2634
commit 16e18313da

View File

@ -78,14 +78,14 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool bypattern,
pkg_repod = xbps_rpool_find_pkg_exact(xhp, pkg); pkg_repod = xbps_rpool_find_pkg_exact(xhp, pkg);
if (pkg_repod == NULL) { if (pkg_repod == NULL) {
/* not found */ /* not found */
return errno; return ENOENT;
} }
} else { } else {
if (((pkg_repod = xbps_rpool_find_pkg(xhp, pkg, bypattern, best)) == NULL) && if (((pkg_repod = xbps_rpool_find_pkg(xhp, pkg, bypattern, best)) == NULL) &&
((pkg_repod = xbps_rpool_find_virtualpkg_conf(xhp, pkg, bypattern)) == NULL) && ((pkg_repod = xbps_rpool_find_virtualpkg_conf(xhp, pkg, bypattern)) == NULL) &&
((pkg_repod = xbps_rpool_find_virtualpkg(xhp, pkg, bypattern)) == NULL)) { ((pkg_repod = xbps_rpool_find_virtualpkg(xhp, pkg, bypattern)) == NULL)) {
/* not found */ /* not found */
return errno; return ENOENT;
} }
} }
} else { } else {
@ -96,7 +96,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool bypattern,
pkg_repod = xbps_rpool_find_pkg(xhp, pkg, false, true); pkg_repod = xbps_rpool_find_pkg(xhp, pkg, false, true);
if (pkg_repod == NULL) { if (pkg_repod == NULL) {
/* not found */ /* not found */
return errno; return ENOENT;
} }
} }
prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgname", &pkgname); prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgname", &pkgname);
@ -181,12 +181,12 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool bypattern,
* the "unsorted" array in transaction dictionary. * the "unsorted" array in transaction dictionary.
*/ */
if (!prop_array_add(unsorted, pkg_repod)) if (!prop_array_add(unsorted, pkg_repod))
return errno; return EINVAL;
xbps_dbg_printf(xhp, "%s-%s: added into the transaction (%s).\n", xbps_dbg_printf(xhp, "%s-%s: added into the transaction (%s).\n",
pkgname, repover, repoloc); pkgname, repover, repoloc);
return rv; return 0;
} }
int int