forked from ariadne/pkgconf
cli: fix --modversion not showing version in various cases
There are numerous edge cases where version is wrong or missing when matching the dependency queue to resolved packages. This adds the dependency name as it appears in the dependency queue to each package as it is resolved, allowing for a simple and correct comparison when printing. Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
parent
9cddd22bbc
commit
66994f1533
|
@ -306,7 +306,7 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int
|
||||||
pkgconf_dependency_t *dep = world_iter->data;
|
pkgconf_dependency_t *dep = world_iter->data;
|
||||||
pkgconf_pkg_t *pkg = dep->match;
|
pkgconf_pkg_t *pkg = dep->match;
|
||||||
|
|
||||||
if (strncmp(pkg->id, queue_node->package, strlen(pkg->id)))
|
if (strcmp(pkg->why, queue_node->package))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pkg->version != NULL) {
|
if (pkg->version != NULL) {
|
||||||
|
@ -315,6 +315,8 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int
|
||||||
|
|
||||||
printf("%s\n", pkg->version);
|
printf("%s\n", pkg->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ struct pkgconf_pkg_ {
|
||||||
char *license;
|
char *license;
|
||||||
char *maintainer;
|
char *maintainer;
|
||||||
char *copyright;
|
char *copyright;
|
||||||
|
char *why;
|
||||||
|
|
||||||
pkgconf_list_t libs;
|
pkgconf_list_t libs;
|
||||||
pkgconf_list_t libs_private;
|
pkgconf_list_t libs_private;
|
||||||
|
|
|
@ -546,6 +546,9 @@ pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
if (pkg->copyright != NULL)
|
if (pkg->copyright != NULL)
|
||||||
free(pkg->copyright);
|
free(pkg->copyright);
|
||||||
|
|
||||||
|
if (pkg->why != NULL)
|
||||||
|
free(pkg->why);
|
||||||
|
|
||||||
free(pkg);
|
free(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1398,9 +1401,10 @@ pkgconf_pkg_verify_dependency(pkgconf_client_t *client, pkgconf_dependency_t *pk
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkgconf_pkg_scan_providers(client, pkgdep, eflags);
|
pkg = pkgconf_pkg_scan_providers(client, pkgdep, eflags);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (pkg->id == NULL)
|
if (pkg->id == NULL)
|
||||||
pkg->id = strdup(pkgdep->package);
|
pkg->id = strdup(pkgdep->package);
|
||||||
|
|
||||||
|
@ -1411,6 +1415,10 @@ pkgconf_pkg_verify_dependency(pkgconf_client_t *client, pkgconf_dependency_t *pk
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pkgdep->match = pkgconf_pkg_ref(client, pkg);
|
pkgdep->match = pkgconf_pkg_ref(client, pkg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg != NULL)
|
||||||
|
pkg->why = strdup(pkgdep->package);
|
||||||
|
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue