From cf94007aed7eb87a38090a62b9ddf606ea1343c9 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 18 Jan 2006 22:37:16 +0000 Subject: more code cleanup yet --- lib/libalpm/remove.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/remove.c') diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 966df1b6..898969ee 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -56,16 +56,15 @@ int remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + if(pkg_isin(name, trans->packages)) { + RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); + } + 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); } - if(pkg_isin(info, trans->packages)) { - FREEPKG(info); - RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); - } - _alpm_log(PM_LOG_FLOW2, "adding %s in the targets list", info->name); trans->packages = pm_list_add(trans->packages, info); @@ -264,6 +263,13 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db) if(splitdep((char*)lp->data, &depend)) { continue; } + /* if this dependency is in the transaction targets, no need to update + * its requiredby info: it is in the process of being removed (if not + * already done!) + */ + if(pkg_isin(depend.name, trans->packages)) { + continue; + } depinfo = db_get_pkgfromcache(db, depend.name); if(depinfo == NULL) { /* look for a provides package */ -- cgit v1.2.3-24-g4f1b