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:
authorAaron Griffin <aaron@archlinux.org>2007-02-21 06:44:14 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-21 06:44:14 +0000
commit436f36c76b74f7580da48e618dbdbd78037736fb (patch)
tree2ac3224aebed635bde3b6730c02cf3cbeb57f71c /lib/libalpm/remove.c
parent1334f5c56c8394e69ad16f3b5269105e3dc42246 (diff)
* Re-added a compare function for syncpkg's - it was removed without thinking
properly * Error when re-reading the DB for replacements, wrong info level * Removed an duplicate debug message "checking for package replacements" * Check ignorepkg for REAL upgrades... * Properly check the NOSAVE flag * some unlink_file (remove.c) cleanup * fix indent level on handle.c * Force libalpm paths to end with a '/' char * Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t) * Added some debug output to cache and db scanning ** All pactest tests succeed again, yay **
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 4b2350f8..3cd70dc0 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -206,10 +206,11 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
FREE(hash);
}
- if(!needbackup && trans->type == PM_TRANS_TYPE_UPGRADE) {
+ if(trans->type == PM_TRANS_TYPE_UPGRADE) {
/* check noupgrade */
if(alpm_list_find_str(handle->noupgrade, lp->data)) {
- needbackup = 1;
+ _alpm_log(PM_LOG_DEBUG, _("Skipping removal of '%s' due to NoUpgrade"), file);
+ return;
}
}
@@ -232,28 +233,31 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
* explanation. */
if(alpm_list_find_str(trans->skip_remove, file)) {
_alpm_log(PM_LOG_DEBUG, _("%s is in trans->skip_remove, skipping removal"), file);
+ return;
} else if(needbackup) {
/* if the file is flagged, back it up to .pacsave */
if(!(trans->type == PM_TRANS_TYPE_UPGRADE)) {
/* if it was an upgrade, the file would be left alone because
* pacman_add() would handle it */
- if(!(trans->type & PM_TRANS_FLAG_NOSAVE)) {
+ if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) {
char newpath[PATH_MAX];
snprintf(newpath, PATH_MAX, "%s.pacsave", file);
rename(file, newpath);
_alpm_log(PM_LOG_WARNING, _("%s saved as %s"), file, newpath);
+ return;
+ } else {
+ _alpm_log(PM_LOG_DEBUG, _("transaction is set to NOSAVE, not backing up '%s'"), file);
}
}
- } else {
- _alpm_log(PM_LOG_DEBUG, _("unlinking %s"), file);
- int list_count = alpm_list_count(trans->packages); /* this way we don't have to call alpm_list_count twice during PROGRESS */
+ }
+ _alpm_log(PM_LOG_DEBUG, _("unlinking %s"), file);
+ int list_count = alpm_list_count(trans->packages); /* this way we don't have to call alpm_list_count twice during PROGRESS */
- PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - alpm_list_count(targ) + 1));
- ++(*position);
+ PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - alpm_list_count(targ) + 1));
+ ++(*position);
- if(unlink(file) == -1) {
- _alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), lp->data, strerror(errno));
- }
+ if(unlink(file) == -1) {
+ _alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), lp->data, strerror(errno));
}
}
}