[106641] trunk/base/src/port1.0/portutil.tcl

jmr at macports.org jmr at macports.org
Mon Jun 3 00:29:08 PDT 2013


Revision: 106641
          https://trac.macports.org/changeset/106641
Author:   jmr at macports.org
Date:     2013-06-03 00:29:07 -0700 (Mon, 03 Jun 2013)
Log Message:
-----------
use a suitable temp dir for the twostep cases in extract_archive_metadata

Modified Paths:
--------------
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2013-06-03 06:39:48 UTC (rev 106640)
+++ trunk/base/src/port1.0/portutil.tcl	2013-06-03 07:29:07 UTC (rev 106641)
@@ -2535,7 +2535,22 @@
 proc extract_archive_metadata {archive_location archive_type metadata_type} {
     set qflag ${portutil::autoconf::tar_q}
     set raw_contents ""
+
     switch -- $archive_type {
+        xar -
+        cpgz -
+        cpio {
+            set twostep 1
+            global workpath
+            if {[file isdirectory ${workpath}/.tmp]} {
+                set tempdir [mkdtemp ${workpath}/.tmp/portarchiveXXXXXXXX]
+            } else {
+                set tempdir [mkdtemp /tmp/portarchiveXXXXXXXX]
+            }
+        }
+    }
+
+    switch -- $archive_type {
         tbz -
         tbz2 {
             set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOj${qflag}f $archive_location ./+CONTENTS]
@@ -2553,25 +2568,23 @@
             set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location --use-compress-program [findBinary lzma ""] ./+CONTENTS]
         }
         xar {
-            system "cd ${workpath} && [findBinary xar ${portutil::autoconf::xar_path}] -xf $archive_location +CONTENTS"
-            set twostep 1
+            system -W ${tempdir} "[findBinary xar ${portutil::autoconf::xar_path}] -xf $archive_location +CONTENTS"
         }
         zip {
             set raw_contents [exec [findBinary unzip ${portutil::autoconf::unzip_path}] -p $archive_location +CONTENTS]
         }
         cpgz {
-            system "cd ${workpath} && [findBinary pax ${portutil::autoconf::pax_path}] -rzf $archive_location +CONTENTS"
-            set twostep 1
+            system -W ${tempdir} "[findBinary pax ${portutil::autoconf::pax_path}] -rzf $archive_location +CONTENTS"
         }
         cpio {
-            system "cd ${workpath} && [findBinary pax ${portutil::autoconf::pax_path}] -rf $archive_location +CONTENTS"
-            set twostep 1
+            system -W ${tempdir} "[findBinary pax ${portutil::autoconf::pax_path}] -rf $archive_location +CONTENTS"
         }
     }
     if {[info exists twostep]} {
-        set fd [open "${workpath}/+CONTENTS"]
+        set fd [open "${tempdir}/+CONTENTS"]
         set raw_contents [read $fd]
         close $fd
+        file delete -force $tempdir
     }
     if {$metadata_type == "contents"} {
         set contents {}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130603/08ca8315/attachment-0001.html>


More information about the macports-changes mailing list