From ab5d49c07944d6a9f3a61de4c830a0130feccbd7 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 1 Dec 2017 14:53:41 +0100 Subject: [PATCH] Fix finding ports updates with flavors Use the new target from flavors to list all potential packages and we match against them --- src/version.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/version.c b/src/version.c index 75d9e92218..f2a2418612 100644 --- a/src/version.c +++ b/src/version.c @@ -696,9 +696,10 @@ validate_origin(const char *portsdir, const char *origin) } static const char * -port_version(UT_string *cmd, const char *portsdir, const char *origin) +port_version(UT_string *cmd, const char *portsdir, const char *origin, + const char *pkgname) { - char *output; + char *output, *walk, *name; char *version = NULL; char *argv[5]; @@ -712,12 +713,21 @@ port_version(UT_string *cmd, const char *portsdir, const char *origin) argv[0] = "make"; argv[1] = "-C"; argv[2] = utstring_body(cmd); - argv[3] = "-VPKGVERSION"; + argv[3] = "flavors-package-names"; argv[4] = NULL; if (exec_buf(cmd, argv) != 0) { output = utstring_body(cmd); - version = strsep(&output, "\n"); + while ((walk = strsep(&output, "\n")) != NULL) { + name = walk; + walk = strrchr(walk, '-'); + walk[0] = '\0'; + walk++; + if (strcmp(name, pkgname) == 0) { + version = walk; + break; + } + } } } @@ -772,7 +782,7 @@ do_source_ports(unsigned int opt, char limchar, char *pattern, match_t match, strcmp(name, matchname) != 0) continue; - version = port_version(cmd, portsdir, origin); + version = port_version(cmd, portsdir, origin, name); print_version(pkg, "port", version, limchar, opt); utstring_clear(cmd); }