diff mbox series

[v2] libdnf: Fix arm arch mapping issues for qemuarmv5

Message ID 20231109104312.1640551-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 7d620c754c92da9dcc56a0a7ec9f3355c2ba733e
Headers show
Series [v2] libdnf: Fix arm arch mapping issues for qemuarmv5 | expand

Commit Message

Richard Purdie Nov. 9, 2023, 10:43 a.m. UTC
qemuarmv5 currently fails with:

$ dnf --help
Error: Incorrect or unknown "arch": armv5hl

Fix this by removing the code in libdnf which is trying to be too
clever, we don't need this mappings given the way OE configures rpm.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../libdnf/libdnf/armarch.patch               | 42 +++++++++++++++++++
 meta/recipes-devtools/libdnf/libdnf_0.72.0.bb |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/libdnf/libdnf/armarch.patch

v2 - actually send the right patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/libdnf/libdnf/armarch.patch b/meta/recipes-devtools/libdnf/libdnf/armarch.patch
new file mode 100644
index 00000000000..99eaf1d521f
--- /dev/null
+++ b/meta/recipes-devtools/libdnf/libdnf/armarch.patch
@@ -0,0 +1,42 @@ 
+We change the way rpm architectures work, we make the machine name the default machine
+specific package architecture.
+
+This arm mapping code can work or in the case of qemuarmv5, it doesn't as it creates
+armv5hl which doesn't exist and causes errrors. We can simply remove it, we don't need it.
+
+Upstream-Status: Inappropriate [Relies on OE rpm config]
+
+Index: git/libdnf/hy-util.cpp
+===================================================================
+--- git.orig/libdnf/hy-util.cpp
++++ git/libdnf/hy-util.cpp
+@@ -117,29 +117,6 @@ hy_detect_arch(char **arch)
+     if (uname(&un) < 0)
+         return DNF_ERROR_FAILED;
+ 
+-    if (!strncmp(un.machine, "armv", 4)) {
+-        /* un.machine is armvXE, where X is version number and E is
+-         * endianness (b or l); we need to add modifiers such as
+-         * h (hardfloat), n (neon). Neon is a requirement of armv8 so
+-         * as far as rpm is concerned armv8l is the equivilent of armv7hnl
+-         * (or 7hnb) so we don't explicitly add 'n' for 8+ as it's expected. */
+-        char endian = un.machine[strlen(un.machine)-1];
+-        char *modifier = un.machine + 5;
+-        while(isdigit(*modifier)) /* keep armv7, armv8, armv9, armv10, armv100, ... */
+-            modifier++;
+-        if (getauxval(AT_HWCAP) & HWCAP_ARM_VFP)
+-            *modifier++ = 'h';
+-        if ((atoi(un.machine+4) == 7) && (getauxval(AT_HWCAP) & HWCAP_ARM_NEON))
+-            *modifier++ = 'n';
+-        *modifier++ = endian;
+-        *modifier = 0;
+-    }
+-#ifdef __MIPSEL__
+-    if (!strcmp(un.machine, "mips"))
+-        strcpy(un.machine, "mipsel");
+-    else if (!strcmp(un.machine, "mips64"))
+-        strcpy(un.machine, "mips64el");
+-#endif
+     *arch = g_strdup(un.machine);
+     return 0;
+ }
diff --git a/meta/recipes-devtools/libdnf/libdnf_0.72.0.bb b/meta/recipes-devtools/libdnf/libdnf_0.72.0.bb
index d58ad0353ff..a8685a16048 100644
--- a/meta/recipes-devtools/libdnf/libdnf_0.72.0.bb
+++ b/meta/recipes-devtools/libdnf/libdnf_0.72.0.bb
@@ -10,6 +10,7 @@  SRC_URI = "git://github.com/rpm-software-management/libdnf;branch=dnf-4-master;p
            file://0001-Get-parameters-for-both-libsolv-and-libsolvext-libdn.patch \
            file://enable_test_data_dir_set.patch \
            file://0001-drop-FindPythonInstDir.cmake.patch \
+           file://armarch.patch \
            "
 
 SRCREV = "908dba63c9e18c86a2d81166ce7523559e65338c"