Revert "lib/transaction_{revdeps,prepare}.c: try to update packages if necessary"

This reverts commit 0e950156fc.
This commit is contained in:
Duncan Overbruck 2019-08-05 11:48:15 +02:00
parent cb28e7959a
commit f103b91663
3 changed files with 51 additions and 91 deletions

View File

@ -127,7 +127,7 @@ xbps_dictionary_t HIDDEN xbps_find_pkg_in_array(xbps_array_t, const char *,
const char *);
xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_array(struct xbps_handle *,
xbps_array_t, const char *, const char *);
int HIDDEN xbps_transaction_revdeps(struct xbps_handle *, xbps_array_t);
void HIDDEN xbps_transaction_revdeps(struct xbps_handle *, xbps_array_t);
bool HIDDEN xbps_transaction_shlibs(struct xbps_handle *, xbps_array_t,
xbps_array_t);
int HIDDEN xbps_transaction_init(struct xbps_handle *);

View File

@ -272,13 +272,11 @@ xbps_transaction_init(struct xbps_handle *xhp)
return 0;
}
#define MAX_REPEAT 512
int
xbps_transaction_prepare(struct xbps_handle *xhp)
{
xbps_array_t array, pkgs, edges;
unsigned int i, j, cnt;
unsigned int i, cnt;
int rv = 0;
if ((rv = xbps_transaction_init(xhp)) != 0)
@ -287,7 +285,6 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
if (xhp->transd == NULL)
return ENXIO;
for (j = 0; j < MAX_REPEAT; j++) {
/*
* Collect dependencies for pkgs in transaction.
*/
@ -338,28 +335,10 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
xhp->transd = NULL;
return rv;
}
/*
* Check reverse dependencies.
*/
if ((rv = xbps_transaction_revdeps(xhp, pkgs)) == 0)
break;
if (rv != EAGAIN)
return rv;
}
/*
* Repeated too many times.
*/
if (j == MAX_REPEAT) {
xbps_dbg_printf(xhp, "[trans] aborted due to too many repetitions"
" while resolving dependencies!\n");
return ELOOP;
} else {
xbps_dbg_printf(xhp, "[trans] resolved dependencies in"
" %d repetitions.\n", j);
}
/*
* If there are missing deps or revdeps bail out.
*/
xbps_transaction_revdeps(xhp, pkgs);
array = xbps_dictionary_get(xhp->transd, "missing_deps");
if (xbps_array_count(array)) {
if (xhp->flags & XBPS_FLAG_FORCE_REMOVE_REVDEPS) {

View File

@ -101,21 +101,10 @@ broken_pkg(xbps_array_t mdeps, const char *dep, const char *pkg, const char *tra
free(str);
}
static int
update_pkg(struct xbps_handle *xhp, const char *pkg)
{
int rv = 0;
rv = xbps_transaction_update_pkg(xhp, pkg);
if (rv == EEXIST)
return 0;
return rv;
}
int HIDDEN
void HIDDEN
xbps_transaction_revdeps(struct xbps_handle *xhp, xbps_array_t pkgs)
{
xbps_array_t mdeps;
int updated = 0;
mdeps = xbps_dictionary_get(xhp->transd, "missing_deps");
@ -246,17 +235,9 @@ xbps_transaction_revdeps(struct xbps_handle *xhp, xbps_array_t pkgs)
free(pkgname);
continue;
}
if (update_pkg(xhp, pkgname) == 0) {
updated++;
free(pkgname);
continue;
}
free(pkgname);
broken_pkg(mdeps, curpkgver, pkgver, tract);
}
}
if (updated > 0)
return EAGAIN;
return 0;
}