summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/deps.c
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2007-11-18 14:25:43 +0100
committerDan McGee <dan@archlinux.org>2007-11-18 19:42:39 +0100
commit2aa7e69da91c1d7a18473cf05df98c92bd1dc747 (patch)
tree1bec8c7ecd1fa012522d2bc311ecefb0f45e1d3b /lib/libalpm/deps.c
parent65fb99133df10143e07c237f04777e01b443c037 (diff)
downloadpacman-2aa7e69da91c1d7a18473cf05df98c92bd1dc747.tar.gz
pacman-2aa7e69da91c1d7a18473cf05df98c92bd1dc747.tar.xz
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>
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r--lib/libalpm/deps.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 6aaf4bd8..5d88c37d 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -61,9 +61,8 @@ static void _alpm_graph_free(void *data)
free(graph);
}
-pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
- pmdepmod_t depmod, const char *depname,
- const char *depversion)
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod,
+ const char *depname, const char *depversion)
{
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));
strncpy(miss->target, target, PKG_NAME_LEN);
- miss->type = type;
miss->depend.mod = depmod;
strncpy(miss->depend.name, depname, PKG_NAME_LEN);
if(depversion) {
@@ -92,8 +90,7 @@ int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack)
for(i = haystack; i; i = i->next) {
pmdepmissing_t *miss = i->data;
- if(needle->type == miss->type &&
- !strcmp(needle->target, miss->target) &&
+ if(!strcmp(needle->target, miss->target) &&
needle->depend.mod == miss->depend.mod &&
!strcmp(needle->depend.name, miss->depend.name) &&
!strcmp(needle->depend.version, miss->depend.version)) {
@@ -328,8 +325,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
if(!satisfied) {
_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));
- miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_DEPEND, depend->mod,
- depend->name, depend->version);
+ miss = _alpm_depmiss_new(p->name, depend->mod, depend->name, depend->version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -375,8 +371,8 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
if(!found) {
_alpm_log(PM_LOG_DEBUG, "missing dependency '%s' for package '%s'\n",
(char*)j->data, alpm_pkg_get_name(tp));
- miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), PM_DEP_TYPE_DEPEND, depend->mod,
- depend->name, depend->version);
+ miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), depend->mod,
+ depend->name, depend->version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -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_pkg_get_name(p), alpm_pkg_get_name(rmpkg));
miss = _alpm_depmiss_new(alpm_pkg_get_name(p),
- PM_DEP_TYPE_DEPEND, depend->mod, depend->name,
- depend->version);
+ depend->mod, depend->name, depend->version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -765,16 +760,6 @@ const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
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)
{
ALPM_LOG_FUNC;