Skip to content

Commit

Permalink
Fix finding ports updates with flavors
Browse files Browse the repository at this point in the history
Use the new target from flavors to list all potential packages and we
match against them
  • Loading branch information
bapt committed Dec 1, 2017
1 parent 7242a13 commit ab5d49c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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;
}
}
}
}

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ab5d49c

Please sign in to comment.