hpux hacks
authorewt <devnull@localhost>
Thu, 28 Aug 1997 18:49:01 +0000 (18:49 +0000)
committerewt <devnull@localhost>
Thu, 28 Aug 1997 18:49:01 +0000 (18:49 +0000)
CVS patchset: 1807
CVS date: 1997/08/28 18:49:01

CHANGES
lib/rpmrc.c

diff --git a/CHANGES b/CHANGES
index 08fbd29..9509f92 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,8 @@
        - replaced include of <malloc.h> with includes of <stdlib.h>
        - fixed md5sum of source packages w/ a buildroot is used
        - fixed bugs installing version 1 packages
+       - remove hyphens from uname() result (specifically for HP-UX)
+       - hacks to recognize architecture under parisc
 
 2.4.4 -> 2.4.5:
        - call getpwnam()/endpwent() once before a chroot(), forcing name 
index 3f414d2..7bc1926 100644 (file)
@@ -660,6 +660,7 @@ static int doReadRC(int fd, char * filename) {
 static void defaultMachine(char ** arch, char ** os) {
     static struct utsname un;
     static int gotDefaults = 0;
+    char * chptr;
 
     if (!gotDefaults) {
        uname(&un);
@@ -668,6 +669,43 @@ static void defaultMachine(char ** arch, char ** os) {
        } else if (!strncmp(un.sysname, "IP", 2)) {
            un.sysname[2] = '\0';
        }
+
+       /* get rid of the hyphens in the sysname */
+       chptr = un.machine;
+       while (*chptr++)
+           if (*chptr == '/') *chptr = '-';
+
+       #if defined(__hpux__) && defined(_SC_CPU_VERSION)
+       {
+           int cpu_version = sysconf(_SC_CPU_VERSION);
+
+           #if defined(CPU_HP_MC68020)
+               if (cpu_version == CPU_HP_MC68020)
+                   strcpy(us.machine, "m68k");
+           #endif
+           #if defined(CPU_HP_MC68030)
+               if (cpu_version == CPU_HP_MC68030)
+                   strcpy(us.machine, "m68k");
+           #endif
+           #if defined(CPU_HP_MC68040)
+               if (cpu_version == CPU_HP_MC68040)
+                   strcpy(us.machine, "m68k");
+           #endif
+
+           #if defined(CPU_PA_RISC1_0)
+               if (cpu_version == CPU_PA_RISC1_0)
+                   strcpy(us.machine, "parisc");
+           #endif
+           #if defined(CPU_PA_RISC1_1)
+               if (cpu_version == CPU_PA_RISC1_1)
+                   strcpy(us.machine, "parisc");
+           #endif
+           #if defined(CPU_PA_RISC1_2)
+               if (cpu_version == CPU_PA_RISC1_2)
+                   strcpy(us.machine, "parisc");
+           #endif
+       }
+       #endif
     }
 
     if (arch) *arch = un.machine;