Michal Toman 0b7413c
From d796769e317081f41f4185360969f40e5117e207 Mon Sep 17 00:00:00 2001
Michal Toman 0b7413c
From: Michal Toman <michal.toman@gmail.com>
Michal Toman 0b7413c
Date: Tue, 3 Mar 2015 09:30:43 +0100
Michal Toman 0b7413c
Subject: [PATCH 2/2] add support for ppc64le and aarch64
Michal Toman 0b7413c
Michal Toman 0b7413c
Signed-off-by: Michal Toman <michal.toman@gmail.com>
Michal Toman 0b7413c
---
Michal Toman 0b7413c
 src/lib/retrace.py | 19 ++++++++++++++++---
Michal Toman 0b7413c
 1 file changed, 16 insertions(+), 3 deletions(-)
Michal Toman 0b7413c
Michal Toman 0b7413c
diff --git a/src/lib/retrace.py b/src/lib/retrace.py
Michal Toman 0b7413c
index debd4a6..772b638 100644
Michal Toman 0b7413c
--- a/src/lib/retrace.py
Michal Toman 0b7413c
+++ b/src/lib/retrace.py
Michal Toman 0b7413c
@@ -75,7 +75,7 @@ INPUT_ARCH_PARSER = re.compile("^[a-zA-Z0-9_]+$")
Michal Toman 0b7413c
 #name-version-arch (fedora-16-x86_64, rhel-6.2-i386, opensuse-12.1-x86_64)
Michal Toman 0b7413c
 INPUT_RELEASEID_PARSER = re.compile("^[a-zA-Z0-9]+\-[0-9a-zA-Z\.]+\-[a-zA-Z0-9_]+$")
Michal Toman 0b7413c
 
Michal Toman 0b7413c
-CORE_ARCH_PARSER = re.compile("core file,? .*(x86-64|80386|ARM|IBM S/390|64-bit PowerPC)")
Michal Toman 0b7413c
+CORE_ARCH_PARSER = re.compile("core file,? .*(x86-64|80386|ARM|aarch64|IBM S/390|64-bit PowerPC)")
Michal Toman 0b7413c
 PACKAGE_PARSER = re.compile("^(.+)-([0-9]+(\.[0-9]+)*-[0-9]+)\.([^-]+)$")
Michal Toman 0b7413c
 DF_OUTPUT_PARSER = re.compile("^([^ ^\t]*)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+%)[ \t]+(.*)$")
Michal Toman 0b7413c
 DU_OUTPUT_PARSER = re.compile("^([0-9]+)")
Michal Toman 0b7413c
@@ -202,9 +202,10 @@ STATUS = [
Michal Toman 0b7413c
 ]
Michal Toman 0b7413c
 
Michal Toman 0b7413c
 ARCHITECTURES = set(["src", "noarch", "i386", "i486", "i586", "i686", "x86_64",
Michal Toman 0b7413c
-                     "s390", "s390x", "ppc", "ppc64",  "ppc64iseries",
Michal Toman 0b7413c
+                     "s390", "s390x", "ppc", "ppc64", "ppc64le", "ppc64iseries",
Michal Toman 0b7413c
                      "armel", "armhfp", "armv5tel", "armv7l", "armv7hl",
Michal Toman 0b7413c
-                     "armv7hnl", "sparc", "sparc64", "mips4kec", "ia64"])
Michal Toman 0b7413c
+                     "armv7hnl", "aarch64", "sparc", "sparc64", "mips4kec",
Michal Toman 0b7413c
+                     "ia64"])
Michal Toman 0b7413c
 
Michal Toman 0b7413c
 # armhfp is not correct, but there is no way to distinguish armv5/armv6/armv7 coredumps
Michal Toman 0b7413c
 # as armhfp (RPM armv7hl) is the only supported now, let's approximate arm = armhfp
Michal Toman 0b7413c
@@ -218,6 +219,8 @@ ARCH_MAP = {
Michal Toman 0b7413c
     "x86_64": set(["x86_64"]),
Michal Toman 0b7413c
     "s390x": set(["s390x"]),
Michal Toman 0b7413c
     "ppc64": set(["ppc64"]),
Michal Toman 0b7413c
+    "ppc64le": set(["ppc64le"]),
Michal Toman 0b7413c
+    "aarch64": set(["aarch64"]),
Michal Toman 0b7413c
 }
Michal Toman 0b7413c
 
Michal Toman 0b7413c
 def now():
Michal Toman 0b7413c
@@ -335,9 +338,14 @@ def guess_arch(coredump_path):
Michal Toman 0b7413c
             # version the coredump is. At the moment we only support
Michal Toman 0b7413c
             # armv7hl / armhfp - let's approximate arm = armhfp
Michal Toman 0b7413c
             return "armhfp"
Michal Toman 0b7413c
+        elif match.group(1) == "aarch64":
Michal Toman 0b7413c
+            return "aarch64"
Michal Toman 0b7413c
         elif match.group(1) == "IBM S/390":
Michal Toman 0b7413c
             return "s390x"
Michal Toman 0b7413c
         elif match.group(1) == "64-bit PowerPC":
Michal Toman 0b7413c
+            if "LSB" in output:
Michal Toman 0b7413c
+                return "ppc64le"
Michal Toman 0b7413c
+
Michal Toman 0b7413c
             return "ppc64"
Michal Toman 0b7413c
 
Michal Toman 0b7413c
     result = None
Michal Toman 0b7413c
@@ -357,6 +365,11 @@ def guess_arch(coredump_path):
Michal Toman 0b7413c
     child.kill()
Michal Toman 0b7413c
     child.stdout.close()
Michal Toman 0b7413c
 
Michal Toman 0b7413c
+    # "ppc64le" matches both ppc64 and ppc64le
Michal Toman 0b7413c
+    # if file magic says little endian, fix it
Michal Toman 0b7413c
+    if result == "ppc64" and "LSB" in output:
Michal Toman 0b7413c
+        result = "ppc64le"
Michal Toman 0b7413c
+
Michal Toman 0b7413c
     return result
Michal Toman 0b7413c
 
Michal Toman 0b7413c
 def guess_release(package, plugins):
Michal Toman 0b7413c
-- 
Michal Toman 0b7413c
2.1.0
Michal Toman 0b7413c