summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2007-07-16 14:08:48 +0200
committerDan McGee <dan@archlinux.org>2007-07-16 09:21:13 -0400
commit99572ed8f6f585e5b6ee4c9300b0589b2c75c54a (patch)
tree205e4696138cade0c07a4034bc10a73a4722b5c0
parentab2354e762767e6088e43b6d1e615576701a7bdb (diff)
new pmdepend_t / pmdepmissing_t accessors.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/alpm.h13
-rw-r--r--lib/libalpm/deps.c30
-rw-r--r--src/pacman/add.c16
-rw-r--r--src/pacman/deptest.c4
-rw-r--r--src/pacman/remove.c5
-rw-r--r--src/pacman/sync.c17
6 files changed, 45 insertions, 40 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 8181f2e6..9e641f3e 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -353,12 +353,13 @@ typedef enum _pmdeptype_t {
pmdepend_t *alpm_splitdep(const char *depstring);
int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
-const char *alpm_dep_get_target(pmdepmissing_t *miss);
-pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss);
-pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
-const char *alpm_dep_get_name(pmdepmissing_t *miss);
-const char *alpm_dep_get_version(pmdepmissing_t *miss);
-const char *alpm_depend_get_name(pmdepend_t *dep);
+const char *alpm_miss_get_target(pmdepmissing_t *miss);
+pmdeptype_t alpm_miss_get_type(pmdepmissing_t *miss);
+pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
+
+pmdepmod_t alpm_dep_get_mod(pmdepend_t *dep);
+const char *alpm_dep_get_name(pmdepend_t *dep);
+const char *alpm_dep_get_version(pmdepend_t *dep);
/*
* File conflicts
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index fd0b2e5f..30c505dd 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -734,7 +734,7 @@ error:
return(-1);
}
-const char SYMEXPORT *alpm_dep_get_target(pmdepmissing_t *miss)
+const char SYMEXPORT *alpm_miss_get_target(pmdepmissing_t *miss)
{
ALPM_LOG_FUNC;
@@ -745,7 +745,7 @@ const char SYMEXPORT *alpm_dep_get_target(pmdepmissing_t *miss)
return miss->target;
}
-pmdeptype_t SYMEXPORT alpm_dep_get_type(pmdepmissing_t *miss)
+pmdeptype_t SYMEXPORT alpm_miss_get_type(pmdepmissing_t *miss)
{
ALPM_LOG_FUNC;
@@ -756,40 +756,40 @@ pmdeptype_t SYMEXPORT alpm_dep_get_type(pmdepmissing_t *miss)
return miss->type;
}
-pmdepmod_t SYMEXPORT alpm_dep_get_mod(pmdepmissing_t *miss)
+pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
{
ALPM_LOG_FUNC;
/* Sanity checks */
- ASSERT(handle != NULL, return(-1));
- ASSERT(miss != NULL, return(-1));
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(miss != NULL, return(NULL));
- return miss->depend.mod;
+ return &miss->depend;
}
-const char SYMEXPORT *alpm_dep_get_name(pmdepmissing_t *miss)
+pmdepmod_t SYMEXPORT alpm_dep_get_mod(pmdepend_t *dep)
{
ALPM_LOG_FUNC;
/* Sanity checks */
- ASSERT(handle != NULL, return(NULL));
- ASSERT(miss != NULL, return(NULL));
+ ASSERT(handle != NULL, return(-1));
+ ASSERT(dep != NULL, return(-1));
- return miss->depend.name;
+ return dep->mod;
}
-const char SYMEXPORT *alpm_dep_get_version(pmdepmissing_t *miss)
+const char SYMEXPORT *alpm_dep_get_name(pmdepend_t *dep)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
- ASSERT(miss != NULL, return(NULL));
+ ASSERT(dep != NULL, return(NULL));
- return miss->depend.version;
+ return dep->name;
}
-const char SYMEXPORT *alpm_depend_get_name(pmdepend_t *dep)
+const char SYMEXPORT *alpm_dep_get_version(pmdepend_t *dep)
{
ALPM_LOG_FUNC;
@@ -797,7 +797,7 @@ const char SYMEXPORT *alpm_depend_get_name(pmdepend_t *dep)
ASSERT(handle != NULL, return(NULL));
ASSERT(dep != NULL, return(NULL));
- return dep->name;
+ return dep->version;
}
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 71578f63..67633e9c 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -136,23 +136,24 @@ int pacman_add(alpm_list_t *targets)
case PM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
+ pmdepend_t *dep = alpm_miss_get_dep(miss);
/* TODO indicate if the error was a virtual package or not:
* :: %s: requires %s, provided by %s
*/
- printf(_(":: %s: requires %s"), alpm_dep_get_target(miss),
- alpm_dep_get_name(miss));
- switch(alpm_dep_get_mod(miss)) {
+ printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
+ alpm_dep_get_name(dep));
+ switch(alpm_dep_get_mod(dep)) {
case PM_DEP_MOD_ANY:
break;
case PM_DEP_MOD_EQ:
- printf("=%s", alpm_dep_get_version(miss));
+ printf("=%s", alpm_dep_get_version(dep));
break;
case PM_DEP_MOD_GE:
- printf(">=%s", alpm_dep_get_version(miss));
+ printf(">=%s", alpm_dep_get_version(dep));
break;
case PM_DEP_MOD_LE:
- printf("<=%s", alpm_dep_get_version(miss));
+ printf("<=%s", alpm_dep_get_version(dep));
break;
}
printf("\n");
@@ -161,8 +162,9 @@ int pacman_add(alpm_list_t *targets)
case PM_ERR_CONFLICTING_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
+ pmdepend_t *dep = alpm_miss_get_dep(miss);
printf(_(":: %s: conflicts with %s"),
- alpm_dep_get_target(miss), alpm_dep_get_name(miss));
+ alpm_miss_get_target(miss), alpm_dep_get_name(dep));
}
break;
case PM_ERR_FILE_CONFLICTS:
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 0f149b28..7f89f6d2 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -56,13 +56,13 @@ int pacman_deptest(alpm_list_t *targets)
dep = alpm_splitdep(target);
pkg = alpm_db_get_pkg(alpm_option_get_localdb(),
- alpm_depend_get_name(dep));
+ alpm_dep_get_name(dep));
if(pkg && alpm_depcmp(pkg, dep)) {
found = 1;
} else {
/* not found, can we find anything that provides this in the local DB? */
provides = alpm_db_whatprovides(alpm_option_get_localdb(),
- alpm_depend_get_name(dep));
+ alpm_dep_get_name(dep));
for(j = provides; j; j = alpm_list_next(j)) {
pmpkg_t *pkg;
pkg = alpm_list_getdata(j);
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 0b6b4ce2..e60d3e8c 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -128,8 +128,9 @@ int pacman_remove(alpm_list_t *targets)
case PM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
- printf(_(":: %s depends on %s\n"), alpm_dep_get_target(miss),
- alpm_dep_get_name(miss));
+ pmdepend_t *dep = alpm_miss_get_dep(miss);
+ printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
+ alpm_dep_get_name(dep));
}
alpm_list_free(data);
break;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 77293709..800738d3 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -650,19 +650,20 @@ int pacman_sync(alpm_list_t *targets)
case PM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
- printf(_(":: %s depends on %s\n"), alpm_dep_get_target(miss),
- alpm_dep_get_name(miss));
- switch(alpm_dep_get_mod(miss)) {
+ pmdepend_t *dep = alpm_miss_get_dep(miss);
+ printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
+ alpm_dep_get_name(dep));
+ switch(alpm_dep_get_mod(dep)) {
case PM_DEP_MOD_ANY:
break;
case PM_DEP_MOD_EQ:
- printf("=%s", alpm_dep_get_version(miss));
+ printf("=%s", alpm_dep_get_version(dep));
break;
case PM_DEP_MOD_GE:
- printf(">=%s", alpm_dep_get_version(miss));
+ printf(">=%s", alpm_dep_get_version(dep));
break;
case PM_DEP_MOD_LE:
- printf("<=%s", alpm_dep_get_version(miss));
+ printf("<=%s", alpm_dep_get_version(dep));
break;
}
printf("\n");
@@ -671,9 +672,9 @@ int pacman_sync(alpm_list_t *targets)
case PM_ERR_CONFLICTING_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
-
+ pmdepend_t *dep = alpm_miss_get_dep(miss);
printf(_(":: %s: conflicts with %s"),
- alpm_dep_get_target(miss), alpm_dep_get_name(miss));
+ alpm_miss_get_target(miss), alpm_dep_get_name(dep));
}
break;
default: