summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-06 18:25:33 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-06 18:25:33 +0000
commit04e054f3cbc9ddda9d99e4891055ae2743b3b8ff (patch)
treec3b389113853b45b4bc99bf707a037a4ce186efc /lib/libalpm/remove.c
parent08b34b8aef5e5567c9f186ed9c6ae2b5a7aee47b (diff)
downloadpacman-04e054f3cbc9ddda9d99e4891055ae2743b3b8ff.tar.xz
replaced transaction 'packages' field by 2 queues: one for packages to be installed and the other for the ones to be removed
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index acff25fc..4ac99220 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -53,11 +53,14 @@ int remove_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
+ /* ORE
+ we should better find the package in the cache, and then perform a
+ db_read(INFRQ_FILES) to add files information to it. */
if((info = db_scan(db, name, INFRQ_ALL)) == NULL) {
_alpm_log(PM_LOG_ERROR, "could not find %s in database", name);
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
- trans->packages = pm_list_add(trans->packages, info);
+ trans->remove_q = pm_list_add(trans->remove_q, info);
return(0);
}
@@ -74,20 +77,20 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
if(!(trans->flags & (PM_TRANS_FLAG_NODEPS)) && (trans->type != PM_TRANS_TYPE_UPGRADE)) {
TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
- _alpm_log(PM_LOG_FLOW1, "looking for conflicts or unsatisfied dependencies");
- if((lp = checkdeps(db, trans->type, trans->packages)) != NULL) {
+ _alpm_log(PM_LOG_FLOW1, "looking for unsatisfied dependencies");
+ if((lp = checkdeps(db, trans->type, trans->remove_q)) != NULL) {
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
while(lp) {
PMList *j;
for(j = lp; j; j = j->next) {
pmdepmissing_t* miss = (pmdepmissing_t*)j->data;
info = db_scan(db, miss->depend.name, INFRQ_ALL);
- if(!pkg_isin(info, trans->packages)) {
- trans->packages = pm_list_add(trans->packages, info);
+ if(!pkg_isin(info, trans->remove_q)) {
+ trans->remove_q = pm_list_add(trans->remove_q, info);
}
}
FREELIST(lp);
- lp = checkdeps(db, trans->type, trans->packages);
+ lp = checkdeps(db, trans->type, trans->remove_q);
}
} else {
*data = lp;
@@ -97,15 +100,15 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
if(trans->flags & PM_TRANS_FLAG_RECURSE) {
_alpm_log(PM_LOG_FLOW1, "finding removable dependencies");
- trans->packages = removedeps(db, trans->packages);
+ trans->remove_q = removedeps(db, trans->remove_q);
}
/* re-order w.r.t. dependencies */
_alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
- lp = sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
+ lp = sortbydeps(trans->remove_q, PM_TRANS_TYPE_REMOVE);
/* free the old alltargs */
- FREELISTPTR(trans->packages);
- trans->packages = lp;
+ FREELISTPTR(trans->remove_q);
+ trans->remove_q = lp;
TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
}
@@ -123,7 +126,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
- for(targ = trans->packages; targ; targ = targ->next) {
+ for(targ = trans->remove_q; targ; targ = targ->next) {
char pm_install[PATH_MAX];
info = (pmpkg_t*)targ->data;