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

Modified Files:
        ChangeLog VirtPackage.pm 
Log Message:
Use apple's own `defaults` command instead of dumping and parsing xml tempfile


Index: VirtPackage.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/VirtPackage.pm,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- VirtPackage.pm      20 Jul 2007 00:51:51 -0000      1.135
+++ VirtPackage.pm      20 Jul 2007 21:56:22 -0000      1.136
@@ -631,7 +631,8 @@
 
        $hash = {};
        $hash->{package} = "xcode";
-       $hash->{status} = STATUS_PRESENT;
+       $hash->{version} = '0-0';
+       $hash->{status} = STATUS_ABSENT;
        $hash->{description} = "[virtual package representing the developer 
tools]";
        $hash->{homepage} = 
"http://www.finkproject.org/faq/usage-general.php#virtpackage";;
        $hash->{builddependsonly} = "true";
@@ -645,40 +646,24 @@
 (free registration required)
 END
        $hash->{compilescript} = &gen_compile_script($hash);
-       my $xcode_version = 0;
 
-       if (-f "/Developer/Applications/Xcode.app/Contents/version.plist" and 
-x "/usr/bin/plutil") {
-               if (my $tempfile = tmpnam()) {
-                       if (system("/usr/bin/plutil -convert xml1 -o 
'$tempfile' -s /Developer/Applications/Xcode.app/Contents/version.plist") == 0) 
{
-                               my $last_was_version = 0;
-                               if (open(PLUTIL, $tempfile)) {
-                                       while (<PLUTIL>) {
-                                               if 
(/CFBundleShortVersionString/) {
-                                                       $last_was_version++;
-                                               } elsif ($last_was_version) {
-                                                       ($xcode_version) = $_ 
=~ /<string>(.*?)<\/string>/;
-                                                       last;
-                                               }
-                                       }
-                                       close(PLUTIL);
-                                       unlink($tempfile);
-                               } else {
-                                       print STDERR "unable to open the 
property list temp file: $!" if ($options{debug});
-                               }
-                       } else {
-                               print STDERR "unable to run plutil: $!" if 
($options{debug});
-                       }
+       my $result = `defaults read 
/Dxeveloper/Applications/Xcode.app/Contents/version CFBundleShortVersionString 
2>&1`;
+       if (not $?) {
+               # didn't fail
+               chomp $result;
+               $hash->{version} = $result . '-1';
+               print STDERR $hash->{version}, "\n" if $options{debug};
+               $hash->{status} = STATUS_PRESENT;
+       } elsif ($options{debug} || 1) {
+               # failed, so display whatever error message or diagnostics we 
can find
+               if ($!) {
+                       
+                       print STDERR "unknown ($!)\n";      # have ERRNO 
string, so use that
+               } else {
+                       print STDERR "unknown:\n$result\n";     # dump 
command's own diagnostics
                }
        }
 
-       if ($xcode_version) {
-               $hash->{version} = $xcode_version . '-1';
-               print STDERR $hash->{version}, "\n" if ($options{debug});
-       } else {
-               $hash->{version} = '0-0';
-               print STDERR "unknown\n" if ($options{debug});
-               $hash->{status} = STATUS_ABSENT;
-       }
        $self->{$hash->{package}} = $hash;
 
 =item "cctools-I<XXX>"

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1482
retrieving revision 1.1483
diff -u -d -r1.1482 -r1.1483
--- ChangeLog   20 Jul 2007 00:51:51 -0000      1.1482
+++ ChangeLog   20 Jul 2007 21:56:21 -0000      1.1483
@@ -1,3 +1,7 @@
+2007-07-15  Daniel Macks  <[EMAIL PROTECTED]>
+
+       * VirtPackage.pm: use apple's own plist parser
+
 2007-07-19  Benjamin Reed  <[EMAIL PROTECTED]>
 
        * VirtPackage.pm: add an "xcode" virtual package


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to