index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/add.c | 4 | ||||
-rw-r--r-- | lib/libalpm/backup.c | 7 | ||||
-rw-r--r-- | lib/libalpm/backup.h | 2 | ||||
-rw-r--r-- | lib/libalpm/conflict.c | 16 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 2 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index e1827469..5e1bb8da 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -255,7 +255,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, alpm_backup_t *backup; /* go to the backup array and see if our conflict is there */ /* check newpkg first, so that adding backup files is retroactive */ - backup = _alpm_needbackup(entryname, alpm_pkg_get_backup(newpkg)); + backup = _alpm_needbackup(entryname, newpkg); if(backup) { /* if we force hash_orig to be non-NULL retroactive backup works */ hash_orig = ""; @@ -264,7 +264,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, /* check oldpkg for a backup entry, store the hash if available */ if(oldpkg) { - backup = _alpm_needbackup(entryname, alpm_pkg_get_backup(oldpkg)); + backup = _alpm_needbackup(entryname, oldpkg); if(backup) { hash_orig = backup->hash; needbackup = 1; diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c index becc7be9..728c1d05 100644 --- a/lib/libalpm/backup.c +++ b/lib/libalpm/backup.c @@ -58,16 +58,15 @@ int _alpm_split_backup(const char *string, alpm_backup_t **backup) /* Look for a filename in a alpm_pkg_t.backup list. If we find it, * then we return the full backup entry. */ -alpm_backup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list) +alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg) { const alpm_list_t *lp; - if(file == NULL || backup_list == NULL) { + if(file == NULL || pkg == NULL) { return NULL; } - /* run through the backup list and parse out the hash for our file */ - for(lp = backup_list; lp; lp = lp->next) { + for(lp = alpm_pkg_get_backup(pkg); lp; lp = lp->next) { alpm_backup_t *backup = lp->data; if(strcmp(file, backup->name) == 0) { diff --git a/lib/libalpm/backup.h b/lib/libalpm/backup.h index 39c01a6d..0b84a68c 100644 --- a/lib/libalpm/backup.h +++ b/lib/libalpm/backup.h @@ -24,7 +24,7 @@ #include "alpm.h" int _alpm_split_backup(const char *string, alpm_backup_t **backup); -alpm_backup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list); +alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg); void _alpm_backup_free(alpm_backup_t *backup); alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup); diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 8cf16191..eda6ba10 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -549,6 +549,22 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, free(rpath); } + /* is the file unowned and in the backup list of the new package? */ + if(!resolved_conflict && _alpm_needbackup(filestr, p1)) { + alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local); + int found = 0; + for(k = local_pkgs; k && !found; k = k->next) { + if(_alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) { + found = 1; + } + } + if(!found) { + _alpm_log(handle, ALPM_LOG_DEBUG, + "file was unowned but in new backup list: %s\n", path); + resolved_conflict = 1; + } + } + if(!resolved_conflict) { conflicts = add_fileconflict(handle, conflicts, ALPM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL); diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 5d2256d3..b15dbaa5 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -255,7 +255,7 @@ static void unlink_file(alpm_handle_t *handle, alpm_pkg_t *info, } } else { /* if the file needs backup and has been modified, back it up to .pacsave */ - alpm_backup_t *backup = _alpm_needbackup(fileobj->name, alpm_pkg_get_backup(info)); + alpm_backup_t *backup = _alpm_needbackup(fileobj->name, info); if(backup) { if(nosave) { _alpm_log(handle, ALPM_LOG_DEBUG, "transaction is set to NOSAVE, not backing up '%s'\n", file); |