teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.6.0-niagara.patch

Phil Knirsch 1cb882
diff -up rpm-4.9.1.3/lib/rpmrc.c.niagara rpm-4.9.1.3/lib/rpmrc.c
Phil Knirsch 1cb882
--- rpm-4.9.1.3/lib/rpmrc.c.niagara	2012-04-19 17:06:23.130595223 +0200
Phil Knirsch 1cb882
+++ rpm-4.9.1.3/lib/rpmrc.c	2012-04-19 17:06:23.134739249 +0200
Phil Knirsch 1cb882
@@ -718,6 +718,31 @@ exit:
Tom Callaway 58f7f1
     return rc;
Tom Callaway 58f7f1
 }
Tom Callaway 58f7f1
 
Tom Callaway 58f7f1
+#if defined(__linux__) && defined(__sparc__)
Tom Callaway 58f7f1
+static int is_sun4v()
Tom Callaway 58f7f1
+{
Tom Callaway 58f7f1
+	char buffer[4096], *p;
Tom Callaway 58f7f1
+	int fd = open("/proc/cpuinfo", O_RDONLY);
Tom Callaway 58f7f1
+	if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
Tom Callaway 58f7f1
+		rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
Tom Callaway 58f7f1
+		close(fd);
Tom Callaway 58f7f1
+		return 0;
Tom Callaway 58f7f1
+	}
Tom Callaway 58f7f1
+	close(fd);
Tom Callaway 58f7f1
+
Tom Callaway 58f7f1
+	p = strstr(buffer, "type");
Tom Callaway 58f7f1
+	p = strtok(p, "\n");
Tom Callaway 58f7f1
+	p = strstr(p, "sun");
Tom Callaway 58f7f1
+	if (p == NULL) {
Tom Callaway 58f7f1
+		rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'type' line\n"));
Tom Callaway 58f7f1
+		return 0;
Tom Callaway 58f7f1
+	} else if (strcmp(p, "sun4v") == 0) {
Tom Callaway 58f7f1
+		return 1;
Tom Callaway 58f7f1
+	}
Tom Callaway 58f7f1
+	return 0;
Tom Callaway 58f7f1
+}
Tom Callaway 58f7f1
+#endif
Tom Callaway 58f7f1
+
Tom Callaway 58f7f1
 
Tom Callaway 58f7f1
 #	if defined(__linux__) && defined(__i386__)
Tom Callaway 58f7f1
 #include <setjmp.h>
Phil Knirsch 1cb882
@@ -1178,6 +1203,13 @@ static void defaultMachine(const char **
Tom Callaway 58f7f1
 		personality(oldpers);
Tom Callaway 58f7f1
 	    }
Tom Callaway 58f7f1
 	}
Tom Callaway 58f7f1
+	if (is_sun4v()){
Tom Callaway 58f7f1
+	    if (strcmp(un.machine, "sparcv9") == 0 || strcmp(un.machine, "sparc") == 0 ) {
Tom Callaway 58f7f1
+	        strcpy(un.machine, "sparcv9v");
Tom Callaway 58f7f1
+	    } else if (strcmp(un.machine, "sparc64") == 0 ) {
Tom Callaway 58f7f1
+	        strcpy(un.machine, "sparc64v");
Tom Callaway 58f7f1
+	    }
Tom Callaway 58f7f1
+	}
Tom Callaway 58f7f1
 #	endif	/* sparc*-linux */
Tom Callaway 58f7f1
 
Phil Knirsch 1cb882
 #	if defined(__linux__) && defined(__powerpc__)
Phil Knirsch 1cb882
diff -up rpm-4.9.1.3/rpmrc.in.niagara rpm-4.9.1.3/rpmrc.in
Phil Knirsch 1cb882
--- rpm-4.9.1.3/rpmrc.in.niagara	2012-04-19 17:06:23.131476769 +0200
Phil Knirsch 1cb882
+++ rpm-4.9.1.3/rpmrc.in	2012-04-19 17:06:23.135738996 +0200
Phil Knirsch 1cb882
@@ -316,7 +316,7 @@ arch_compat: sun4c: sparc
Tom Callaway 58f7f1
 arch_compat: sun4d: sparc
Tom Callaway 58f7f1
 arch_compat: sun4m: sparc
Tom Callaway 58f7f1
 arch_compat: sun4u: sparc64
Tom Callaway 58f7f1
-arch_compat: sparc64v: sparc64
Tom Callaway 58f7f1
+arch_compat: sparc64v: sparc64 sparcv9v
Tom Callaway 58f7f1
 arch_compat: sparc64: sparcv9
Tom Callaway 58f7f1
 arch_compat: sparcv9v: sparcv9
Tom Callaway 58f7f1
 arch_compat: sparcv9: sparcv8