Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs17:/tmp/cvs-serv31878

Modified Files:
      Tag: branch_0_27
        ChangeLog VirtPackage.pm 
Log Message:
fix detection of modular X.org and cctools, fix 64-bit detection to not 
assume sysctl return-code means success (backport from HEAD);
as out to tempfile instead of a.out pollution (backport from HEAD)


Index: VirtPackage.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/VirtPackage.pm,v
retrieving revision 1.118.4.3
retrieving revision 1.118.4.4
diff -u -d -r1.118.4.3 -r1.118.4.4
--- VirtPackage.pm      12 Jun 2007 22:21:02 -0000      1.118.4.3
+++ VirtPackage.pm      14 Jun 2007 19:01:58 -0000      1.118.4.4
@@ -47,7 +47,7 @@
 # you must not print to STDOUT.
 
 use Fink::Config qw($config $basepath);
-use POSIX qw(uname);
+use POSIX qw(uname tmpnam);
 use Fink::Status;
 
 use constant STATUS_PRESENT => "install ok installed";
@@ -172,7 +172,18 @@
        $hash->{package} = "64bit-cpu";
 
 # different sysctl variables for intel and ppc
-       if ((`sysctl hw.optional.x86_64 2>/dev/null`) or (`sysctl 
hw.optional.64bitops 2>/dev/null`)) {
+       my $is64bit = 0;
+       if (open(SYSCTL, 'sysctl -a')) {
+               my ($key, $value);
+               while (<SYSCTL>) {
+                       ($key, $value) = $_ =~ /^(\S+)\s*\:\s*(.*?)\s*$/;
+                       if ($key =~ 
/^(hw.optional.x86_64|hw.optional.64bitops|hw.cpu64bit_capable)$/ and $value eq 
"1") {
+                               $is64bit = 1;
+                       }
+               }
+               close(SYSCTL);
+       }
+       if ($is64bit) {
                print STDERR "64 bit capable\n" if ($options{debug});
                $hash->{status} = STATUS_PRESENT;
        } else {
@@ -619,13 +630,17 @@
        # create dummy object for cctools version, if version was found in 
Config.pm
        print STDERR "- checking for cctools version... " if ($options{debug});
 
-       if (-x "/usr/bin/ld" and -x "/usr/bin/what") {
-               my $LD_OUTPUT = `/usr/bin/ld -v 2>&1`;
+       if (-x "/usr/bin/as" and -x "/usr/bin/what") {
+               my $LD_OUTPUT = '';
+               if (my $tempfile = tmpnam()) {
+                       $LD_OUTPUT = `/usr/bin/as -v 2>&1 </dev/null -o 
$tempfile`;
+                       unlink $tempfile;
+               } else {
+                       print STDERR "unable to get temporary file: $!" if 
($options{debug});
+               };
                if ($LD_OUTPUT =~ /^.*version cctools-(\d+).*?$/) {
                        $cctools_version = $1;
-               } elsif ($LD_OUTPUT =~ /^.*PROJECT\:ld64\-([\d\.]+).*?$/) {
-                       $cctools_version = '1000'; # FIXME: how do we find out 
what cctools we're using?
-               } elsif (`/usr/bin/what /usr/bin/ld` =~ 
/^.*PROJECT:\s*cctools-(\d+).*?$/) {
+               } elsif (-x "/usr/bin/ld" and `/usr/bin/what /usr/bin/ld` =~ 
/^.*PROJECT:\s*cctools-(\d+).*?$/) {
                        $cctools_version = $1;
                }
        } else {
@@ -1531,7 +1546,7 @@
                                if (-x $xdir . '/bin/' . $binary) {
                                        if (open (XBIN, "$xdir/bin/$binary 
-version -iokit 2>\&1 |")) {
                                                while (my $line = <XBIN>) {
-                                                       if ($line =~ /(XFree86 
Version|X Protocol.* Release|X.org Release) ([\d\.]+)/) {
+                                                       if ($line =~ 
/(?:XFree86 Version|X Protocol.* Release|X.org Release) ([\d\.]+)/) {
                                                                $XF_VERSION = 
$1;
                                                                
@XF_VERSION_COMPONENTS = split(/\.+/, $XF_VERSION, 4);
                                                                last;

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1441.2.12
retrieving revision 1.1441.2.13
diff -u -d -r1.1441.2.12 -r1.1441.2.13
--- ChangeLog   14 Jun 2007 18:51:13 -0000      1.1441.2.12
+++ ChangeLog   14 Jun 2007 19:01:58 -0000      1.1441.2.13
@@ -2,6 +2,11 @@
 
        * Services.pm: fix possible undefined hash key; be more forgiving (and 
        smarter) about the version-string we return (backport from HEAD)
+       * VirtPackage.pm: fix detection of modular X.org and cctools,
+       fix 64-bit detection to not assume sysctl return-code means
+       success (backport from HEAD)
+       * VirtPackage.pm: as out to tempfile instead of a.out pollution
+       (backport from HEAD)
 
 2007-06-12  Daniel Macks  <[EMAIL PROTECTED]>
 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to