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

pmagrath at macports.org pmagrath at macports.org
Tue Aug 5 13:21:10 PDT 2008


Revision: 38999
          http://trac.macosforge.org/projects/macports/changeset/38999
Author:   pmagrath at macports.org
Date:     2008-08-05 13:21:10 -0700 (Tue, 05 Aug 2008)
Log Message:
-----------
Use ui_msg instead of ui_error for privileges error. Improve commenting re: Portfile copying.

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

Modified: branches/gsoc08-privileges/base/src/port/port.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port/port.tcl	2008-08-05 19:51:43 UTC (rev 38998)
+++ branches/gsoc08-privileges/base/src/port/port.tcl	2008-08-05 20:21:10 UTC (rev 38999)
@@ -2475,7 +2475,7 @@
         # start gsoc08-privileges
 		if { [geteuid] != 0 && $result == 2} {
 			# mportexec will return an error result code 2 if eval_targets fails due to insufficient privileges.
-			ui_warn "Attempting re-run with 'sudo port'. Executing: 'sudo port $target $portname'."
+			ui_warn "Attempting port action with 'sudo port': 'sudo port $target $portname'."
 			set result 0
 			ui_msg [exec sudo port $target $portname]
 			ui_debug "'sudo port $target $portname' has completed."

Modified: branches/gsoc08-privileges/base/src/port1.0/portutil.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-08-05 19:51:43 UTC (rev 38998)
+++ branches/gsoc08-privileges/base/src/port1.0/portutil.tcl	2008-08-05 20:21:10 UTC (rev 38999)
@@ -1110,7 +1110,7 @@
 ########### Internal Dependency Manipulation Procedures ###########
 
 proc target_run {ditem} {
-    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo
+    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo errorisprivileges
     set result 0
     set skipped 0
     set procedure [ditem_key $ditem procedure]
@@ -1309,7 +1309,11 @@
             write_statefile target $name $target_state_fd
             }
         } else {
-            ui_error "Target $name returned: $errstr"
+        	if {$errorisprivileges != "yes"} {
+            	ui_error "Target $name returned: $errstr"
+            } else {
+            	ui_msg "Target $name returned: $errstr"
+            }
             set result 1
         }
     
@@ -1472,8 +1476,11 @@
 		set sourcepath [string map {"work" ""} $worksymlink] 
 		set newsourcepath "$altprefix/[ string range $sourcepath 1 end ]"
 
-		# copy Portfile (and files) if not there already
-		# note to self: should this be done always in case existing Portfile is out of date?
+		# copy Portfile (and patch files) if not there already
+		# note to maintainers/devs: the original portfile in /opt is ALWAYS the one that will be 
+		#	 read by macports. The copying of the portfile is done to preserve the symlink provided
+		#	 historically by macports from the portfile directory to the work directory.
+		#	 It is NOT read by MacPorts.
 		if {![file exists ${newsourcepath}Portfile] } {
 			file mkdir $newsourcepath
 			ui_debug "$newsourcepath created"
@@ -2334,7 +2341,7 @@
 	
 	if { [getuid] != 0 } {
 		set errorisprivileges yes
-		return -code error "You can not run this port without elevated privileges. You need to re-run with 'sudo port'.";
+		return -code error "port requires root privileges for this action and needs you to type your password for sudo.";
 	}
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080805/4ae39c17/attachment-0001.html 


More information about the macports-changes mailing list