[39202] branches/gsoc08-privileges/base/src/port1.0/portutil.tcl

pmagrath at macports.org pmagrath at macports.org
Tue Aug 12 07:35:49 PDT 2008


Revision: 39202
          http://trac.macosforge.org/projects/macports/changeset/39202
Author:   pmagrath at macports.org
Date:     2008-08-12 07:35:48 -0700 (Tue, 12 Aug 2008)
Log Message:
-----------
Fix bug whereby workpath was being detected as unwritable due to non-existance.

Modified Paths:
--------------
    branches/gsoc08-privileges/base/src/port1.0/portutil.tcl

Modified: branches/gsoc08-privileges/base/src/port1.0/portutil.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-08-12 14:26:21 UTC (rev 39201)
+++ branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-08-12 14:35:48 UTC (rev 39202)
@@ -1404,6 +1404,13 @@
 	# descalate privileges - only ran if macports stated with sudo
 	dropPrivileges
     
+    if { ![file exists $workpath] } {
+        if {[catch {set result [file mkdir $workpath]} result]} {
+            global errorInfo
+            ui_debug "mkdir $workpath: $errorInfo"
+        }
+    }
+    
     # if unable to write to workpath, implies running without either root privileges 
     # or a shared directory owned by the group so use ~/.macports
     if { ![file writable $workpath] } {
@@ -1421,7 +1428,7 @@
     
 		# do tilde expansion manually - tcl won't expand tildes automatically for curl, etc.
 		if {[info exists env(HOME)]} {
-			# HOME evnironment var is set, use it.
+			# HOME environment var is set, use it.
 			set userhome "$env(HOME)"
 		} else {
 			# the environment var isn't set, make an educated guess
@@ -1462,6 +1469,8 @@
 		set distpath $newdistpath
 		
 		ui_debug "Going to use $newworkpath for statefile."
+    } else {
+    	set usealtworkpath no
     }
     # end gsoc08-privileges
 
@@ -1486,6 +1495,7 @@
 
     # Create a symlink to the workpath for port authors 
     if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
+		ui_debug "Attempting ln -sf $workpath $worksymlink"
 		exec ln -sf $workpath $worksymlink
     }
     
@@ -1501,6 +1511,7 @@
         }
     }
     flock $fd -exclusive
+    
     return $fd
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080812/696b8456/attachment.html 


More information about the macports-changes mailing list