Avoid endless loop while sorting dependencies due to missing packages.
--HG-- extra : convert_revision : xtraeme%40gmail.com-20100129034440-c1c9q0o5b0r1hhh2
This commit is contained in:
parent
83ab3fe977
commit
2daffcc768
@ -205,6 +205,14 @@ xbps_repository_get_transaction_dict(void)
|
|||||||
* Sort package list if necessary.
|
* Sort package list if necessary.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_sort_pkg_deps(trans_dict)) != 0) {
|
if ((rv = xbps_sort_pkg_deps(trans_dict)) != 0) {
|
||||||
|
/*
|
||||||
|
* If there are missing deps (errno==ENOENT)
|
||||||
|
* return the dictionary, the client should always
|
||||||
|
* check if that's the case.
|
||||||
|
*/
|
||||||
|
if (errno == ENOENT)
|
||||||
|
return trans_dict;
|
||||||
|
|
||||||
errno = rv;
|
errno = rv;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ find_sorteddep_by_name(const char *pkgname)
|
|||||||
int HIDDEN
|
int HIDDEN
|
||||||
xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
|
xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
|
||||||
{
|
{
|
||||||
prop_array_t sorted, unsorted, rundeps;
|
prop_array_t sorted, unsorted, rundeps, missingdeps;
|
||||||
prop_object_t obj, obj2;
|
prop_object_t obj, obj2;
|
||||||
prop_object_iterator_t iter, iter2;
|
prop_object_iterator_t iter, iter2;
|
||||||
struct sorted_dependency *sdep;
|
struct sorted_dependency *sdep;
|
||||||
@ -73,6 +73,13 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
|
|||||||
|
|
||||||
assert(chaindeps != NULL);
|
assert(chaindeps != NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If there are missing dependencies, bail out.
|
||||||
|
*/
|
||||||
|
missingdeps = prop_dictionary_get(chaindeps, "missing_deps");
|
||||||
|
if (prop_array_count(missingdeps) > 0)
|
||||||
|
return ENOENT;
|
||||||
|
|
||||||
sorted = prop_array_create();
|
sorted = prop_array_create();
|
||||||
if (sorted == NULL)
|
if (sorted == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user