From 5ef51b3e266cf43411947248886372001fdb207a Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Fri, 7 Oct 2005 23:29:49 +0000 Subject: Merging in recent fixes/additions from 2.9.7 --- lib/libalpm/remove.c | 52 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'lib/libalpm/remove.c') diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index fd00eae1..0e335906 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -191,28 +191,42 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db) _alpm_log(PM_LOG_FLOW2, "removing directory %s", file); } } else { - /* if the file is flagged, back it up to .pacsave */ - if(nb) { - if(trans->type == PM_TRANS_TYPE_UPGRADE) { - /* we're upgrading so just leave the file as is. pacman_add() will handle it */ - } else { - if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) { - char newpath[PATH_MAX]; - snprintf(newpath, PATH_MAX, "%s.pacsave", line); - rename(line, newpath); - _alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath); - alpm_logaction("%s saved as %s", line, newpath); + /* check the "skip list" before removing the file. + * see the big comment block in db_find_conflicts() for an + * explanation. */ + int skipit = 0; + PMList *j; + for(j = trans->skiplist; j; j = j->next) { + if(!strcmp(file, (char*)j->data)) { + skipit = 1; + } + } + if(skipit) { + _alpm_log(PM_LOG_FLOW2, "skipping removal of %s as it has moved to another package\n", file); + } else { + /* if the file is flagged, back it up to .pacsave */ + if(nb) { + if(trans->type == PM_TRANS_TYPE_UPGRADE) { + /* we're upgrading so just leave the file as is. pacman_add() will handle it */ } else { - _alpm_log(PM_LOG_FLOW2, "unlinking %s", file); - if(unlink(line)) { - _alpm_log(PM_LOG_ERROR, "cannot remove file %s", file); + if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) { + char newpath[PATH_MAX]; + snprintf(newpath, PATH_MAX, "%s.pacsave", line); + rename(line, newpath); + _alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath); + alpm_logaction("%s saved as %s", line, newpath); + } else { + _alpm_log(PM_LOG_FLOW2, "unlinking %s", file); + if(unlink(line)) { + _alpm_log(PM_LOG_ERROR, "cannot remove file %s", file); + } } } - } - } else { - _alpm_log(PM_LOG_FLOW2, "unlinking %s", file); - if(unlink(line)) { - _alpm_log(PM_LOG_ERROR, "cannot remove file %s", file); + } else { + _alpm_log(PM_LOG_FLOW2, "unlinking %s", file); + if(unlink(line)) { + _alpm_log(PM_LOG_ERROR, "cannot remove file %s", file); + } } } } -- cgit v1.2.3-54-g00ecf