[38016] branches/gsoc08-privileges/base/src

pmagrath at macports.org pmagrath at macports.org
Wed Jul 2 13:58:27 PDT 2008


Revision: 38016
          http://trac.macosforge.org/projects/macports/changeset/38016
Author:   pmagrath at macports.org
Date:     2008-07-02 13:58:27 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Fix a bug whereby the macportsuser variable was not set  correctly.
Copy files with Portfile to user build location.

Modified Paths:
--------------
    branches/gsoc08-privileges/base/src/macports1.0/macports.tcl
    branches/gsoc08-privileges/base/src/port1.0/port_autoconf.tcl.in
    branches/gsoc08-privileges/base/src/port1.0/portdestroot.tcl
    branches/gsoc08-privileges/base/src/port1.0/portinstall.tcl
    branches/gsoc08-privileges/base/src/port1.0/portmain.tcl
    branches/gsoc08-privileges/base/src/port1.0/portutil.tcl

Modified: branches/gsoc08-privileges/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/macports1.0/macports.tcl	2008-07-02 20:37:41 UTC (rev 38015)
+++ branches/gsoc08-privileges/base/src/macports1.0/macports.tcl	2008-07-02 20:58:27 UTC (rev 38016)
@@ -45,7 +45,8 @@
         porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir universal_target universal_sysroot universal_archs"
+        applications_dir frameworks_dir universal_target universal_sysroot universal_archs \
+        macportsuser"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
         portdbpath portpath portbuildpath auto_path prefix prefix_frozen x11prefix portsharepath \
@@ -320,6 +321,7 @@
     global macports::destroot_umask
     global macports::libpath
     global macports::prefix
+	global macports::macportsuser
     global macports::prefix_frozen
     global macports::x11prefix
     global macports::registry.installtype

Modified: branches/gsoc08-privileges/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/port_autoconf.tcl.in	2008-07-02 20:37:41 UTC (rev 38015)
+++ branches/gsoc08-privileges/base/src/port1.0/port_autoconf.tcl.in	2008-07-02 20:58:27 UTC (rev 38016)
@@ -46,5 +46,6 @@
 	variable install_user "@DSTUSR@"
 	variable install_group "@DSTGRP@"
 	variable prefix "@prefix_expanded@"
+	variable macportsuser "@RUNUSR@"
 	variable x11prefix "@x11prefix@"
 }

Modified: branches/gsoc08-privileges/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portdestroot.tcl	2008-07-02 20:37:41 UTC (rev 38015)
+++ branches/gsoc08-privileges/base/src/port1.0/portdestroot.tcl	2008-07-02 20:58:27 UTC (rev 38016)
@@ -97,10 +97,9 @@
 		ui_debug "Can't run destroot under sudo without elevated privileges (due to mtree)."
 		ui_debug "Run destroot without sudo to avoid root privileges."
 		ui_debug "Going to escalate privileges back to root."
+		setegid $egid	
 		seteuid $euid	
-		seteuid $egid	
-		ui_debug "euid changed to: [geteuid]"
-		ui_debug "egid changed to: [getegid]"
+		ui_debug "euid changed to: [geteuid]. egid changed to: [getegid]."
 	}
 	# end gsoc08-privileges
 
@@ -119,6 +118,8 @@
     file mkdir "${destroot}/${prefix}"
 
     system "cd \"${destroot}/${prefix}\" && ${mtree} -e -U -f ${portresourcepath}/install/prefix.mtree"
+    
+    ui_debug "destroot_start finished"
 }
 
 proc destroot_main {args} {

Modified: branches/gsoc08-privileges/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portinstall.tcl	2008-07-02 20:37:41 UTC (rev 38015)
+++ branches/gsoc08-privileges/base/src/port1.0/portinstall.tcl	2008-07-02 20:58:27 UTC (rev 38016)
@@ -55,10 +55,9 @@
 	# if started with sudo but have dropped the privileges
 		ui_debug "Can't run install without elevated privileges."
 		ui_debug "Going to escalate privileges back to root."
+		setegid $egid	
 		seteuid $euid	
-		setegid $egid
-		ui_debug "euid changed to: [geteuid]"
-		ui_debug "egid changed to: [getegid]"
+		ui_debug "euid changed to: [geteuid]. egid changed to: [getegid]."
 	}
 	# end gsoc08-privileges
 	

Modified: branches/gsoc08-privileges/base/src/port1.0/portmain.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portmain.tcl	2008-07-02 20:37:41 UTC (rev 38015)
+++ branches/gsoc08-privileges/base/src/port1.0/portmain.tcl	2008-07-02 20:58:27 UTC (rev 38016)
@@ -58,7 +58,6 @@
 default workpath {[getportworkpath_from_buildpath $portbuildpath]}
 default worksymlink {[file join $portpath work]}
 default prefix /opt/local
-default macportsuser {[uid_to_name [getuid]]}
 default x11prefix /usr/X11R6
 default applications_dir /Applications/MacPorts
 default frameworks_dir /Library/Frameworks
@@ -75,6 +74,7 @@
 default worksrcpath {[file join $workpath $worksrcdir]}
 
 # Configure settings
+default macportsuser {${portutil::autoconf::macportsuser}}
 default install.user {${portutil::autoconf::install_user}}
 default install.group {${portutil::autoconf::install_group}}
 

Modified: branches/gsoc08-privileges/base/src/port1.0/portutil.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-07-02 20:37:41 UTC (rev 38015)
+++ branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-07-02 20:58:27 UTC (rev 38016)
@@ -1410,7 +1410,7 @@
 		ui_debug "Privilege desclation not attempted as not running as root."
 	}
     
-    # if unable to write to workpath, implies running without root privileges 
+    # 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] } {
     
@@ -1445,13 +1445,15 @@
 		set sourcepath [string map {"work" ""} $worksymlink] 
 		set newsourcepath "$altprefix/[ string range $sourcepath 1 end ]"
 
-		# copy Portfile if not there already
+		# copy Portfile (and files) if not there already
 		# note to self: should this be done always in case existing Portfile is out of date?
 		if {![file exists ${newsourcepath}Portfile] } {
 			file mkdir $newsourcepath
 			ui_debug "$newsourcepath created"
 			ui_debug "Going to copy: ${sourcepath}Portfile"
 			file copy ${sourcepath}Portfile $newsourcepath
+			ui_debug "Going to copy: ${sourcepath}files"
+			file copy ${sourcepath}files $newsourcepath
 		}
 		
 		set workpath $newworkpath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080702/15966b7c/attachment-0001.html 


More information about the macports-changes mailing list