[OE-core] [PATCH] dnf: make dnf work in toolchain

Zheng Ruoqin zhengrq.fnst at cn.fujitsu.com
Mon Sep 16 06:36:45 UTC 2019


We need to configure dnf to use package architecture from yocto build system.

Install etc/dnf/vars to ${SDKTARGETSYSROOT} because config file in host-sysroot as /opt/poky/2.7+snapshot/sysroots/x86_64-pokysdk-linux will be covered by another ARCH which result in previous config settings inefficacy.

To resolve it, put config file in target-sysroot like /opt/poky/2.7+snapshot/sysroots/core2-64-poky-linux. As each ARCH has its own target-sysroot, config file will not be covered.

Signed-off-by: Zheng Ruoqin <zhengrq.fnst at cn.fujitsu.com>
---
 meta/recipes-devtools/dnf/dnf_4.2.2.bb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/meta/recipes-devtools/dnf/dnf_4.2.2.bb b/meta/recipes-devtools/dnf/dnf_4.2.2.bb
index c77773332c..02500a33c2 100644
--- a/meta/recipes-devtools/dnf/dnf_4.2.2.bb
+++ b/meta/recipes-devtools/dnf/dnf_4.2.2.bb
@@ -68,10 +68,22 @@ do_install_append_class-native() {
                 RPM_NO_CHROOT_FOR_SCRIPTS=1
 }
 
+
+REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}-${DISTRO}-${TARGET_OS}"
+SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
+
 do_install_append_class-nativesdk() {
         create_wrapper ${D}/${bindir}/dnf \
                 RPM_CONFIGDIR=${SDKPATHNATIVE}${libdir_nativesdk}/rpm \
                 RPM_NO_CHROOT_FOR_SCRIPTS=1 
+
+        install -d ${D}/${SDKTARGETSYSROOT}/etc/dnf/vars
+        cat >${D}/${SDKTARGETSYSROOT}/etc/dnf/vars/arch <<EOF
+${DEFAULTTUNE}:${MACHINE_ARCH}:${TARGET_ARCH}
+EOF
+
+# Default ${TARGET_ARCH} should be fixed as '-' is instead of '_'.
+        sed -i 's/-/_/' ${D}/${SDKTARGETSYSROOT}/etc/dnf/vars/arch
 }
 
 SYSTEMD_SERVICE_${PN} = "dnf-makecache.service dnf-makecache.timer \
@@ -81,3 +93,5 @@ SYSTEMD_SERVICE_${PN} = "dnf-makecache.service dnf-makecache.timer \
                          dnf-automatic-notifyonly.service dnf-automatic-notifyonly.timer \
 "
 SYSTEMD_AUTO_ENABLE ?= "disable"
+
+FILES_${PN}_append_class-nativesdk += "${SDKTARGETSYSROOT}"
-- 
2.17.1





More information about the Openembedded-core mailing list