mirror of
https://github.com/moparisthebest/pacman
synced 2024-10-31 15:45:03 -04:00
pacman : smarter optdepends handling.
During an upgrade, only the new optdepends will be displayed, to only keep the useful information and not clutter pacman output too much. The whole optdepends list is always available with -Si / -Qi. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a06d0de104
commit
9dbe5c9d1e
@ -203,7 +203,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
|
||||
(char *)alpm_pkg_get_name(data1),
|
||||
(char *)alpm_pkg_get_version(data2),
|
||||
(char *)alpm_pkg_get_version(data1));
|
||||
display_optdepends(data1);
|
||||
display_new_optdepends(data2,data1);
|
||||
break;
|
||||
case PM_TRANS_EVT_INTEGRITY_START:
|
||||
printf(_("checking package integrity...\n"));
|
||||
|
@ -609,6 +609,25 @@ void display_synctargets(const alpm_list_t *syncpkgs)
|
||||
alpm_list_free(rpkglist);
|
||||
}
|
||||
|
||||
/* Helper function for comparing strings using the
|
||||
* alpm "compare func" signature */
|
||||
int str_cmp(const void *s1, const void *s2)
|
||||
{
|
||||
return(strcmp(s1, s2));
|
||||
}
|
||||
|
||||
void display_new_optdepends(pmpkg_t *oldpkg, pmpkg_t *newpkg)
|
||||
{
|
||||
alpm_list_t *old = alpm_pkg_get_optdepends(oldpkg);
|
||||
alpm_list_t *new = alpm_pkg_get_optdepends(newpkg);
|
||||
alpm_list_t *optdeps = alpm_list_diff(new,old,str_cmp);
|
||||
if(optdeps) {
|
||||
printf(_("New optional dependencies for %s\n"), alpm_pkg_get_name(newpkg));
|
||||
list_display_linebreak(" ", optdeps);
|
||||
}
|
||||
alpm_list_free(optdeps);
|
||||
}
|
||||
|
||||
void display_optdepends(pmpkg_t *pkg)
|
||||
{
|
||||
alpm_list_t *optdeps = alpm_pkg_get_optdepends(pkg);
|
||||
|
@ -54,6 +54,7 @@ void list_display(const char *title, const alpm_list_t *list);
|
||||
void list_display_linebreak(const char *title, const alpm_list_t *list);
|
||||
void display_targets(const alpm_list_t *pkgs, int install);
|
||||
void display_synctargets(const alpm_list_t *syncpkgs);
|
||||
void display_new_optdepends(pmpkg_t *oldpkg, pmpkg_t *newpkg);
|
||||
void display_optdepends(pmpkg_t *pkg);
|
||||
int yesno(char *fmt, ...);
|
||||
int noyes(char *fmt, ...);
|
||||
|
Loading…
Reference in New Issue
Block a user