libxbps: when resolving deps, ignore all of them that depend on the origin pkg.

This commit is contained in:
Juan RP
2013-02-07 18:50:55 +01:00
parent 178a6b58ae
commit 2b5d3bb8f4
4 changed files with 27 additions and 3 deletions

View File

@ -158,7 +158,7 @@ find_repo_deps(struct xbps_handle *xhp,
prop_array_t curpkgrdeps;
pkg_state_t state;
size_t x;
const char *reqpkg, *pkgver_q, *reason = NULL;
const char *reqpkg, *reqpkgname, *pkgver_q, *reason = NULL;
char *pkgname;
int rv = 0;
@ -317,6 +317,22 @@ find_repo_deps(struct xbps_handle *xhp,
}
prop_dictionary_get_cstring_nocopy(curpkgd,
"pkgver", &pkgver_q);
prop_dictionary_get_cstring_nocopy(curpkgd,
"pkgname", &reqpkgname);
/*
* Check dependency validity.
*/
pkgname = xbps_pkg_name(curpkg);
assert(pkgname);
if (strcmp(pkgname, reqpkgname) == 0) {
xbps_dbg_printf_append(xhp, "[ignoring wrong dependency "
"%s (depends on itself)]\n",
reqpkg);
free(pkgname);
continue;
}
free(pkgname);
/*
* Check if package has matched conflicts.
*/

View File

@ -205,9 +205,14 @@ again:
rv = EINVAL;
break;
}
if ((xbps_match_virtual_pkg_in_dict(curpkgd, str, true)) ||
(xbps_match_virtual_pkg_in_dict(curpkgd, str, false))) {
xbps_dbg_printf_append(xhp, "ignore wrong "
"dependency %s (depends on itself)\n", str);
continue;
}
prop_dictionary_get_cstring_nocopy(curpkgd,
"transaction", &tract);
lpd = pkgdep_alloc(curpkgd, str);
if (pdn == NULL) {