summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-25 22:09:14 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-25 22:09:14 +0000
commit7c847fd7d4fee0fa5e0314f409eb06cfda2c289b (patch)
tree0e9d02aaf7284066f506fef81a758276ba466b56 /lib/libalpm/remove.c
parent6e63ccfd0fdd19b6d710eb8dc84c85aaf25c3006 (diff)
Backport from pacman 2.9.5
- list_remove, list_check and list_reverse - sortbydeps(mode)
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 619dd913..e361fc70 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -65,7 +65,7 @@ int remove_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
{
pmpkg_t *info;
- PMList *lp;
+ PMList *lp, *i;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -99,6 +99,16 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
trans->packages = removedeps(db, trans->packages);
}
+ /* re-order w.r.t. dependencies */
+ _alpm_log(PM_LOG_FLOW2, "sorting by dependencies...");
+ lp = sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
+ /* free the old alltargs */
+ for(i = trans->packages; i; i = i->next) {
+ i->data = NULL;
+ }
+ FREELIST(trans->packages);
+ trans->packages = lp;
+
TRANS_CB(trans, PM_TRANS_EVT_DEPS_DONE, NULL, NULL);
}