Tom Callaway 58f7f1
diff -rNu rpm-4.6.0-orig/lib/rpmrc.c rpm-4.6.0/lib/rpmrc.c
Tom Callaway 58f7f1
--- rpm-4.6.0-orig/lib/rpmrc.c	2009-03-09 21:54:49.000000000 -0500
Tom Callaway 58f7f1
+++ rpm-4.6.0/lib/rpmrc.c	2009-03-11 12:00:44.000000000 -0500
Tom Callaway 58f7f1
@@ -763,6 +763,31 @@
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>
Tom Callaway 58f7f1
@@ -1179,6 +1204,13 @@
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
 
Tom Callaway 58f7f1
 #	if defined(__GNUC__) && defined(__alpha__)
Tom Callaway 58f7f1
diff -rNu rpm-4.6.0-orig/rpmrc.in rpm-4.6.0/rpmrc.in
Tom Callaway 58f7f1
--- rpm-4.6.0-orig/rpmrc.in	2009-03-09 21:54:49.000000000 -0500
Tom Callaway 58f7f1
+++ rpm-4.6.0/rpmrc.in	2009-03-11 11:50:49.000000000 -0500
Tom Callaway 58f7f1
@@ -312,7 +312,7 @@
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