2005-03-22 15:21:12 -05:00
|
|
|
/*
|
|
|
|
* conflict.c
|
|
|
|
*
|
2006-01-02 14:55:35 -05:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2006-10-15 15:31:03 -04:00
|
|
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
|
|
|
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
|
|
|
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
2006-10-15 20:05:10 -04:00
|
|
|
* Copyright (c) 2006 by Christian Hamar <krics@linuxforum.hu>
|
2005-03-22 15:21:12 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
|
|
* USA.
|
|
|
|
*/
|
|
|
|
|
2006-10-15 15:31:03 -04:00
|
|
|
#if defined(__APPLE__) || defined(__OpenBSD__)
|
|
|
|
#include <sys/syslimits.h>
|
|
|
|
#endif
|
|
|
|
|
2005-03-22 15:21:12 -05:00
|
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
2006-11-22 04:03:41 -05:00
|
|
|
#include <stdio.h>
|
2005-03-22 15:21:12 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2006-03-02 14:04:40 -05:00
|
|
|
#include <limits.h>
|
2005-03-22 15:21:12 -05:00
|
|
|
#include <sys/stat.h>
|
2006-05-14 22:19:57 -04:00
|
|
|
#include <libintl.h>
|
2005-03-22 15:21:12 -05:00
|
|
|
/* pacman */
|
2006-11-22 04:03:41 -05:00
|
|
|
#include "handle.h"
|
2007-01-19 04:28:44 -05:00
|
|
|
#include "alpm_list.h"
|
2006-11-20 04:10:23 -05:00
|
|
|
#include "trans.h"
|
2005-03-22 15:21:12 -05:00
|
|
|
#include "util.h"
|
2006-10-15 15:31:03 -04:00
|
|
|
#include "error.h"
|
2006-01-15 10:55:16 -05:00
|
|
|
#include "log.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "deps.h"
|
2005-03-22 15:21:12 -05:00
|
|
|
#include "conflict.h"
|
|
|
|
|
2007-01-19 04:28:44 -05:00
|
|
|
/* Returns a alpm_list_t* of pmdepmissing_t pointers.
|
2006-01-15 10:55:16 -05:00
|
|
|
*
|
|
|
|
* conflicts are always name only
|
|
|
|
*/
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages)
|
2006-01-15 10:55:16 -05:00
|
|
|
{
|
|
|
|
pmpkg_t *info = NULL;
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *i, *j, *k;
|
|
|
|
alpm_list_t *baddeps = NULL;
|
2006-01-15 10:55:16 -05:00
|
|
|
pmdepmissing_t *miss = NULL;
|
|
|
|
|
|
|
|
if(db == NULL) {
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = packages; i; i = i->next) {
|
|
|
|
pmpkg_t *tp = i->data;
|
|
|
|
if(tp == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j = tp->conflicts; j; j = j->next) {
|
|
|
|
if(!strcmp(tp->name, j->data)) {
|
|
|
|
/* a package cannot conflict with itself -- that's just not nice */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* CHECK 1: check targets against database */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("checkconflicts: targ '%s' vs db"), tp->name);
|
2006-10-31 01:39:59 -05:00
|
|
|
for(k = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); k; k = k->next) {
|
2006-01-15 10:55:16 -05:00
|
|
|
pmpkg_t *dp = (pmpkg_t *)k->data;
|
|
|
|
if(!strcmp(dp->name, tp->name)) {
|
|
|
|
/* a package cannot conflict with itself -- that's just not nice */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(!strcmp(j->data, dp->name)) {
|
|
|
|
/* conflict */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("targs vs db: found %s as a conflict for %s"),
|
2006-01-18 17:37:16 -05:00
|
|
|
dp->name, tp->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
|
|
|
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
2007-01-19 04:28:44 -05:00
|
|
|
baddeps = alpm_list_add(baddeps, miss);
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREE(miss);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* see if dp provides something in tp's conflict list */
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *m;
|
2006-01-15 10:55:16 -05:00
|
|
|
for(m = dp->provides; m; m = m->next) {
|
|
|
|
if(!strcmp(m->data, j->data)) {
|
|
|
|
/* confict */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("targs vs db: found %s as a conflict for %s"),
|
2006-01-18 17:37:16 -05:00
|
|
|
dp->name, tp->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
|
|
|
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
2007-01-19 04:28:44 -05:00
|
|
|
baddeps = alpm_list_add(baddeps, miss);
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREE(miss);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* CHECK 2: check targets against targets */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("checkconflicts: targ '%s' vs targs"), tp->name);
|
2006-01-15 10:55:16 -05:00
|
|
|
for(k = packages; k; k = k->next) {
|
|
|
|
pmpkg_t *otp = (pmpkg_t *)k->data;
|
|
|
|
if(!strcmp(otp->name, tp->name)) {
|
|
|
|
/* a package cannot conflict with itself -- that's just not nice */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(!strcmp(otp->name, (char *)j->data)) {
|
|
|
|
/* otp is listed in tp's conflict list */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("targs vs targs: found %s as a conflict for %s"),
|
2006-01-18 17:37:16 -05:00
|
|
|
otp->name, tp->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
|
|
|
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
2007-01-19 04:28:44 -05:00
|
|
|
baddeps = alpm_list_add(baddeps, miss);
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREE(miss);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* see if otp provides something in tp's conflict list */
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *m;
|
2006-01-15 10:55:16 -05:00
|
|
|
for(m = otp->provides; m; m = m->next) {
|
|
|
|
if(!strcmp(m->data, j->data)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("targs vs targs: found %s as a conflict for %s"),
|
2006-01-18 17:37:16 -05:00
|
|
|
otp->name, tp->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
|
|
|
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
2007-01-19 04:28:44 -05:00
|
|
|
baddeps = alpm_list_add(baddeps, miss);
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREE(miss);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* CHECK 3: check database against targets */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("checkconflicts: db vs targ '%s'"), tp->name);
|
2006-10-31 01:39:59 -05:00
|
|
|
for(k = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); k; k = k->next) {
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *conflicts = NULL;
|
2006-02-21 18:55:59 -05:00
|
|
|
int usenewconflicts = 0;
|
|
|
|
|
2006-01-15 10:55:16 -05:00
|
|
|
info = k->data;
|
|
|
|
if(!strcmp(info->name, tp->name)) {
|
|
|
|
/* a package cannot conflict with itself -- that's just not nice */
|
|
|
|
continue;
|
|
|
|
}
|
2007-01-19 04:28:44 -05:00
|
|
|
/* If this package (*info) is also in our packages alpm_list_t, use the
|
2006-02-21 18:55:59 -05:00
|
|
|
* conflicts list from the new package, not the old one (*info)
|
|
|
|
*/
|
|
|
|
for(j = packages; j; j = j->next) {
|
|
|
|
pmpkg_t *pkg = j->data;
|
|
|
|
if(!strcmp(pkg->name, info->name)) {
|
2006-10-15 15:31:03 -04:00
|
|
|
/* Use the new, to-be-installed package's conflicts */
|
2006-02-21 18:55:59 -05:00
|
|
|
conflicts = pkg->conflicts;
|
|
|
|
usenewconflicts = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!usenewconflicts) {
|
|
|
|
/* Use the old package's conflicts, it's the only set we have */
|
|
|
|
conflicts = info->conflicts;
|
|
|
|
}
|
|
|
|
for(j = conflicts; j; j = j->next) {
|
2006-01-15 10:55:16 -05:00
|
|
|
if(!strcmp((char *)j->data, tp->name)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("db vs targs: found %s as a conflict for %s"),
|
2006-01-18 17:37:16 -05:00
|
|
|
info->name, tp->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
|
|
|
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
2007-01-19 04:28:44 -05:00
|
|
|
baddeps = alpm_list_add(baddeps, miss);
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREE(miss);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* see if the db package conflicts with something we provide */
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *m;
|
2006-02-21 18:55:59 -05:00
|
|
|
for(m = conflicts; m; m = m->next) {
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *n;
|
2006-01-15 10:55:16 -05:00
|
|
|
for(n = tp->provides; n; n = n->next) {
|
|
|
|
if(!strcmp(m->data, n->data)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("db vs targs: found %s as a conflict for %s"),
|
2006-01-18 17:37:16 -05:00
|
|
|
info->name, tp->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
|
|
|
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
2007-01-19 04:28:44 -05:00
|
|
|
baddeps = alpm_list_add(baddeps, miss);
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREE(miss);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return(baddeps);
|
|
|
|
}
|
|
|
|
|
2007-01-19 04:28:44 -05:00
|
|
|
/* Returns a alpm_list_t* of file conflicts.
|
2007-01-18 11:52:57 -05:00
|
|
|
*
|
2007-01-19 04:28:44 -05:00
|
|
|
* adds list of files to skip to alpm_list_t** skip_list.
|
2007-01-18 11:52:57 -05:00
|
|
|
*/
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, alpm_list_t **skip_list)
|
2005-03-22 15:21:12 -05:00
|
|
|
{
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *i, *j, *k;
|
2005-03-22 15:21:12 -05:00
|
|
|
char *filestr = NULL;
|
|
|
|
char path[PATH_MAX+1];
|
|
|
|
struct stat buf, buf2;
|
2007-01-19 04:28:44 -05:00
|
|
|
alpm_list_t *conflicts = NULL;
|
|
|
|
alpm_list_t *targets = trans->packages;
|
2006-10-15 19:54:43 -04:00
|
|
|
double percent;
|
2005-03-22 15:21:12 -05:00
|
|
|
|
|
|
|
if(db == NULL || targets == NULL || root == NULL) {
|
|
|
|
return(NULL);
|
|
|
|
}
|
2005-10-07 19:29:49 -04:00
|
|
|
/* CHECK 1: check every target against every target */
|
2005-03-22 15:21:12 -05:00
|
|
|
for(i = targets; i; i = i->next) {
|
|
|
|
pmpkg_t *p1 = (pmpkg_t*)i->data;
|
2007-01-19 04:28:44 -05:00
|
|
|
percent = (double)(alpm_list_count(targets) - alpm_list_count(i) + 1) / alpm_list_count(targets);
|
|
|
|
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100), alpm_list_count(targets), (alpm_list_count(targets) - alpm_list_count(i) +1));
|
2005-03-22 15:21:12 -05:00
|
|
|
for(j = i; j; j = j->next) {
|
|
|
|
pmpkg_t *p2 = (pmpkg_t*)j->data;
|
|
|
|
if(strcmp(p1->name, p2->name)) {
|
|
|
|
for(k = p1->files; k; k = k->next) {
|
|
|
|
filestr = k->data;
|
2006-02-05 04:27:26 -05:00
|
|
|
if(filestr[strlen(filestr)-1] == '/') {
|
2007-01-18 11:52:57 -05:00
|
|
|
/* has a trailing '/', so it's a directory -- skip it. */
|
2005-03-22 15:21:12 -05:00
|
|
|
continue;
|
|
|
|
}
|
2007-01-18 11:52:57 -05:00
|
|
|
if(strcmp(filestr, ".INSTALL") == 0) {
|
2005-03-22 15:21:12 -05:00
|
|
|
continue;
|
|
|
|
}
|
2007-01-19 04:28:44 -05:00
|
|
|
if(alpm_list_is_strin(filestr, p2->files)) {
|
2006-02-05 04:27:26 -05:00
|
|
|
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
|
2006-03-07 16:01:02 -05:00
|
|
|
if(conflict == NULL) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
|
2006-03-07 16:01:02 -05:00
|
|
|
sizeof(pmconflict_t));
|
|
|
|
continue;
|
|
|
|
}
|
2006-02-05 04:27:26 -05:00
|
|
|
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);
|
2007-01-19 04:28:44 -05:00
|
|
|
conflicts = alpm_list_add(conflicts, conflict);
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-15 19:31:21 -04:00
|
|
|
/* CHECK 2: check every target against the filesystem */
|
2005-03-22 15:21:12 -05:00
|
|
|
pmpkg_t *p = (pmpkg_t*)i->data;
|
|
|
|
pmpkg_t *dbpkg = NULL;
|
|
|
|
for(j = p->files; j; j = j->next) {
|
2005-10-07 19:29:49 -04:00
|
|
|
int isdir = 0;
|
2005-03-22 15:21:12 -05:00
|
|
|
filestr = (char*)j->data;
|
|
|
|
snprintf(path, PATH_MAX, "%s%s", root, filestr);
|
2005-10-07 19:29:49 -04:00
|
|
|
/* is this target a file or directory? */
|
|
|
|
if(path[strlen(path)-1] == '/') {
|
|
|
|
isdir = 1;
|
|
|
|
path[strlen(path)-1] = '\0';
|
|
|
|
}
|
|
|
|
if(!lstat(path, &buf)) {
|
2005-03-22 15:21:12 -05:00
|
|
|
int ok = 0;
|
2005-10-07 19:29:49 -04:00
|
|
|
/* re-fetch with stat() instead of lstat() */
|
|
|
|
stat(path, &buf);
|
|
|
|
if(S_ISDIR(buf.st_mode)) {
|
|
|
|
/* if it's a directory, then we have no conflict */
|
2005-03-22 15:21:12 -05:00
|
|
|
ok = 1;
|
2005-10-07 19:29:49 -04:00
|
|
|
} else {
|
|
|
|
if(dbpkg == NULL) {
|
2006-03-07 16:01:02 -05:00
|
|
|
dbpkg = _alpm_db_get_pkgfromcache(db, p->name);
|
|
|
|
}
|
|
|
|
if(dbpkg && !(dbpkg->infolevel & INFRQ_FILES)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg->name);
|
2006-03-07 16:01:02 -05:00
|
|
|
_alpm_db_read(db, INFRQ_FILES, dbpkg);
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2007-01-19 04:28:44 -05:00
|
|
|
if(dbpkg && alpm_list_is_strin(j->data, dbpkg->files)) {
|
2005-10-07 19:29:49 -04:00
|
|
|
ok = 1;
|
|
|
|
}
|
|
|
|
/* Make sure that the supposedly-conflicting file is not actually just
|
|
|
|
* a symlink that points to a path that used to exist in the package.
|
|
|
|
*/
|
|
|
|
/* Check if any part of the conflicting file's path is a symlink */
|
|
|
|
if(dbpkg && !ok) {
|
|
|
|
char str[PATH_MAX];
|
|
|
|
for(k = dbpkg->files; k; k = k->next) {
|
|
|
|
snprintf(str, PATH_MAX, "%s%s", root, (char*)k->data);
|
|
|
|
stat(str, &buf2);
|
|
|
|
if(buf.st_ino == buf2.st_ino) {
|
2005-03-22 15:21:12 -05:00
|
|
|
ok = 1;
|
|
|
|
}
|
2005-10-07 19:29:49 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Check if the conflicting file has been moved to another package/target */
|
|
|
|
if(!ok) {
|
|
|
|
/* Look at all the targets */
|
|
|
|
for(k = targets; k && !ok; k = k->next) {
|
|
|
|
pmpkg_t *p1 = (pmpkg_t *)k->data;
|
|
|
|
/* As long as they're not the current package */
|
|
|
|
if(strcmp(p1->name, p->name)) {
|
|
|
|
pmpkg_t *dbpkg2 = NULL;
|
2006-03-07 16:01:02 -05:00
|
|
|
dbpkg2 = _alpm_db_get_pkgfromcache(db, p1->name);
|
|
|
|
if(dbpkg2 && !(dbpkg2->infolevel & INFRQ_FILES)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg2->name);
|
2006-03-07 16:01:02 -05:00
|
|
|
_alpm_db_read(db, INFRQ_FILES, dbpkg2);
|
|
|
|
}
|
2005-10-07 19:29:49 -04:00
|
|
|
/* If it used to exist in there, but doesn't anymore */
|
2007-01-19 04:28:44 -05:00
|
|
|
if(dbpkg2 && !alpm_list_is_strin(filestr, p1->files) && alpm_list_is_strin(filestr, dbpkg2->files)) {
|
2005-10-07 19:29:49 -04:00
|
|
|
ok = 1;
|
|
|
|
/* Add to the "skip list" of files that we shouldn't remove during an upgrade.
|
|
|
|
*
|
|
|
|
* This is a workaround for the following scenario:
|
|
|
|
*
|
|
|
|
* - the old package A provides file X
|
|
|
|
* - the new package A does not
|
|
|
|
* - the new package B provides file X
|
|
|
|
* - package A depends on B, so B is upgraded first
|
|
|
|
*
|
|
|
|
* Package B is upgraded, so file X is installed. Then package A
|
|
|
|
* is upgraded, and it *removes* file X, since it no longer exists
|
|
|
|
* in package A.
|
|
|
|
*
|
|
|
|
* Our workaround is to scan through all "old" packages and all "new"
|
|
|
|
* ones, looking for files that jump to different packages.
|
|
|
|
*/
|
2007-01-19 04:28:44 -05:00
|
|
|
*skip_list = alpm_list_add(*skip_list, strdup(filestr));
|
2005-10-07 19:29:49 -04:00
|
|
|
}
|
|
|
|
}
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!ok) {
|
2006-02-05 04:27:26 -05:00
|
|
|
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
|
2006-03-07 16:01:02 -05:00
|
|
|
if(conflict == NULL) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
|
2006-03-07 16:01:02 -05:00
|
|
|
sizeof(pmconflict_t));
|
|
|
|
continue;
|
|
|
|
}
|
2006-02-05 04:27:26 -05:00
|
|
|
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;
|
2007-01-19 04:28:44 -05:00
|
|
|
conflicts = alpm_list_add(conflicts, conflict);
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return(conflicts);
|
|
|
|
}
|
|
|
|
|
2006-11-22 04:03:41 -05:00
|
|
|
const char *alpm_conflict_get_target(pmconflict_t *conflict)
|
|
|
|
{
|
|
|
|
/* Sanity checks */
|
|
|
|
ASSERT(handle != NULL, return(NULL));
|
|
|
|
ASSERT(conflict != NULL, return(NULL));
|
|
|
|
|
|
|
|
return conflict->target;
|
|
|
|
}
|
|
|
|
|
2007-01-23 22:02:53 -05:00
|
|
|
pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict)
|
2006-11-22 04:03:41 -05:00
|
|
|
{
|
|
|
|
/* Sanity checks */
|
|
|
|
ASSERT(handle != NULL, return(-1));
|
|
|
|
ASSERT(conflict != NULL, return(-1));
|
|
|
|
|
|
|
|
return conflict->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *alpm_conflict_get_file(pmconflict_t *conflict)
|
|
|
|
{
|
|
|
|
/* Sanity checks */
|
|
|
|
ASSERT(handle != NULL, return(NULL));
|
|
|
|
ASSERT(conflict != NULL, return(NULL));
|
|
|
|
|
|
|
|
return conflict->file;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict)
|
|
|
|
{
|
|
|
|
/* Sanity checks */
|
|
|
|
ASSERT(handle != NULL, return(NULL));
|
|
|
|
ASSERT(conflict != NULL, return(NULL));
|
|
|
|
|
|
|
|
return conflict->ctarget;
|
|
|
|
}
|
2005-03-22 15:21:12 -05:00
|
|
|
/* vim: set ts=2 sw=2 noet: */
|