summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2007-10-25 02:31:28 +0200
committerDan McGee <dan@archlinux.org>2007-10-25 07:10:08 -0500
commit0cff7c6bdf5461c3286edc940aabb88d63345381 (patch)
tree18f5a1febd6c25155c2680e77767b62634b50bf9 /src/pacman
parent89ac8aa9c45486aa4f4b9599bb094f1d54ff1b66 (diff)
Add alpm_dep_get_string method
Public alpm_dep_get_string function is introduced, which converts a pmdepend_t structure to printable string in %DEPENDS% format. This function is now used in pacman to print dependency error messages. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/add.c18
-rw-r--r--src/pacman/remove.c4
-rw-r--r--src/pacman/sync.c18
3 files changed, 9 insertions, 31 deletions
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 0b59a236..f883a6bd 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -137,26 +137,14 @@ int pacman_add(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
+ char *depstring = alpm_dep_get_string(dep);
/* TODO indicate if the error was a virtual package or not:
* :: %s: requires %s, provided by %s
*/
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(dep));
- break;
- case PM_DEP_MOD_GE:
- printf(">=%s", alpm_dep_get_version(dep));
- break;
- case PM_DEP_MOD_LE:
- printf("<=%s", alpm_dep_get_version(dep));
- break;
- }
- printf("\n");
+ depstring);
+ free(depstring);
}
break;
case PM_ERR_CONFLICTING_DEPS:
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 860bf491..dce479ec 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -129,8 +129,10 @@ int pacman_remove(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
+ char *depstring = alpm_dep_get_string(dep);
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
- alpm_dep_get_name(dep));
+ depstring);
+ free(depstring);
}
alpm_list_free(data);
break;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 30834a10..9e4b0ada 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -559,22 +559,10 @@ int sync_trans(alpm_list_t *targets, int sync_only)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
+ char *depstring = alpm_dep_get_string(dep);
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(dep));
- break;
- case PM_DEP_MOD_GE:
- printf(">=%s", alpm_dep_get_version(dep));
- break;
- case PM_DEP_MOD_LE:
- printf("<=%s", alpm_dep_get_version(dep));
- break;
- }
- printf("\n");
+ depstring);
+ free(depstring);
}
break;
case PM_ERR_CONFLICTING_DEPS: