Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/conflict.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-14 15:32:03 -0500
committerDan McGee <dan@archlinux.org>2011-07-14 15:34:04 -0500
commitaf357d6ab00d8ca258dfd7abb689d6fd2eb4090f (patch)
tree81218f7e003e71d2d8c7feee6671516865f751d6 /lib/libalpm/conflict.c
parent36e48573ceee0f707de0dcc55d1da442d949d3dc (diff)
Allow fileconflict if unowned file moving into backup array
The bulk of this commit is adding new tests to ensure the new behavior works without disrupting old behavior. This is a relatively sane maneuver when a package adds a conf file (e.g. '/etc/mercurial/hgrc') that was not previously in the package, but it is placed in the backup array. In essence, we can treat the existing file as having always been a part of the package and do our normal compare/install as pacnew logic checks. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/conflict.c')
-rw-r--r--lib/libalpm/conflict.c16
1 files changed, 16 insertions, 0 deletions
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);