diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/package.c | 34 | ||||
-rw-r--r-- | src/pacman/sync.c | 7 |
2 files changed, 25 insertions, 16 deletions
diff --git a/src/pacman/package.c b/src/pacman/package.c index 8c101851..7fe33a9f 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -37,6 +37,22 @@ #define CLBUF_SIZE 4096 +/** Turn a depends list into a text list. + * @param deps a list with items of type alpm_depend_t + * @return a string list, must be freed + */ +static void deplist_display(const char *title, + alpm_list_t *deps) +{ + alpm_list_t *i, *text = NULL; + for(i = deps; i; i = alpm_list_next(i)) { + alpm_depend_t *dep = alpm_list_getdata(i); + text = alpm_list_add(text, alpm_dep_compute_string(dep)); + } + list_display(title, text); + FREELIST(text); +} + /** * Display the details of a package. * Extra information entails 'required by' info for sync packages and backup @@ -52,8 +68,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra) char bdatestr[50] = "", idatestr[50] = ""; const char *label; double size; - const alpm_list_t *i; - alpm_list_t *requiredby = NULL, *depstrings = NULL; + alpm_list_t *requiredby = NULL; if(pkg == NULL) { return; @@ -81,12 +96,6 @@ void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra) break; } - /* turn depends list into a text list */ - for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) { - alpm_depend_t *dep = (alpm_depend_t *)alpm_list_getdata(i); - depstrings = alpm_list_add(depstrings, alpm_dep_compute_string(dep)); - } - if(extra || from == PKG_FROM_LOCALDB) { /* compute this here so we don't get a pause in the middle of output */ requiredby = alpm_pkg_compute_requiredby(pkg); @@ -102,14 +111,14 @@ void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra) string_display(_("URL :"), alpm_pkg_get_url(pkg)); list_display(_("Licenses :"), alpm_pkg_get_licenses(pkg)); list_display(_("Groups :"), alpm_pkg_get_groups(pkg)); - list_display(_("Provides :"), alpm_pkg_get_provides(pkg)); - list_display(_("Depends On :"), depstrings); + deplist_display(_("Provides :"), alpm_pkg_get_provides(pkg)); + deplist_display(_("Depends On :"), alpm_pkg_get_depends(pkg)); list_display_linebreak(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); if(extra || from == PKG_FROM_LOCALDB) { list_display(_("Required By :"), requiredby); } - list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); - list_display(_("Replaces :"), alpm_pkg_get_replaces(pkg)); + deplist_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); + deplist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg)); size = humanize_size(alpm_pkg_get_size(pkg), 'K', 1, &label); if(from == PKG_FROM_SYNCDB) { @@ -162,7 +171,6 @@ void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra) /* final newline to separate packages */ printf("\n"); - FREELIST(depstrings); FREELIST(requiredby); } diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 7b50d805..ea32a264 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -779,13 +779,14 @@ int sync_prepare_execute(void) for(i = data; i; i = alpm_list_next(i)) { alpm_conflict_t *conflict = alpm_list_getdata(i); /* only print reason if it contains new information */ - if(strcmp(conflict->package1, conflict->reason) == 0 || - strcmp(conflict->package2, conflict->reason) == 0) { + if(conflict->reason->mod == ALPM_DEP_MOD_ANY) { printf(_(":: %s and %s are in conflict\n"), conflict->package1, conflict->package2); } else { + char *reason = alpm_dep_compute_string(conflict->reason); printf(_(":: %s and %s are in conflict (%s)\n"), - conflict->package1, conflict->package2, conflict->reason); + conflict->package1, conflict->package2, reason); + free(reason); } } break; |