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:
authorAurelien Foret <aurelien@archlinux.org>2006-02-05 09:27:26 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-02-05 09:27:26 +0000
commit325e3b6b98ee4ca217b153157936b77dc570bb57 (patch)
tree3a1f892f1e46c129be6370e9e44960e9be3e08ea /lib/libalpm/conflict.c
parentc432d525064dc9fd96bd32ade922740defd0c766 (diff)
added a pmconflict_t structure to handle file conflicts
Diffstat (limited to 'lib/libalpm/conflict.c')
-rw-r--r--lib/libalpm/conflict.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index dc5dbdb9..5836a9d6 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -34,7 +34,7 @@
#include "deps.h"
#include "conflict.h"
-/* Returns a PMList* of missing_t pointers.
+/* Returns a PMList* of pmdepmissing_t pointers.
*
* conflicts are always name only
*/
@@ -194,18 +194,20 @@ PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip
if(strcmp(p1->name, p2->name)) {
for(k = p1->files; k; k = k->next) {
filestr = k->data;
- if(!strcmp(filestr, "._install") || !strcmp(filestr, ".INSTALL")) {
+ if(filestr[strlen(filestr)-1] == '/') {
+ /* this filename has a trailing '/', so it's a directory -- skip it. */
continue;
}
- if(rindex(filestr, '/') == filestr+strlen(filestr)-1) {
- /* this filename has a trailing '/', so it's a directory -- skip it. */
+ if(!strcmp(filestr, "._install") || !strcmp(filestr, ".INSTALL")) {
continue;
}
if(pm_list_is_strin(filestr, p2->files)) {
- MALLOC(str, 512);
- snprintf(str, 512, "%s: exists in \"%s\" (target) and \"%s\" (target)",
- filestr, p1->name, p2->name);
- conflicts = pm_list_add(conflicts, str);
+ pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
+ conflict->type = PM_CONFLICT_TYPE_TARGET;
+ STRNCPY(conflict->target, p1->name, PKG_NAME_LEN);
+ STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN);
+ STRNCPY(conflict->ctarget, p2->name, PKG_NAME_LEN);
+ conflicts = pm_list_add(conflicts, conflict);
}
}
}
@@ -297,9 +299,12 @@ PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip
}
donecheck:
if(!ok) {
- MALLOC(str, 512);
- snprintf(str, 512, "%s: %s: exists in filesystem", p->name, path);
- conflicts = pm_list_add(conflicts, str);
+ pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
+ conflict->type = PM_CONFLICT_TYPE_FILE;
+ STRNCPY(conflict->target, p->name, PKG_NAME_LEN);
+ STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN);
+ conflict->ctarget[0] = 0;
+ conflicts = pm_list_add(conflicts, conflict);
}
}
}