forked from ariadne/pkgconf
cli: ensure --modversion is output is printed in dependency queue order
Previously, --modversion operated on the calculated solution and printed versions in order of the calculated dependency graph. Change this to use the dependency queue instead, looking up nodes in the dependency graph as needed, to ensure that the --modversion output behaves as intended. Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
parent
4fb0988a29
commit
f49029c681
21
cli/main.c
21
cli/main.c
|
@ -289,18 +289,26 @@ apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
|
|||
#endif
|
||||
|
||||
static bool
|
||||
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
|
||||
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
|
||||
{
|
||||
pkgconf_node_t *iter;
|
||||
pkgconf_node_t *queue_iter;
|
||||
pkgconf_list_t *pkgq = data;
|
||||
(void) client;
|
||||
(void) unused;
|
||||
(void) maxdepth;
|
||||
|
||||
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, iter)
|
||||
PKGCONF_FOREACH_LIST_ENTRY(pkgq->head, queue_iter)
|
||||
{
|
||||
pkgconf_dependency_t *dep = iter->data;
|
||||
pkgconf_node_t *world_iter;
|
||||
pkgconf_queue_t *queue_node = queue_iter->data;
|
||||
|
||||
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, world_iter)
|
||||
{
|
||||
pkgconf_dependency_t *dep = world_iter->data;
|
||||
pkgconf_pkg_t *pkg = dep->match;
|
||||
|
||||
if (strncmp(pkg->id, queue_node->package, strlen(pkg->id)))
|
||||
continue;
|
||||
|
||||
if (pkg->version != NULL) {
|
||||
if (verbosity)
|
||||
printf("%s: ", pkg->id);
|
||||
|
@ -308,6 +316,7 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, i
|
|||
printf("%s\n", pkg->version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1430,7 +1439,7 @@ cleanup3:
|
|||
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
|
||||
{
|
||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||
apply_modversion(&pkg_client, &world, NULL, 2);
|
||||
apply_modversion(&pkg_client, &world, &pkgq, 2);
|
||||
}
|
||||
|
||||
if ((want_flags & PKG_PATH) == PKG_PATH)
|
||||
|
|
Loading…
Reference in New Issue