[52365] branches/images-and-archives/base/src

blb at macports.org blb at macports.org
Sun Jun 14 20:38:23 PDT 2009


Revision: 52365
          http://trac.macports.org/changeset/52365
Author:   blb at macports.org
Date:     2009-06-14 20:38:23 -0700 (Sun, 14 Jun 2009)
Log Message:
-----------
Move temporary dir finding to a proc to avoid duplication; pass --same-owner to tar to avoid issues with group following /tmp group ownership

Modified Paths:
--------------
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/registry1.0/registry.tcl

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-06-15 03:25:43 UTC (rev 52364)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-06-15 03:38:23 UTC (rev 52365)
@@ -2645,6 +2645,18 @@
     return
 }
 
+# Return a good temporary directory to use; /tmp if TMPDIR is not set
+# in the environment
+proc macports::gettmpdir {args} {
+    global env
+
+    if {[info exists env(TMPDIR)]} {
+        return $env(TMPDIR)
+    } else {
+        return "/tmp"
+    }
+}
+
 # Procedure to install an image file; protocols currently supported
 # are file:, https?:, and ftp:.
 proc macports::install_image {imageurl} {
@@ -2658,11 +2670,8 @@
 # the registry as installed, but not active.
 proc macports::install_register_imagefile {imagefile} {
     global env macports::portimagefilepath macports::prefix
-    if {[info exists env(TMPDIR)]} {
-        set mytempdir [mkdtemp [file join $env(TMPDIR) mpimageXXXXXXXX]]
-    } else {
-        set mytempdir [mkdtemp [file join /tmp mpimageXXXXXXXX]]
-    }
+    set mytempdir [mkdtemp [file join [gettmpdir] mpimageXXXXXXXX]]
+    ui_msg "mytempdir is $mytempdir"
     set startpwd [pwd]
     try {
         if {[catch {cd $mytempdir} err]} {

Modified: branches/images-and-archives/base/src/registry1.0/registry.tcl
===================================================================
--- branches/images-and-archives/base/src/registry1.0/registry.tcl	2009-06-15 03:25:43 UTC (rev 52364)
+++ branches/images-and-archives/base/src/registry1.0/registry.tcl	2009-06-15 03:38:23 UTC (rev 52365)
@@ -470,11 +470,8 @@
 		lappend imagefiles [lindex $content_element 0]
 	}
 
-	if {[info exists env(TMPDIR)]} {
-		set extractdir [mkdtemp [file join $env(TMPDIR) mpextractXXXXXXXX]]
-	} else {
-		set extractdir [mkdtemp [file join /tmp mpextractXXXXXXXX]]
-	}
+	set extractdir [mkdtemp [file join [macports::gettmpdir] mpextractXXXXXXXX]]
+    ui_msg "extractdir is $extractdir"
 	set startpwd [pwd]
 	try {
 		if {[catch {cd $extractdir} err]} {
@@ -489,7 +486,7 @@
 		if {[catch {system "$tarcmd -xf $macport_file files.tar.bz2"} err]} {
 			throw MACPORTS $err
 		}
-		if {[catch {system "$bzipcmd -dc files.tar.bz2 | $tarcmd -xpvf -"} err]} {
+		if {[catch {system "$bzipcmd -dc files.tar.bz2 | $tarcmd -xpvf - --same-owner"} err]} {
 			throw MACPORTS $err
 		}
 		_activate_contents $name $imagefiles $extractdir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090614/7ce06083/attachment-0001.html>


More information about the macports-changes mailing list