summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-26 13:29:47 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-26 13:29:47 +0000
commit43f4505b1e2be3745468b74771a08cca49148996 (patch)
tree7c90a9dbc2866a7fcb9aa8cabddf63123ae852d2 /lib/libalpm/remove.c
parent10b0e0d9af0e396d30f6fb1f5d321488897746d3 (diff)
downloadpacman-43f4505b1e2be3745468b74771a08cca49148996.tar.xz
More backport from pacman 2.9.5 (mainly for resolvedeps)
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index e361fc70..152a620f 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -133,8 +133,10 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
TRANS_CB(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
/* run the pre-remove scriptlet if it exists */
- snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", handle->root, handle->dbpath, db->treename, info->name, info->version);
- _alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL);
+ if(info->scriptlet) {
+ snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", handle->root, handle->dbpath, db->treename, info->name, info->version);
+ _alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL);
+ }
}
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
@@ -157,7 +159,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
continue;
}
if(S_ISDIR(buf.st_mode)) {
- _alpm_log(PM_LOG_DEBUG, "removing directory %s", line);
+ _alpm_log(PM_LOG_DEBUG, "removing directory %s", (char *)lp->data);
if(rmdir(line)) {
/* this is okay, other packages are probably using it. */
}
@@ -205,7 +207,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
/* update dependency packages' REQUIREDBY fields */
for(lp = info->depends; lp; lp = lp->next) {
- PMList *last, *j;
+ PMList *j;
pmpkg_t *depinfo = NULL;
pmdepend_t depend;
@@ -231,18 +233,9 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
}
}
/* splice out this entry from requiredby */
- last = pm_list_last(depinfo->requiredby);
- /* ORE - use list_remove here? */
for(j = depinfo->requiredby; j; j = j->next) {
if(!strcmp((char*)j->data, info->name)) {
- if(j == depinfo->requiredby) {
- depinfo->requiredby = j->next;
- }
- if(j->prev) j->prev->next = j->next;
- if(j->next) j->next->prev = j->prev;
- /* free the spliced node */
- j->prev = j->next = NULL;
- FREELIST(j);
+ depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, j);
break;
}
}