Fix and improve when there are missing deps in the transaction dictionary.

This commit is contained in:
Juan RP 2010-11-23 23:17:04 +01:00
parent 99f3d846de
commit d2be842ce5
5 changed files with 23 additions and 11 deletions

View File

@ -612,10 +612,11 @@ xbps_exec_transaction(bool yes)
trans->dict = xbps_repository_get_transaction_dict();
if (trans->dict == NULL) {
rv = errno;
xbps_dbg_printf("Empty transaction dictionary: %s\n",
strerror(errno));
goto out;
}
if (rv == ENOENT) {
if (errno == ENOENT) {
/*
* Bail out if there are unresolved deps.
*/

View File

@ -75,8 +75,9 @@ xbps_regpkgdb_dictionary_get(void)
regpkgdb_dict = prop_dictionary_internalize_from_zfile(plist);
if (regpkgdb_dict == NULL) {
free(plist);
xbps_dbg_printf("[regpkgdb] cannot internalize "
"regpkgdb_dict %s\n", strerror(errno));
if (errno != ENOENT)
xbps_dbg_printf("[regpkgdb] cannot internalize "
"regpkgdb_dict %s\n", strerror(errno));
return NULL;
}
free(plist);

View File

@ -113,6 +113,7 @@ add_missing_reqdep(prop_dictionary_t trans_dict, const char *reqpkg)
prop_object_t obj;
size_t idx = 0;
bool add_pkgdep, pkgfound, update_pkgdep;
int rv = 0;
assert(trans_dict != NULL);
assert(reqpkg != NULL);
@ -148,6 +149,12 @@ add_missing_reqdep(prop_dictionary_t trans_dict, const char *reqpkg)
}
if (strcmp(pkgnamedep, curpkgnamedep) == 0) {
pkgfound = true;
if (strcmp(curver, pkgver) == 0) {
free(curpkgnamedep);
free(pkgnamedep);
rv = EEXIST;
goto out;
}
/*
* if new dependency version is greater than current
* one, store it.
@ -158,6 +165,7 @@ add_missing_reqdep(prop_dictionary_t trans_dict, const char *reqpkg)
add_pkgdep = false;
free(curpkgnamedep);
free(pkgnamedep);
rv = EEXIST;
goto out;
}
update_pkgdep = true;
@ -180,7 +188,7 @@ out:
return errno;
}
return 0;
return rv;
}
static int

View File

@ -213,18 +213,17 @@ xbps_repository_get_transaction_dict(void)
* return the dictionary, the client should always
* check if that's the case.
*/
if (rv == ENOENT)
return trans_dict;
return NULL;
return trans_dict;
}
/*
* Add total transaction installed/download sizes
* to the transaction dictionary.
*/
if (compute_transaction_sizes() != 0)
if ((rv = compute_transaction_sizes()) != 0) {
errno = rv;
return NULL;
}
/*
* Remove the "missing_deps" array now that it's not needed.

View File

@ -74,8 +74,11 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
* If there are missing dependencies, bail out.
*/
missingdeps = prop_dictionary_get(chaindeps, "missing_deps");
if (prop_array_count(missingdeps) > 0)
if (prop_array_count(missingdeps) > 0) {
xbps_dbg_printf("missing dependencies! won't "
"continue sorting\n");
return ENOENT;
}
sorted = prop_array_create();
if (sorted == NULL)