Update of /cvsroot/fink/experimental/thesin/finkinfo/test
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv22608

Modified Files:
        DarwinSysInfo.pl 
Log Message:
bug fixes and update to use fink libs and Intel support

Index: DarwinSysInfo.pl
===================================================================
RCS file: /cvsroot/fink/experimental/thesin/finkinfo/test/DarwinSysInfo.pl,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- DarwinSysInfo.pl    5 Jan 2005 15:47:58 -0000       1.30
+++ DarwinSysInfo.pl    12 May 2006 20:56:57 -0000      1.31
@@ -36,7 +36,7 @@
 } else {
   $configfile = "$ENV{HOME}/darwininfo.conf";
 }
-my $version = "0.4.2";
+my $version = "0.4.3";
 my $scriptname = "Darwin SysInfo";
 
 IRC::print "\0034Loading\003\002 $scriptname $version Script\002\n";
@@ -44,6 +44,11 @@
 # Try to load the config
 LoadConfig();
 
+if ($BASEPATH) {
+  IRC::print "\003\002Enabling Fink Perl Modules\002\n";
+  use lib $BASEPATH."/lib/perl5/";
+}
+
 IRC::print "\003\002Use \002\0034/infohelp\003\002 for more info and 
commands.\002\n";
 IRC::register("$scriptname", "$version", "", "");
 
@@ -387,25 +392,39 @@
   chomp($ARCH = `uname -p`);
   if ($ARCH =~ /^powerpc/i) {
     $ARCH = "PowerPC";
-  } elsif ($ARCH =~ /^86/i) {
-    $ARCH = "x86";
+  } elsif ($ARCH =~ /^i386/i) {
+    $ARCH = "i386";
   } else {
     $ARCH = "Unknown";
   }
 
-  chomp($TYPE = `ioreg | grep $ARCH`);
-  if ($TYPE =~ /.+$ARCH,(.+)@.+/) {
-    $TYPE = $1;
-  } else {
-    $TYPE = "Unknown";
-  }
-
   my $truetype;
-  if ($TYPE eq "750") {
-    $truetype = "G3";
-  } elsif ($TYPE eq "970") {
-    $truetype = "G5";
+  my $speed;
+  if ($ARCH eq "PowerPC") {
+    chomp($TYPE = `ioreg | grep $ARCH`);
+    if ($TYPE =~ /.+$ARCH,(.+)@.+/) {
+      $TYPE = $1;
+    } else {
+      $TYPE = "Unknown";
+    }
+
+    if ($TYPE eq "750") {
+      $truetype = "G3";
+    } elsif ($TYPE eq "970") {
+      $truetype = "G5";
+    } else {
+      $truetype = $TYPE;
+    }
+  } elsif ($ARCH eq "i386") {
+    chomp($TYPE=`sysctl machdep.cpu.brand_string`);
+    $TYPE =~ s/machdep.cpu.brand_string[ =|:] //;
+    ($truetype, $speed) = split(/CPU/, $TYPE);
+    $truetype =~ s/^\s*//;
+    $truetype =~ s/\s*$//;
+    $speed =~ s/^\s*//;
+    $speed =~ s/\s*$//;
   } else {
+    $TYPE = "Unknown";
     $truetype = $TYPE;
   }
 
@@ -421,13 +440,23 @@
     $MODEL = "#? $ARCH/$truetype";
   }
 
-  chomp($CPU = `ioreg -n $ARCH,$TYPE | grep '"clock-frequency" ='`);
-  if ($CPU =~ /\s*[<](.+)[>]\s*/) {
-    $CPU = hex($1)/1000000;
-    if (int($CPU) > 999) {
-      $CPU = sprintf("%.0fGHz", $CPU/1000);
+  if ($ARCH eq "PowerPC") {
+    chomp($CPU = `ioreg -n $ARCH,$TYPE | grep '"clock-frequency" ='`);
+    if ($CPU =~ /\s*[<](.+)[>]\s*/) {
+      $CPU = hex($1)/1000000;
+      if (int($CPU) > 999) {
+        $CPU = sprintf("%.0fGHz", $CPU/1000);
+      } else {
+        $CPU = sprintf("%.0fMHz", $CPU);
+      }
     } else {
-      $CPU = sprintf("%.0fMHz", $CPU);
+      $CPU = "Unknown ($CPU)";
+    }
+  } elsif ($ARCH eq "i386") {
+    if ($speed =~ /([0-9]?.?[0-9]+[M]?[G]?Hz$)/) {
+      $CPU = $1;
+    } else {
+      $CPU = "Unknown ($CPU)";
     }
   } else {
     $CPU = "Unknown ($CPU)";
@@ -607,6 +636,8 @@
     $UPTIME = sprintf("%dd, %dm", $1, $2); 
   } elsif ($days =~ /\s{0,2}(.+):(.+)/) {
     $UPTIME = sprintf("%dh, %dm", $1, $2);
+  } elsif ($days =~ /\s{0,2}(.+) hrs{0,1}/) {
+    $UPTIME = sprintf("%dh", $1);
   } elsif ($days =~ /\s{0,1}(.+) mins{0,1}/) {
     $UPTIME = sprintf("%dm", $1);
   } else {
@@ -738,12 +769,14 @@
           $buildline = 0;
         } elsif ($versline) {
           if ($infoline =~ /\<string\>(.+)\<\/string\>/) {
-            $TOOLVERS = "Xcode $1";
+            $TOOLVERS = "XCode $1";
           }
           $versline = 0;
         } else {
           if ($infoline =~ /ProductBuildVersion/) {
             $buildline = 1;
+          } elsif ($infoline =~ /BuildVersion/) {
+            $buildline = 1;
           } elsif ($infoline =~ /CFBundleShortVersionString/) {
             $versline = 1;
           }
@@ -753,7 +786,7 @@
 
     foreach $infoline (@gcc_vers) {
       chomp($infoline);
-      if ($infoline =~ /^cc \(GCC\) ([0-9.]+.*)/) {
+      if ($infoline =~ /\(GCC\) ([0-9.]+.*)/) {
         $GCCVERS = $1;
       } elsif ($infoline =~ /^([0-9.]+)/) {
         $GCCVERS = $1;
@@ -802,8 +835,8 @@
     return 1;
   }
 
-  $pos_e = rindex ($song_file, ".");
-  $file_ext = substr ($song_file, $pos_e + 1);
+  $pos_e = rindex($song_file, ".");
+  $file_ext = substr($song_file, $pos_e + 1);
   $file_ext =~ tr/a-z/A-Z/;
   return 0;
 }
@@ -843,8 +876,8 @@
      return 1;
   }
 
-  $pos_e = rindex ($song_file, ".");
-  $file_ext = substr ($song_file, $pos_e + 1);
+  $pos_e = rindex($song_file, ".");
+  $file_ext = substr($song_file, $pos_e + 1);
   $file_ext =~ tr/a-z/A-Z/;
   return 0;
 }



_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to