]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
rpm: keep leading `/' from sed operation
authorHongxu Jia <hongxu.jia@windriver.com>
Mon, 14 Jul 2025 04:41:17 +0000 (12:41 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 17 Jul 2025 09:21:46 +0000 (10:21 +0100)
For /usr/lib/rpm/macros, Yocto explicitly set OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM
= "ONLY" [1][2] to search tools from CMAKE_FIND_ROOT_PATH [5] which locates in
native recipe sysroot or HOSTTOOLS_DIR. If found in native recipe sysroot or
HOSTTOOLS_DIR, the sed operation removed leading `/'

root@qemux86-64:~# vi /usr/lib/rpm/macros
...
%__xz                   usr/bin/xz
%__make                 usr/bin/make
%__zstd                 usr/bin/zstd
%__quilt                usr/bin/quilt
%__patch                usr/bin/patch
...

root@qemux86-64:~# rpm --eval "%{__xz} %{__make} %{__zstd} %{__quilt} %{__patch}"
usr/bin/xz usr/bin/make usr/bin/zstd usr/bin/quilt usr/bin/patch

This commit keeps leading `/' from sed operation, and similar reason for
/usr/lib/cmake/rpm/rpm-targets.cmake

After applying this commit:
root@qemux86-64:~# rpm --eval "%{__xz} %{__make} %{__zstd} %{__quilt} %{__patch}"
/usr/bin/xz /usr/bin/make /usr/bin/zstd /usr/bin/quilt /usr/bin/patch

[1] https://git.openembedded.org/openembedded-core/commit/?id=f4ea12f6635125ee793f4dd801c538c0186f9dc3
[2] https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_ROOT_PATH_MODE_PROGRAM.html

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/rpm/rpm_4.20.1.bb

index dc4cfd4abbe44125f571aec45f166f662a85851e..ba967ec1fa0a981ee31f37cac389253c3d8a43d4 100644 (file)
@@ -141,10 +141,10 @@ do_install:append:class-nativesdk() {
 }
 
 do_install:append () {
-       sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
-            -e 's:${STAGING_DIR_NATIVE}/::g' \
+       sed -i -e 's:${HOSTTOOLS_DIR}::g' \
+            -e 's:${STAGING_DIR_NATIVE}::g' \
            ${D}/${libdir}/rpm/macros
-       sed -i -e 's:${RECIPE_SYSROOT}/::g' \
+       sed -i -e 's:${RECIPE_SYSROOT}::g' \
            ${D}/${libdir}/cmake/rpm/rpm-targets.cmake
 
 }