From 883b57df475d79dba2f5acfed83a72f870c1aec8 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 23 Feb 2024 15:18:08 +0100 Subject: [PATCH] Cache packages from explicit file requests --- cli/main.c | 8 +++++--- libpkgconf/pkg.c | 4 +--- tests/basic.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/main.c b/cli/main.c index dfd65c7..15f99cb 100644 --- a/cli/main.c +++ b/cli/main.c @@ -279,18 +279,20 @@ print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data) PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node) { pkgconf_dependency_t *dep = node->data; + const char *dep_id = (dep->match != NULL) ? dep->match->id : dep->package; if ((dep->flags & PKGCONF_PKG_DEPF_PRIVATE) == 0) - printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8]\n", pkg->id, dep->package); + printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8]\n", pkg->id, dep_id); else - printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep->package); + printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep_id); } PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node) { pkgconf_dependency_t *dep = node->data; + const char *dep_id = (dep->match != NULL) ? dep->match->id : dep->package; - printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep->package); + printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep_id); } } diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index d271997..feb8d9a 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -775,15 +775,13 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name) { if ((f = fopen(name, "r")) != NULL) { - pkgconf_pkg_t *pkg; - PKGCONF_TRACE(client, "%s is a file", name); pkg = pkgconf_pkg_new_from_file(client, name, f, 0); if (pkg != NULL) { pkgconf_path_add(pkg->pc_filedir, &client->dir_list, true); - return pkg; + goto out; } } } diff --git a/tests/basic.sh b/tests/basic.sh index 5013861..3a63c89 100755 --- a/tests/basic.sh +++ b/tests/basic.sh @@ -231,7 +231,7 @@ libs_circular1_body() libs_circular_directpc_body() { atf_check \ - -o inline:"-lcircular-1 -lcircular-2 -lcircular-3\n" \ + -o inline:"-lcircular-3 -lcircular-1 -lcircular-2\n" \ pkgconf --libs ${selfdir}/lib1/circular-3.pc }