summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2017-04-16 00:12:56 +0200
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-04-17 01:41:35 +0200
commit6d1dcf7937ba3739d17eda614591d1f59ac0bf3a (patch)
treecaa2ccc7815cc1c0dc95b36c20a0d4287f74a3ac /lib
parent16b91f798faf6413f9b043543c5c0c3467b6fdbf (diff)
downloadpacman-6d1dcf7937ba3739d17eda614591d1f59ac0bf3a.tar.gz
pacman-6d1dcf7937ba3739d17eda614591d1f59ac0bf3a.tar.xz
conflict: include owner for filesystem conflicts
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/conflict.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 0e37419f..d52f8942 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -278,12 +278,15 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
STRDUP(conflict->target, pkg1->name, goto error);
STRDUP(conflict->file, filestr, goto error);
- if(pkg2) {
- conflict->type = ALPM_FILECONFLICT_TARGET;
- STRDUP(conflict->ctarget, pkg2->name, goto error);
- } else {
+ if(!pkg2) {
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
STRDUP(conflict->ctarget, "", goto error);
+ } else if(pkg2->origin == ALPM_PKG_FROM_LOCALDB) {
+ conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
+ STRDUP(conflict->ctarget, pkg2->name, goto error);
+ } else {
+ conflict->type = ALPM_FILECONFLICT_TARGET;
+ STRDUP(conflict->ctarget, pkg2->name, goto error);
}
conflicts = alpm_list_add(conflicts, conflict);
@@ -385,6 +388,17 @@ static alpm_list_t *alpm_db_find_file_owners(alpm_db_t* db, const char *path)
return owners;
}
+static alpm_pkg_t *_alpm_find_file_owner(alpm_handle_t *handle, const char *path)
+{
+ alpm_list_t *i;
+ for(i = alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
+ if(alpm_filelist_contains(alpm_pkg_get_files(i->data), path)) {
+ return i->data;
+ }
+ }
+ return NULL;
+}
+
static int _alpm_can_overwrite_file(alpm_handle_t *handle, const char *path)
{
return handle->trans->flags & ALPM_TRANS_FLAG_FORCE
@@ -668,7 +682,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
}
if(!resolved_conflict) {
- conflicts = add_fileconflict(handle, conflicts, path, p1, NULL);
+ conflicts = add_fileconflict(handle, conflicts, path, p1,
+ _alpm_find_file_owner(handle, relative_path));
if(handle->pm_errno == ALPM_ERR_MEMORY) {
alpm_list_free_inner(conflicts,
(alpm_list_fn_free) alpm_conflict_free);