Skip to content

Commit a818e4e

Browse files
Upgrade perl-PkgConfig-LibPkgConf to 0.11-24
1 parent 37215b9 commit a818e4e

File tree

3 files changed

+1278
-9
lines changed

3 files changed

+1278
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
From 39b8a0e8f664dc103a552dbab1cdccdab8ce3062 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
3+
Date: Tue, 7 Mar 2023 09:16:10 +0100
4+
Subject: [PATCH] Fix resolving flags for packages with a name different from
5+
its identifier
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Alien-Build-2.77 tests revealed a bug in constructing a query for
11+
pkgconf-1.9 solver: If a package file had file name different from
12+
a Name value inside the file, the package was able to be found, but
13+
the flags solver searched for the Name and found nothing.
14+
15+
Studying pre-pkgconf documentation shows that Name value is only
16+
a human-oriented display name and a base of the package file name
17+
should be used instead as a package identifier. This base name is
18+
stored into an id field of the package structure of pkgconf.
19+
20+
This patch fixes it by using the id field instead. It also adds a test
21+
to prevent from future regressions.
22+
23+
Signed-off-by: Petr Písař <ppisar@redhat.com>
24+
---
25+
LibPkgConf.xs | 2 +-
26+
MANIFEST | 1 +
27+
corpus/lib4/bar.pc | 4 ++++
28+
t/client.t | 14 +++++++++++++-
29+
4 files changed, 19 insertions(+), 2 deletions(-)
30+
create mode 100644 corpus/lib4/bar.pc
31+
32+
diff --git a/LibPkgConf.xs b/LibPkgConf.xs
33+
index 63c78fb..57e6892 100644
34+
--- a/LibPkgConf.xs
35+
+++ b/LibPkgConf.xs
36+
@@ -117,7 +117,7 @@ solve_flags(pkgconf_pkg_t *package, my_client_t *client, int type,
37+
#if LIBPKGCONF_VERSION >= 10900
38+
if (sizeof(query_string) <=
39+
snprintf(query_string, sizeof(query_string), "%s = %s",
40+
- package->realname, package->version))
41+
+ package->id, package->version))
42+
false;
43+
pkgconf_queue_push(&query, query_string);
44+
if (loaded_from_file)
45+
diff --git a/MANIFEST b/MANIFEST
46+
index 77378df..1eb4491 100644
47+
--- a/MANIFEST
48+
+++ b/MANIFEST
49+
@@ -6,6 +6,7 @@ corpus/lib1/foo1a.pc
50+
corpus/lib2/bar.pc
51+
corpus/lib2/foo.pc
52+
corpus/lib3/foo.pc
53+
+corpus/lib4/bar.pc
54+
INSTALL
55+
lib/PkgConfig/LibPkgConf.pm
56+
lib/PkgConfig/LibPkgConf/Client.pm
57+
diff --git a/corpus/lib4/bar.pc b/corpus/lib4/bar.pc
58+
new file mode 100644
59+
index 0000000..47e52dd
60+
--- /dev/null
61+
+++ b/corpus/lib4/bar.pc
62+
@@ -0,0 +1,4 @@
63+
+Name: foo
64+
+Description: A pkg-config file whose identifier does not match its name
65+
+Version: 1.2.3
66+
+Cflags: -fPIC
67+
diff --git a/t/client.t b/t/client.t
68+
index 6c80f83..db115fe 100644
69+
--- a/t/client.t
70+
+++ b/t/client.t
71+
@@ -206,7 +206,7 @@ subtest 'path attributes' => sub {
72+
73+
mkpath "$root/$_", 0, 0700 for qw(
74+
foo bar baz ralph trans formers foo/lib bar/lib trans/lib formers/lib
75+
- foo/include bar/include trans/include formers/include
76+
+ /foo/include bar/include trans/include formers/include
77+
);
78+
79+
subtest 'search path' => sub {
80+
@@ -295,4 +295,16 @@ subtest 'global' => sub {
81+
82+
};
83+
84+
+subtest 'a package with a different name' => sub {
85+
+
86+
+ my $client = PkgConfig::LibPkgConf::Client->new( path => 'corpus/lib4' );
87+
+
88+
+ is( $client->find('foo'), undef, 'A human-readable name foo is ignored');
89+
+
90+
+ my $pkg = $client->find('bar');
91+
+ isnt( $pkg, undef, 'An identifier bar is found' );
92+
+ is( $pkg->cflags, '-fPIC ', 'Cflags are retrieved' );
93+
+
94+
+};
95+
+
96+
done_testing;
97+
--
98+
2.39.2
99+

0 commit comments

Comments
 (0)