]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
rpm: fix expansion of %_libdir in macros
authorYi Zhao <yi.zhao@eng.windriver.com>
Fri, 26 Jul 2024 11:00:10 +0000 (19:00 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 6 Aug 2024 10:33:50 +0000 (11:33 +0100)
There is a patch in oe-core[1] to avoid hardcoded paths in macros. It
tries to use libdir to expand %_libdir in macros.in. However, in
upstream commit[2], libdir for macros in CMakeLists.txt is set to
${prefix}/=LIB=, which causes %_libdir to expand to ${prefix}/=LIB=
instead of the correct path in the final macros.

On target:
$ rpm --showrc | grep _libdir
[snip]
-13: _libdir    ${prefix}/=LIB=
[snip]

This also causes %__pkgconfig_path in fileattrs/pkgconfig.attr to become
an invalid regular expression when building rpm packages. This results a
warning in log.do_package_write_rpm in all packages:

Warning: Ignoring invalid regular expression ^((${prefix}/=LIB=|usr/share)/pkgconfig/.*.pc|usr/bin/pkg-config)$

Set libdir to ${CMAKE_INSTALL_FULL_LIBDIR} instead of ${prefix}/=LIB= to
make sure it is expanded to the correct path in macros.

After the patch:
On target:
$ rpm --showrc | grep _libdir
[snip]
-13: _libdir    /usr/lib
[snip]

[1] https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
[2] https://github.com/rpm-software-management/rpm/commit/d2abb7a48760418aacd7f17c8b64e39c25ca50c9

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/recipes-devtools/rpm/files/0001-CMakeLists.txt-set-libdir-to-CMAKE_INSTALL_FULL_LIBD.patch [new file with mode: 0644]
meta/recipes-devtools/rpm/rpm_4.19.1.1.bb

diff --git a/meta/recipes-devtools/rpm/files/0001-CMakeLists.txt-set-libdir-to-CMAKE_INSTALL_FULL_LIBD.patch b/meta/recipes-devtools/rpm/files/0001-CMakeLists.txt-set-libdir-to-CMAKE_INSTALL_FULL_LIBD.patch
new file mode 100644 (file)
index 0000000..1bd83e7
--- /dev/null
@@ -0,0 +1,53 @@
+From fea9cea49aa0844de14126e54d05b91ba619427f Mon Sep 17 00:00:00 2001
+From: Yi Zhao <yi.zhao@windriver.com>
+Date: Fri, 26 Jul 2024 17:18:30 +0800
+Subject: [PATCH] CMakeLists.txt: set libdir to ${CMAKE_INSTALL_FULL_LIBDIR} in
+ macros
+
+There is a patch in oe-core[1] to avoid hardcoded paths in macros. It
+tries to use libdir to expand %_libdir in macros.in. However, in
+upstream commit[2], libdir for macros in CMakeLists.txt is set to
+${prefix}/=LIB=, which causes %_libdir to expand to ${prefix}/=LIB=
+instead of the correct path in the final macros.
+
+On target:
+$ rpm --showrc | grep _libdir
+[snip]
+-13: _libdir    ${prefix}/=LIB=
+[snip]
+
+This also causes %__pkgconfig_path in fileattrs/pkgconfig.attr to become
+an invalid regular expression when building rpm packages. This results a
+warning in log.do_package_write_rpm in all packages:
+
+Warning: Ignoring invalid regular expression ^((${prefix}/=LIB=|usr/share)/pkgconfig/.*.pc|usr/bin/pkg-config)$
+
+Set libdir to ${CMAKE_INSTALL_FULL_LIBDIR} instead of ${prefix}/=LIB= to
+make sure it is expanded to the correct path in macros.
+
+[1] https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
+[2] https://github.com/rpm-software-management/rpm/commit/d2abb7a48760418aacd7f17c8b64e39c25ca50c9
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ed847c09a1..385b5040c6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -84,7 +84,7 @@ function(makemacros)
+       set(sysconfdir "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
+       set(sharedstatedir "${CMAKE_INSTALL_FULL_SHAREDSTATEDIR}")
+       set(localstatedir "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}")
+-      set(libdir "\${prefix}/=LIB=")
++      set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
+       set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
+       set(oldincludedir "${CMAKE_INSTALL_FULL_OLDINCLUDEDIR}")
+       set(infodir "\${prefix}/${CMAKE_INSTALL_INFODIR}")
+-- 
+2.25.1
+
index 0802f2629557dc47c068f70fe03204028a456646..93303237973a2c9bc6152e4da091f0b81b1cf9b1 100644 (file)
@@ -38,6 +38,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.19.x;protoc
            file://0001-build-pack.c-do-not-insert-payloadflags-into-.rpm-me.patch \
            file://0001-CMakeLists.txt-look-for-lua-with-pkg-config-rather-t.patch \
            file://0002-rpmio-rpmglob.c-avoid-using-GLOB_BRACE-if-undefined-.patch \
+           file://0001-CMakeLists.txt-set-libdir-to-CMAKE_INSTALL_FULL_LIBD.patch \
            "
 
 PE = "1"