[pacman-dev] [PATCH] Mark already installed optional dependencies
This patch adds "[installed]" prefix to already installed optional dependency. Signed-off-by: Arokux arokux@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));
On Fri, Apr 6, 2012 at 1:49 AM, Arokux B. <arokux@gmail.com> wrote:
This patch adds "[installed]" prefix to already installed optional dependency.
Signed-off-by: Arokux arokux@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.
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@gmail.com> wrote:
This patch adds "[installed]" prefix to already installed optional dependency.
Signed-off-by: Arokux arokux@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
Thanks for the answer. I'm looking forward this patch and optdepends to be merged. On Sun, Apr 15, 2012 at 4:39 PM, Dave Reisner <d@falconindy.com> wrote:
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@gmail.com> wrote:
This patch adds "[installed]" prefix to already installed optional dependency.
Signed-off-by: Arokux arokux@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
Hi, is something going to happen with this patch? I think the feature it introduces is really useful. This was my first patch to pacman and I've spent quite some time to make it, so it's really discouraging to see buried in the mailing list. Thanks Arokux
On Sun, Aug 05, 2012 at 07:18:12PM +0200, Arokux B. wrote:
Hi,
is something going to happen with this patch? I think the feature it introduces is really useful. This was my first patch to pacman and I've spent quite some time to make it, so it's really discouraging to see buried in the mailing list.
Thanks Arokux
And in my original reply to you, I pointed out that we already have a patchset that deals with optdepends in a more complete way. I'll link it again so that there's no confusion: http://mailman.archlinux.org/pipermail/pacman-dev/2011-November/014772.html And I'll also point you to roadmap in the wiki that mentions this: https://wiki.archlinux.org/index.php/Pacman_Roadmap It's not that we're not interested in the feature. Rather, we are, but we're more interested in the complete solution that the patchset provides. A one-off that addresses a singular problem with alpm's optdepends handling is not interesting given a more thorough alternative. That said, it has a few problems which weren't addressed, and the author no longer has interest (they're using Exherbo these days). If you're interested in seeing this merged, I suggest grabbing the previous author's branch [1], rebasing the patchset, and addressing the concerns that Dan raises in the ML thread that I linked above. Cheers, Dave [1] https://github.com/moben/pacman
participants (2)
-
Arokux B.
-
Dave Reisner