Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-16 22:27:09 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-01-16 22:27:09 +0000
commit6e5a62dd128b6036eaa35f9b010a35120548e3db (patch)
tree1d419961d1eb80c57aa771756f41e59da145e8db /lib/libalpm/remove.c
parent9b2f0607d566bf95bbe14da6747771f7314bbbdc (diff)
more code cleanup
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 3e810203..b519cdc4 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -56,7 +56,6 @@ 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));
- _alpm_log(PM_LOG_FLOW2, "loading target %s", name);
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);
@@ -67,6 +66,7 @@ int remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
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);
return(0);
@@ -87,13 +87,16 @@ int remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
if(lp != 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;
- pmpkg_t *info = db_get_pkgfromcache(db, miss->depend.name);
- if(!pkg_isin(info, trans->packages)) {
- info = db_scan(db, miss->depend.name, INFRQ_ALL);
+ PMList *i;
+ for(i = lp; i; i = i->next) {
+ pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
+ pmpkg_t *info = db_scan(db, miss->depend.name, INFRQ_ALL);
+ if(info) {
+ _alpm_log(PM_LOG_FLOW2, "pulling %s in the targets list", info->name);
trans->packages = pm_list_add(trans->packages, info);
+ } else {
+ _alpm_log(PM_LOG_ERROR, "could not find %s in database -- skipping",
+ miss->depend.name);
}
}
FREELIST(lp);
@@ -166,7 +169,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
for(lp = _alpm_list_last(info->files); lp; lp = lp->prev) {
int nb = 0;
char *file = lp->data;
- char *md5 =_alpm_needbackup(lp->data, info->backup);
+ char *md5 = _alpm_needbackup(lp->data, info->backup);
if(md5) {
nb = 1;
free(md5);
@@ -201,7 +204,8 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
}
}
if(skipit) {
- _alpm_log(PM_LOG_FLOW2, "skipping removal of %s as it has moved to another package\n", file);
+ _alpm_log(PM_LOG_FLOW2, "skipping removal of %s as it has moved to another package",
+ file);
} else {
/* if the file is flagged, back it up to .pacsave */
if(nb) {
@@ -245,7 +249,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_FLOW1, "updating database");
_alpm_log(PM_LOG_FLOW2, "removing database entry %s", info->name);
if(db_remove(db, info) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not remove database entry %s/%s-%s", db->treename, info->name, info->version);
+ _alpm_log(PM_LOG_ERROR, "could not remove database entry %s-%s", info->name, info->version);
}
if(db_remove_pkgfromcache(db, info) == -1) {
_alpm_log(PM_LOG_ERROR, "could not remove entry %s from cache", info->name);
@@ -257,11 +261,9 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
pmpkg_t *depinfo = NULL;
pmdepend_t depend;
char *data;
-
if(splitdep((char*)lp->data, &depend)) {
continue;
}
-
depinfo = db_get_pkgfromcache(db, depend.name);
if(depinfo == NULL) {
/* look for a provides package */
@@ -273,11 +275,9 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
/* use the first one */
depinfo = db_get_pkgfromcache(db, ((pmpkg_t *)provides->data)->name);
FREELISTPTR(provides);
- if(depinfo == NULL) {
- /* wtf */
- continue;
- }
- } else {
+ }
+ if(depinfo == NULL) {
+ /* wtf */
continue;
}
}
@@ -286,7 +286,8 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
FREE(data);
_alpm_log(PM_LOG_DEBUG, "updating 'requiredby' field for package %s", depinfo->name);
if(db_write(db, depinfo, INFRQ_DEPENDS)) {
- _alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s/%s-%s", db->treename, depinfo->name, depinfo->version);
+ _alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
+ depinfo->name, depinfo->version);
}
}