Add the pmconflict_t type.
pmdepmissing_t was used for two totally different things : missing dependencies, and dependency conflicts. So this patch simply adds a type for dep conflicts, and convert the code to use it. This fix the TODO in conflict.c : /* TODO WTF is a 'depmissing' doing indicating a conflict? */ Additionally, the code in conflict.c now eliminates the duplicated conflicts. If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored. However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too. This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot). Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
parent
65fb99133d
commit
2aa7e69da9
9 changed files with 122 additions and 82 deletions
|
@ -163,10 +163,10 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||||
_alpm_log(PM_LOG_DEBUG, "looking for conflicts\n");
|
_alpm_log(PM_LOG_DEBUG, "looking for conflicts\n");
|
||||||
lp = _alpm_checkconflicts(db, trans->packages);
|
lp = _alpm_checkconflicts(db, trans->packages);
|
||||||
for(i = lp; i; i = i->next) {
|
for(i = lp; i; i = i->next) {
|
||||||
pmdepmissing_t *miss = i->data;
|
pmconflict_t *conflict = i->data;
|
||||||
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("replacing packages with -A and -U is not supported yet\n"));
|
_alpm_log(PM_LOG_ERROR, _("replacing packages with -A and -U is not supported yet\n"));
|
||||||
_alpm_log(PM_LOG_ERROR, _("please remove '%s' first, using -Rd\n"), miss->depend.name);
|
_alpm_log(PM_LOG_ERROR, _("please remove '%s' first, using -Rd\n"), conflict->package2);
|
||||||
RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
|
RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
|
||||||
|
|
||||||
/* Attempt to resolve conflicts */
|
/* Attempt to resolve conflicts */
|
||||||
|
|
|
@ -52,6 +52,7 @@ typedef struct __pmtrans_t pmtrans_t;
|
||||||
typedef struct __pmsyncpkg_t pmsyncpkg_t;
|
typedef struct __pmsyncpkg_t pmsyncpkg_t;
|
||||||
typedef struct __pmdepend_t pmdepend_t;
|
typedef struct __pmdepend_t pmdepend_t;
|
||||||
typedef struct __pmdepmissing_t pmdepmissing_t;
|
typedef struct __pmdepmissing_t pmdepmissing_t;
|
||||||
|
typedef struct __pmconflict_t pmconflict_t;
|
||||||
typedef struct __pmfileconflict_t pmfileconflict_t;
|
typedef struct __pmfileconflict_t pmfileconflict_t;
|
||||||
typedef struct __pmgraph_t pmgraph_t;
|
typedef struct __pmgraph_t pmgraph_t;
|
||||||
|
|
||||||
|
@ -367,20 +368,17 @@ typedef enum _pmdepmod_t {
|
||||||
PM_DEP_MOD_LE
|
PM_DEP_MOD_LE
|
||||||
} pmdepmod_t;
|
} pmdepmod_t;
|
||||||
|
|
||||||
typedef enum _pmdeptype_t {
|
|
||||||
PM_DEP_TYPE_DEPEND = 1,
|
|
||||||
PM_DEP_TYPE_CONFLICT
|
|
||||||
} pmdeptype_t;
|
|
||||||
|
|
||||||
pmdepend_t *alpm_splitdep(const char *depstring);
|
pmdepend_t *alpm_splitdep(const char *depstring);
|
||||||
int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
||||||
alpm_list_t *alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
alpm_list_t *alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
||||||
alpm_list_t *packages);
|
alpm_list_t *packages);
|
||||||
|
|
||||||
const char *alpm_miss_get_target(const pmdepmissing_t *miss);
|
const char *alpm_miss_get_target(const pmdepmissing_t *miss);
|
||||||
pmdeptype_t alpm_miss_get_type(const pmdepmissing_t *miss);
|
|
||||||
pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
|
pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
|
||||||
|
|
||||||
|
const char *alpm_conflict_get_package1(pmconflict_t *conflict);
|
||||||
|
const char *alpm_conflict_get_package2(pmconflict_t *conflict);
|
||||||
|
|
||||||
pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep);
|
pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep);
|
||||||
const char *alpm_dep_get_name(const pmdepend_t *dep);
|
const char *alpm_dep_get_name(const pmdepend_t *dep);
|
||||||
const char *alpm_dep_get_version(const pmdepend_t *dep);
|
const char *alpm_dep_get_version(const pmdepend_t *dep);
|
||||||
|
|
|
@ -43,6 +43,40 @@
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "deps.h"
|
#include "deps.h"
|
||||||
|
|
||||||
|
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2)
|
||||||
|
{
|
||||||
|
pmconflict_t *conflict;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
MALLOC(conflict, sizeof(pmconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
|
strncpy(conflict->package1, package1, PKG_NAME_LEN);
|
||||||
|
strncpy(conflict->package2, package2, PKG_NAME_LEN);
|
||||||
|
|
||||||
|
return(conflict);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
for(i = haystack; i; i = i->next) {
|
||||||
|
pmconflict_t *conflict = i->data;
|
||||||
|
char *cpkg1 = conflict->package1;
|
||||||
|
char *cpkg2 = conflict->package2;
|
||||||
|
char *npkg1 = needle->package1;
|
||||||
|
char *npkg2 = needle->package2;
|
||||||
|
if((!strcmp(cpkg1, npkg1) && !strcmp(cpkg2, npkg2))
|
||||||
|
|| (!strcmp(cpkg1, npkg2) && !strcmp(cpkg2, npkg1))) {
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/** Check if pkg1 conflicts with pkg2
|
/** Check if pkg1 conflicts with pkg2
|
||||||
* @param pkg1 package we are looking at
|
* @param pkg1 package we are looking at
|
||||||
|
@ -71,16 +105,14 @@ static int does_conflict(pmpkg_t *pkg1, const char *conflict, pmpkg_t *pkg2)
|
||||||
* @param pkg1 first package
|
* @param pkg1 first package
|
||||||
* @param pkg2 package causing conflict
|
* @param pkg2 package causing conflict
|
||||||
*/
|
*/
|
||||||
/* TODO WTF is a 'depmissing' doing indicating a conflict? */
|
|
||||||
static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
|
static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
|
||||||
const char *pkg2)
|
const char *pkg2)
|
||||||
{
|
{
|
||||||
pmdepmissing_t *miss = _alpm_depmiss_new(pkg1, PM_DEP_TYPE_CONFLICT,
|
pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2);
|
||||||
PM_DEP_MOD_ANY, pkg2, NULL);
|
if(conflict && !_alpm_conflict_isin(conflict, *baddeps)) {
|
||||||
if(miss && !_alpm_depmiss_isin(miss, *baddeps)) {
|
*baddeps = alpm_list_add(*baddeps, conflict);
|
||||||
*baddeps = alpm_list_add(*baddeps, miss);
|
|
||||||
} else {
|
} else {
|
||||||
FREE(miss);
|
FREE(conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +162,7 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a alpm_list_t* of pmdepmissing_t pointers. */
|
/* Returns a alpm_list_t* of pmconflict_t pointers. */
|
||||||
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages)
|
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages)
|
||||||
{
|
{
|
||||||
alpm_list_t *baddeps = NULL;
|
alpm_list_t *baddeps = NULL;
|
||||||
|
@ -418,6 +450,28 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *roo
|
||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_conflict_get_package1(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(conflict != NULL, return(NULL));
|
||||||
|
|
||||||
|
return conflict->package1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(conflict != NULL, return(NULL));
|
||||||
|
|
||||||
|
return conflict->package2;
|
||||||
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
|
const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
|
|
||||||
#define CONFLICT_FILE_LEN 512
|
#define CONFLICT_FILE_LEN 512
|
||||||
|
|
||||||
|
struct __pmconflict_t {
|
||||||
|
char package1[PKG_NAME_LEN];
|
||||||
|
char package2[PKG_NAME_LEN];
|
||||||
|
};
|
||||||
|
|
||||||
struct __pmfileconflict_t {
|
struct __pmfileconflict_t {
|
||||||
char target[PKG_NAME_LEN];
|
char target[PKG_NAME_LEN];
|
||||||
pmfileconflicttype_t type;
|
pmfileconflicttype_t type;
|
||||||
|
@ -34,6 +39,8 @@ struct __pmfileconflict_t {
|
||||||
char ctarget[PKG_NAME_LEN];
|
char ctarget[PKG_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2);
|
||||||
|
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack);
|
||||||
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
|
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
|
||||||
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root);
|
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root);
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,8 @@ static void _alpm_graph_free(void *data)
|
||||||
free(graph);
|
free(graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
|
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod,
|
||||||
pmdepmod_t depmod, const char *depname,
|
const char *depname, const char *depversion)
|
||||||
const char *depversion)
|
|
||||||
{
|
{
|
||||||
pmdepmissing_t *miss;
|
pmdepmissing_t *miss;
|
||||||
|
|
||||||
|
@ -72,7 +71,6 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
|
||||||
MALLOC(miss, sizeof(pmdepmissing_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(miss, sizeof(pmdepmissing_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
|
|
||||||
strncpy(miss->target, target, PKG_NAME_LEN);
|
strncpy(miss->target, target, PKG_NAME_LEN);
|
||||||
miss->type = type;
|
|
||||||
miss->depend.mod = depmod;
|
miss->depend.mod = depmod;
|
||||||
strncpy(miss->depend.name, depname, PKG_NAME_LEN);
|
strncpy(miss->depend.name, depname, PKG_NAME_LEN);
|
||||||
if(depversion) {
|
if(depversion) {
|
||||||
|
@ -92,8 +90,7 @@ int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack)
|
||||||
|
|
||||||
for(i = haystack; i; i = i->next) {
|
for(i = haystack; i; i = i->next) {
|
||||||
pmdepmissing_t *miss = i->data;
|
pmdepmissing_t *miss = i->data;
|
||||||
if(needle->type == miss->type &&
|
if(!strcmp(needle->target, miss->target) &&
|
||||||
!strcmp(needle->target, miss->target) &&
|
|
||||||
needle->depend.mod == miss->depend.mod &&
|
needle->depend.mod == miss->depend.mod &&
|
||||||
!strcmp(needle->depend.name, miss->depend.name) &&
|
!strcmp(needle->depend.name, miss->depend.name) &&
|
||||||
!strcmp(needle->depend.version, miss->depend.version)) {
|
!strcmp(needle->depend.version, miss->depend.version)) {
|
||||||
|
@ -328,8 +325,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
||||||
if(!satisfied) {
|
if(!satisfied) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkdeps: updated '%s' won't satisfy a dependency of '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: updated '%s' won't satisfy a dependency of '%s'\n",
|
||||||
alpm_pkg_get_name(oldpkg), alpm_pkg_get_name(p));
|
alpm_pkg_get_name(oldpkg), alpm_pkg_get_name(p));
|
||||||
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_DEPEND, depend->mod,
|
miss = _alpm_depmiss_new(p->name, depend->mod, depend->name, depend->version);
|
||||||
depend->name, depend->version);
|
|
||||||
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
} else {
|
} else {
|
||||||
|
@ -375,7 +371,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
||||||
if(!found) {
|
if(!found) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "missing dependency '%s' for package '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "missing dependency '%s' for package '%s'\n",
|
||||||
(char*)j->data, alpm_pkg_get_name(tp));
|
(char*)j->data, alpm_pkg_get_name(tp));
|
||||||
miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), PM_DEP_TYPE_DEPEND, depend->mod,
|
miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), depend->mod,
|
||||||
depend->name, depend->version);
|
depend->name, depend->version);
|
||||||
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
|
@ -430,8 +426,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s which requires %s\n",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s which requires %s\n",
|
||||||
alpm_pkg_get_name(p), alpm_pkg_get_name(rmpkg));
|
alpm_pkg_get_name(p), alpm_pkg_get_name(rmpkg));
|
||||||
miss = _alpm_depmiss_new(alpm_pkg_get_name(p),
|
miss = _alpm_depmiss_new(alpm_pkg_get_name(p),
|
||||||
PM_DEP_TYPE_DEPEND, depend->mod, depend->name,
|
depend->mod, depend->name, depend->version);
|
||||||
depend->version);
|
|
||||||
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
} else {
|
} else {
|
||||||
|
@ -765,16 +760,6 @@ const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
|
||||||
return miss->target;
|
return miss->target;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdeptype_t SYMEXPORT alpm_miss_get_type(const pmdepmissing_t *miss)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(miss != NULL, return(-1));
|
|
||||||
|
|
||||||
return miss->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
|
pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
|
@ -38,7 +38,6 @@ struct __pmdepend_t {
|
||||||
/* Missing dependency */
|
/* Missing dependency */
|
||||||
struct __pmdepmissing_t {
|
struct __pmdepmissing_t {
|
||||||
char target[PKG_NAME_LEN];
|
char target[PKG_NAME_LEN];
|
||||||
pmdeptype_t type;
|
|
||||||
pmdepend_t depend;
|
pmdepend_t depend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,9 +50,8 @@ struct __pmgraph_t {
|
||||||
alpm_list_t *childptr; /* points to a child in children list */
|
alpm_list_t *childptr; /* points to a child in children list */
|
||||||
};
|
};
|
||||||
|
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
|
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod,
|
||||||
pmdepmod_t depmod, const char *depname,
|
const char *depname, const char *depversion);
|
||||||
const char *depversion);
|
|
||||||
int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack);
|
int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack);
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode);
|
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode);
|
||||||
alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
|
||||||
|
|
|
@ -464,18 +464,18 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
alpm_list_t *asked = NULL;
|
alpm_list_t *asked = NULL;
|
||||||
|
|
||||||
for(i = deps; i && !errorout; i = i->next) {
|
for(i = deps; i && !errorout; i = i->next) {
|
||||||
pmdepmissing_t *miss = i->data;
|
pmconflict_t *conflict = i->data;
|
||||||
pmsyncpkg_t *sync;
|
pmsyncpkg_t *sync;
|
||||||
pmpkg_t *found = NULL;
|
pmpkg_t *found = NULL;
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "package '%s' conflicts with '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "package '%s' conflicts with '%s'\n",
|
||||||
miss->target, miss->depend.name);
|
conflict->package1, conflict->package2);
|
||||||
/* check if the conflicting package is about to be removed/replaced.
|
/* check if the conflicting package is about to be removed/replaced.
|
||||||
* if so, then just ignore it. */
|
* if so, then just ignore it. */
|
||||||
for(j = trans->packages; j && !found; j = j->next) {
|
for(j = trans->packages; j && !found; j = j->next) {
|
||||||
sync = j->data;
|
sync = j->data;
|
||||||
if(sync->type == PM_SYNC_TYPE_REPLACE) {
|
if(sync->type == PM_SYNC_TYPE_REPLACE) {
|
||||||
found = _alpm_pkg_find(miss->depend.name, sync->data);
|
found = _alpm_pkg_find(conflict->package2, sync->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(found) {
|
if(found) {
|
||||||
|
@ -484,24 +484,24 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync = _alpm_sync_find(trans->packages, miss->target);
|
sync = _alpm_sync_find(trans->packages, conflict->package1);
|
||||||
if(sync == NULL) {
|
if(sync == NULL) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "'%s' not found in transaction set -- skipping\n",
|
_alpm_log(PM_LOG_DEBUG, "'%s' not found in transaction set -- skipping\n",
|
||||||
miss->target);
|
conflict->package1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pmpkg_t *local = _alpm_db_get_pkgfromcache(db_local, miss->depend.name);
|
pmpkg_t *local = _alpm_db_get_pkgfromcache(db_local, conflict->package2);
|
||||||
/* check if this package provides the package it's conflicting with */
|
/* check if this package provides the package it's conflicting with */
|
||||||
if(alpm_list_find_str(alpm_pkg_get_provides(sync->pkg),
|
if(alpm_list_find_str(alpm_pkg_get_provides(sync->pkg),
|
||||||
miss->depend.name)) {
|
conflict->package2)) {
|
||||||
/* treat like a replaces item so requiredby fields are
|
/* treat like a replaces item so requiredby fields are
|
||||||
* inherited properly. */
|
* inherited properly. */
|
||||||
_alpm_log(PM_LOG_DEBUG, "package '%s' provides its own conflict\n",
|
_alpm_log(PM_LOG_DEBUG, "package '%s' provides its own conflict\n",
|
||||||
miss->target);
|
conflict->package1);
|
||||||
if(!local) {
|
if(!local) {
|
||||||
char *rmpkg = NULL;
|
char *rmpkg = NULL;
|
||||||
int target, depend;
|
int target, depend;
|
||||||
/* hmmm, depend.name isn't installed, so it must be conflicting
|
/* hmmm, package2 isn't installed, so it must be conflicting
|
||||||
* with another package in our final list. For example:
|
* with another package in our final list. For example:
|
||||||
*
|
*
|
||||||
* pacman -S blackbox xfree86
|
* pacman -S blackbox xfree86
|
||||||
|
@ -514,22 +514,22 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
|
|
||||||
/* figure out which one was requested in targets. If they both
|
/* figure out which one was requested in targets. If they both
|
||||||
* were, then it's still an unresolvable conflict. */
|
* were, then it's still an unresolvable conflict. */
|
||||||
target = alpm_list_find_str(trans->targets, miss->target);
|
target = alpm_list_find_str(trans->targets, conflict->package1);
|
||||||
depend = alpm_list_find_str(trans->targets, miss->depend.name);
|
depend = alpm_list_find_str(trans->targets, conflict->package2);
|
||||||
if(depend && !target) {
|
if(depend && !target) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it\n",
|
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it\n",
|
||||||
miss->depend.name);
|
conflict->package2);
|
||||||
/* remove miss->target */
|
/* remove conflict->package1 */
|
||||||
rmpkg = miss->target;
|
rmpkg = conflict->package1;
|
||||||
} else if(target && !depend) {
|
} else if(target && !depend) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it\n",
|
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it\n",
|
||||||
miss->target);
|
conflict->package1);
|
||||||
/* remove miss->depend.name */
|
/* remove conflict->package2 */
|
||||||
rmpkg = miss->depend.name;
|
rmpkg = conflict->package2;
|
||||||
} else {
|
} else {
|
||||||
/* miss->depend.name is not needed, miss->target already provides
|
/* miss->target2 is not needed, miss->target already provides
|
||||||
* it, let's resolve the conflict */
|
* it, let's resolve the conflict */
|
||||||
rmpkg = miss->depend.name;
|
rmpkg = conflict->package2;
|
||||||
}
|
}
|
||||||
if(rmpkg) {
|
if(rmpkg) {
|
||||||
pmsyncpkg_t *rsync = _alpm_sync_find(trans->packages, rmpkg);
|
pmsyncpkg_t *rsync = _alpm_sync_find(trans->packages, rmpkg);
|
||||||
|
@ -545,13 +545,13 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
}
|
}
|
||||||
/* It's a conflict -- see if they want to remove it */
|
/* It's a conflict -- see if they want to remove it */
|
||||||
_alpm_log(PM_LOG_DEBUG, "resolving package '%s' conflict\n",
|
_alpm_log(PM_LOG_DEBUG, "resolving package '%s' conflict\n",
|
||||||
miss->target);
|
conflict->package1);
|
||||||
if(local) {
|
if(local) {
|
||||||
int doremove = 0;
|
int doremove = 0;
|
||||||
if(!alpm_list_find_str(asked, miss->depend.name)) {
|
if(!alpm_list_find_str(asked, conflict->package2)) {
|
||||||
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target,
|
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, conflict->package1,
|
||||||
miss->depend.name, NULL, &doremove);
|
conflict->package2, NULL, &doremove);
|
||||||
asked = alpm_list_add(asked, strdup(miss->depend.name));
|
asked = alpm_list_add(asked, strdup(conflict->package2));
|
||||||
if(doremove) {
|
if(doremove) {
|
||||||
pmpkg_t *q = _alpm_pkg_dup(local);
|
pmpkg_t *q = _alpm_pkg_dup(local);
|
||||||
if(sync->type != PM_SYNC_TYPE_REPLACE) {
|
if(sync->type != PM_SYNC_TYPE_REPLACE) {
|
||||||
|
@ -562,16 +562,16 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
}
|
}
|
||||||
/* append to the replaces list */
|
/* append to the replaces list */
|
||||||
_alpm_log(PM_LOG_DEBUG, "electing '%s' for removal\n",
|
_alpm_log(PM_LOG_DEBUG, "electing '%s' for removal\n",
|
||||||
miss->depend.name);
|
conflict->package2);
|
||||||
sync->data = alpm_list_add(sync->data, q);
|
sync->data = alpm_list_add(sync->data, q);
|
||||||
/* see if the package is in the current target list */
|
/* see if the package is in the current target list */
|
||||||
pmsyncpkg_t *rsync = _alpm_sync_find(trans->packages,
|
pmsyncpkg_t *rsync = _alpm_sync_find(trans->packages,
|
||||||
miss->depend.name);
|
conflict->package2);
|
||||||
if(rsync) {
|
if(rsync) {
|
||||||
/* remove it from the target list */
|
/* remove it from the target list */
|
||||||
void *vpkg;
|
void *vpkg;
|
||||||
_alpm_log(PM_LOG_DEBUG, "removing '%s' from target list\n",
|
_alpm_log(PM_LOG_DEBUG, "removing '%s' from target list\n",
|
||||||
miss->depend.name);
|
conflict->package2);
|
||||||
trans->packages = alpm_list_remove(trans->packages, rsync,
|
trans->packages = alpm_list_remove(trans->packages, rsync,
|
||||||
syncpkg_cmp, &vpkg);
|
syncpkg_cmp, &vpkg);
|
||||||
_alpm_sync_free(vpkg);
|
_alpm_sync_free(vpkg);
|
||||||
|
@ -581,15 +581,15 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
||||||
errorout = 1;
|
errorout = 1;
|
||||||
if(data) {
|
if(data) {
|
||||||
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
|
if((conflict = malloc(sizeof(pmconflict_t))) == NULL) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t));
|
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmconflict_t));
|
||||||
FREELIST(*data);
|
FREELIST(*data);
|
||||||
pm_errno = PM_ERR_MEMORY;
|
pm_errno = PM_ERR_MEMORY;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
*miss = *(pmdepmissing_t *)i->data;
|
*conflict = *(pmconflict_t *)i->data;
|
||||||
*data = alpm_list_add(*data, miss);
|
*data = alpm_list_add(*data, conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,15 +597,15 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
||||||
errorout = 1;
|
errorout = 1;
|
||||||
if(data) {
|
if(data) {
|
||||||
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
|
if((conflict = malloc(sizeof(pmconflict_t))) == NULL) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t));
|
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmconflict_t));
|
||||||
FREELIST(*data);
|
FREELIST(*data);
|
||||||
pm_errno = PM_ERR_MEMORY;
|
pm_errno = PM_ERR_MEMORY;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
*miss = *(pmdepmissing_t *)i->data;
|
*conflict = *(pmconflict_t *)i->data;
|
||||||
*data = alpm_list_add(*data, miss);
|
*data = alpm_list_add(*data, conflict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,10 +147,9 @@ int pacman_add(alpm_list_t *targets)
|
||||||
break;
|
break;
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case PM_ERR_CONFLICTING_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmconflict_t *conflict = alpm_list_getdata(i);
|
||||||
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
|
||||||
printf(_(":: %s: conflicts with %s"),
|
printf(_(":: %s: conflicts with %s"),
|
||||||
alpm_miss_get_target(miss), alpm_dep_get_name(dep));
|
alpm_conflict_get_package1(conflict), alpm_conflict_get_package2(conflict));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
|
|
|
@ -620,10 +620,9 @@ int sync_trans(alpm_list_t *targets, int sync_only)
|
||||||
break;
|
break;
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case PM_ERR_CONFLICTING_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmconflict_t *conflict = alpm_list_getdata(i);
|
||||||
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
|
||||||
printf(_(":: %s: conflicts with %s"),
|
printf(_(":: %s: conflicts with %s"),
|
||||||
alpm_miss_get_target(miss), alpm_dep_get_name(dep));
|
alpm_conflict_get_package1(conflict), alpm_conflict_get_package2(conflict));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue