Some BSP architecture builds (e.g. genericx86-64 or anything from
meta-intel) don't have their /usr/lib/rpm/platform/<arch>-linux
directories. This causes rpmbuild fail on the target machine.

Use ${SDK_ARCH}-linux as the base arch which likely exists in
/usr/lib/rpm/platform and clone it as ${MACHINE_ARCH}-linux.

Also, fix %_lib and %_libdir in the new cloned platform directory
to use ${baselib} and ${libdir} so the RPM package contents will
be correct for library packages.

Signed-off-by: Zoltán Böszörményi <[email protected]>
---
 meta/recipes-devtools/rpm/rpm_4.18.1.bb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb 
b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
index 95a9e92f96..21f0127561 100644
--- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
@@ -131,7 +131,20 @@ do_install:append:class-nativesdk() {
 # Rpm's make install creates var/tmp which clashes with base-files packaging
 do_install:append:class-target() {
     rm -rf ${D}/var
+
+    if [ -d "${D}${prefix}/lib/rpm/platform/${SDK_ARCH}-linux" ]; then
+        if [ ! -d ${D}${prefix}/lib/rpm/platform/${MACHINE_ARCH}-linux ]; then
+            cp -r ${D}${prefix}/lib/rpm/platform/${SDK_ARCH}-linux 
${D}${prefix}/lib/rpm/platform/${MACHINE_ARCH}-linux
+        fi
+    fi
+    if [ -d ${D}${prefix}/lib/rpm/platform/${MACHINE_ARCH}-linux ]; then
+        sed -i \
+            -e "s:^%_lib\t.*$:%_lib\t${baselib}:" \
+            -e "s:^%_libdir\t.*$:%_libdir\t${libdir}:" \
+            ${D}${prefix}/lib/rpm/platform/${MACHINE_ARCH}-linux/macros
+    fi
 }
+
 do_install:append:class-nativesdk() {
     rm -rf ${D}${SDKPATHNATIVE}/var
     # Ensure find-debuginfo is located correctly inside SDK
-- 
2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#184786): 
https://lists.openembedded.org/g/openembedded-core/message/184786
Mute This Topic: https://lists.openembedded.org/mt/100328070/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to