[37344] branches/gsoc08-privileges/base/src/port1.0

pmagrath at macports.org pmagrath at macports.org
Tue Jun 3 15:20:39 PDT 2008


Revision: 37344
          http://trac.macosforge.org/projects/macports/changeset/37344
Author:   pmagrath at macports.org
Date:     2008-06-03 15:20:38 -0700 (Tue, 03 Jun 2008)

Log Message:
-----------
Updates to Port API.

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

Modified: branches/gsoc08-privileges/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portfetch.tcl	2008-06-03 22:11:31 UTC (rev 37343)
+++ branches/gsoc08-privileges/base/src/port1.0/portfetch.tcl	2008-06-03 22:20:38 UTC (rev 37344)
@@ -628,6 +628,12 @@
     global distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
     
     if {[info exists distpath] && [info exists dist_subdir] && ![info exists fetch_init_done]} {
+		# start gsoc08-privileges
+    	if {![file writable $distpath]} {
+			set distpath "/Users/[exec whoami]/.macports/[ string range $distpath 1 end ]"
+			ui_warn "Going to use $distpath for fetch."
+    	}
+    	# end gsoc08-privileges
 	    set distpath ${distpath}/${dist_subdir}
 	    set fetch_init_done yes
     }

Modified: branches/gsoc08-privileges/base/src/port1.0/portutil.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-06-03 22:11:31 UTC (rev 37343)
+++ branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-06-03 22:20:38 UTC (rev 37344)
@@ -1375,11 +1375,40 @@
 proc open_statefile {args} {
     global workpath worksymlink place_worksymlink portname portpath ports_ignore_older
     
+    # start gsoc08-privileges
+    if {![file writable $workpath] && [string first "~/.macports" $workpath] == -1} {
+    
+    	set userhome "/Users/[exec whoami]"
+    	
+        set newworkpath "$userhome/.macports/[ string range $workpath 1 end ]"
+		set newworksymlink "$userhome/.macports/[ string range $worksymlink 1 end ]"
+        
+        set sourcepath [string map {"work" ""} $worksymlink] 
+        set newsourcepath "$userhome/.macports/[ string range $sourcepath 1 end ]"
+        
+        if {![file exists ${sourcepath}Portfile] } {
+			file mkdir $newsourcepath
+			ui_debug "$newsourcepath created"
+        	ui_debug "Going to copy: ${sourcepath}Portfile"
+        	file copy ${sourcepath}Portfile $newsourcepath
+        }
+        
+        set workpath $newworkpath
+        set worksymlink $newworksymlink
+        
+        ui_warn "Going to use $newworkpath for statefile."
+    } else {
+    	set notroot no
+    }
+    # end gsoc08-privileges
+
     if {![file isdirectory $workpath]} {
         file mkdir $workpath
     }
+    
     # flock Portfile
     set statefile [file join $workpath .macports.${portname}.state]
+    
     if {[file exists $statefile]} {
         if {![file writable $statefile]} {
             return -code error "$statefile is not writable - check permission on port directory"
@@ -1394,7 +1423,8 @@
 
     # Create a symlink to the workpath for port authors 
     if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
-        exec ln -sf $workpath $worksymlink
+    	#pmagrath TODO: fix this quick hack.
+		#exec ln -sf $workpath $worksymlink
     }
     
     set fd [open $statefile a+]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080603/20335312/attachment.htm 


More information about the macports-changes mailing list