Skip to content

Latest commit

 

History

History
62 lines (58 loc) · 2.06 KB

0006-Use-rpm-platform-for-architecture-autodetection.patch

File metadata and controls

62 lines (58 loc) · 2.06 KB
 
Jan 16, 2024
Jan 16, 2024
1
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
From: =?UTF-8?q?Juho=20H=C3=A4m=C3=A4l=C3=A4inen?=
<juho.hamalainen@jolla.com>
Date: Wed, 25 Nov 2020 14:03:30 +0200
Subject: [PATCH] Use rpm platform for architecture autodetection.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If /etc/rpm/platform file exists use the architecture defined. This way
we get correct behavior with for example aarch64 kernel and armv7hl
platform.
Signed-off-by: Juho Hämäläinen <juho.hamalainen@jolla.com>
---
zypp/ZConfig.cc | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/zypp/ZConfig.cc b/zypp/ZConfig.cc
Jan 16, 2024
Jan 16, 2024
20
index f1d330a21236036d8b69acebbc79505b958243fb..a002737c7e2537295e01c825d62b7d989202ff40 100644
21
22
--- a/zypp/ZConfig.cc
+++ b/zypp/ZConfig.cc
Jan 16, 2024
Jan 16, 2024
23
24
@@ -263,6 +263,39 @@ namespace zypp
architecture = Arch_ppc64p7;
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
}
#endif
+
+ /* JB#51353 - We need to override architecture when we get certain architectures from uname
+ * which don't match platform. For example aarch64 kernel with armv7hl platform.
+ * This detection mimics what is implemented in kickstart file, writing platform architecture
+ * to /etc/rpm/platform - rpm uses this file to get it right and we use it now as well.
+ * */
+ std::ifstream rpm_platform( "/etc/rpm/platform" );
+
+ if ( rpm_platform )
+ {
+ std::string rpmArch;
+
+ for( iostr::EachLine in( rpm_platform ); in; in.next() )
+ {
+ std::string s = *in;
+ size_t pos = s.find ("-");
+
+ if ( pos != std::string::npos )
+ {
+ rpmArch = s.substr (0, pos);
+ break;
+ }
+ }
+
+ if ( !rpmArch.empty() && rpmArch != architecture.asString() )
+ {
+ MIL << "Uname is '" << architecture
+ << "' but /etc/rpm/platform architecture is '" << rpmArch
+ << "' - use what platform says." << endl;
+ architecture = Arch(rpmArch);
+ }
+ }
+
return architecture;
}