[pacman-dev] [PATCH] Mark already installed optional dependencies

Dave Reisner d at falconindy.com
Sun Apr 15 10:39:55 EDT 2012


On Sun, Apr 15, 2012 at 04:17:52PM +0200, Arokux B. wrote:
> On Fri, Apr 6, 2012 at 1:49 AM, Arokux B. <arokux at gmail.com> wrote:
> > This patch adds "[installed]" prefix to already installed optional dependency.
> >
> > Signed-off-by: Arokux arokux at gmail.com
> > ---
> >  src/pacman/util.c |   43 +++++++++++++++++++++++++++++--------------
> >  1 file changed, 29 insertions(+), 14 deletions(-)
> >
> > diff --git a/src/pacman/util.c b/src/pacman/util.c
> > index a5242ae..d0a049e 100644
> > --- a/src/pacman/util.c
> > +++ b/src/pacman/util.c
> > @@ -1189,19 +1189,40 @@ static int depend_cmp(const void *d1, const void *d2)
> >        return ret;
> >  }
> >
> > +alpm_list_t *optdeps_to_strings(alpm_list_t *optdeps)
> > +{
> > +       alpm_list_t *i, *optstrings = NULL;
> > +  alpm_db_t *localdb = alpm_get_localdb(config->handle);
> > +
> > +       /* turn optdepends list into a text list */
> > +       for(i = optdeps; i; i = alpm_list_next(i)) {
> > +               alpm_depend_t *optdep = i->data;
> > +               char *optdepstring = alpm_dep_compute_string(optdep);
> > +
> > +               if(alpm_find_satisfier(alpm_db_get_pkgcache(localdb), optdepstring)) {
> > +                       char *optdepstring_in;
> > +                       pm_asprintf(&optdepstring_in, _("[installed] %s"), optdepstring);
> > +                       free(optdepstring);
> > +
> > +                       optdepstring = optdepstring_in;
> > +                       optdepstring_in = NULL;
> > +               }
> > +
> > +               optstrings = alpm_list_add(optstrings, optdepstring);
> > +       }
> > +
> > +       return optstrings;
> > +}
> > +
> >  void display_new_optdepends(alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg)
> >  {
> > -       alpm_list_t *i, *old, *new, *optdeps, *optstrings = NULL;
> > +       alpm_list_t *old, *new, *optdeps, *optstrings = NULL;
> >
> >        old = alpm_pkg_get_optdepends(oldpkg);
> >        new = alpm_pkg_get_optdepends(newpkg);
> >        optdeps = alpm_list_diff(new, old, depend_cmp);
> >
> > -       /* turn optdepends list into a text list */
> > -       for(i = optdeps; i; i = alpm_list_next(i)) {
> > -               alpm_depend_t *optdep = i->data;
> > -               optstrings = alpm_list_add(optstrings, alpm_dep_compute_string(optdep));
> > -       }
> > +       optstrings = optdeps_to_strings(optdeps);
> >
> >        if(optstrings) {
> >                printf(_("New optional dependencies for %s\n"), alpm_pkg_get_name(newpkg));
> > @@ -1214,15 +1235,9 @@ void display_new_optdepends(alpm_pkg_t *oldpkg,
> > alpm_pkg_t *newpkg)
> >
> >  void display_optdepends(alpm_pkg_t *pkg)
> >  {
> > -       alpm_list_t *i, *optdeps, *optstrings = NULL;
> > +       alpm_list_t *optstrings = NULL;
> >
> > -       optdeps = alpm_pkg_get_optdepends(pkg);
> > -
> > -       /* turn optdepends list into a text list */
> > -       for(i = optdeps; i; i = alpm_list_next(i)) {
> > -               alpm_depend_t *optdep = i->data;
> > -               optstrings = alpm_list_add(optstrings, alpm_dep_compute_string(optdep));
> > -       }
> > +       optstrings = optdeps_to_strings(alpm_pkg_get_optdepends(pkg));
> >
> >        if(optstrings) {
> >                printf(_("Optional dependencies for %s\n"), alpm_pkg_get_name(pkg));
> 
> 
> Hi guys,
> 
> the patch I sent 10 days ago hasn't got any attention. I would be
> interested to know why.
> 
> Many thanks.
> 

We have a large branch of optdepends work that needs to be merged at
some point. This sort of this is certainly wanted, it just remains to be
seen where it'll come from.

http://mailman.archlinux.org/pipermail/pacman-dev/2011-November/014772.html

d


More information about the pacman-dev mailing list