From af357d6ab00d8ca258dfd7abb689d6fd2eb4090f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 14 Jul 2011 15:32:03 -0500 Subject: 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 --- lib/libalpm/conflict.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/libalpm/conflict.c') 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); -- cgit v1.2.3