[52032] branches/universal-sanity/base

toby at macports.org toby at macports.org
Mon Jun 8 11:45:32 PDT 2009


Revision: 52032
          http://trac.macports.org/changeset/52032
Author:   toby at macports.org
Date:     2009-06-08 11:45:32 -0700 (Mon, 08 Jun 2009)
Log Message:
-----------
merge from trunk

Modified Paths:
--------------
    branches/universal-sanity/base/configure
    branches/universal-sanity/base/configure.ac
    branches/universal-sanity/base/doc/portgroup.7
    branches/universal-sanity/base/src/macports1.0/macports.tcl
    branches/universal-sanity/base/src/pextlib1.0/Pextlib.c
    branches/universal-sanity/base/src/pextlib1.0/tracelib.c
    branches/universal-sanity/base/src/port/port.tcl
    branches/universal-sanity/base/src/port1.0/port_autoconf.tcl.in
    branches/universal-sanity/base/src/port1.0/portbuild.tcl
    branches/universal-sanity/base/src/port1.0/portconfigure.tcl
    branches/universal-sanity/base/src/port1.0/portdestroot.tcl
    branches/universal-sanity/base/src/port1.0/portextract.tcl
    branches/universal-sanity/base/src/port1.0/portfetch.tcl
    branches/universal-sanity/base/src/port1.0/portinstall.tcl
    branches/universal-sanity/base/src/port1.0/portlivecheck.tcl
    branches/universal-sanity/base/src/port1.0/portmain.tcl
    branches/universal-sanity/base/src/port1.0/portpatch.tcl
    branches/universal-sanity/base/src/port1.0/portutil.tcl

Property Changed:
----------------
    branches/universal-sanity/base/


Property changes on: branches/universal-sanity/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:51872-52031
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/universal-sanity/base/configure
===================================================================
--- branches/universal-sanity/base/configure	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/configure	2009-06-08 18:45:32 UTC (rev 52032)
@@ -722,17 +722,25 @@
 HAVE_LAUNCHD
 HDIUTIL
 MAKE
+BSDMAKE
 ZIP
 UNZIP
 TAR
 SED
 RSYNC
 RMDIR
+PATCH
+NICE
+LIPO
 GZIP
+HG
 GIT
 SVN
 CVS
+FILE
+DSCL
 DITTO
+DIFF
 CPIO
 CP
 CHOWN
@@ -3870,6 +3878,46 @@
 fi
 
 
+# Extract the first word of "diff", so it can be a program name with args.
+set dummy diff; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DIFF+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $DIFF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DIFF="$DIFF" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DIFF="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DIFF=$ac_cv_path_DIFF
+if test -n "$DIFF"; then
+  { $as_echo "$as_me:$LINENO: result: $DIFF" >&5
+$as_echo "$DIFF" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "ditto", so it can be a program name with args.
 set dummy ditto; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -3910,6 +3958,86 @@
 fi
 
 
+# Extract the first word of "dscl", so it can be a program name with args.
+set dummy dscl; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DSCL+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $DSCL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DSCL="$DSCL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DSCL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DSCL=$ac_cv_path_DSCL
+if test -n "$DSCL"; then
+  { $as_echo "$as_me:$LINENO: result: $DSCL" >&5
+$as_echo "$DSCL" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "file", so it can be a program name with args.
+set dummy file; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_FILE+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $FILE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FILE="$FILE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FILE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+FILE=$ac_cv_path_FILE
+if test -n "$FILE"; then
+  { $as_echo "$as_me:$LINENO: result: $FILE" >&5
+$as_echo "$FILE" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "cvs", so it can be a program name with args.
 set dummy cvs; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -4030,6 +4158,46 @@
 fi
 
 
+# Extract the first word of "hg", so it can be a program name with args.
+set dummy hg; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_HG+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $HG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_HG="$HG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_HG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+HG=$ac_cv_path_HG
+if test -n "$HG"; then
+  { $as_echo "$as_me:$LINENO: result: $HG" >&5
+$as_echo "$HG" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "gzip", so it can be a program name with args.
 set dummy gzip; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -4070,6 +4238,126 @@
 fi
 
 
+# Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_LIPO+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $LIPO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LIPO="$LIPO" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_LIPO="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+LIPO=$ac_cv_path_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:$LINENO: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "nice", so it can be a program name with args.
+set dummy nice; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_NICE+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $NICE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NICE="$NICE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NICE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+NICE=$ac_cv_path_NICE
+if test -n "$NICE"; then
+  { $as_echo "$as_me:$LINENO: result: $NICE" >&5
+$as_echo "$NICE" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "patch", so it can be a program name with args.
+set dummy patch; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PATCH+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $PATCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PATCH="$PATCH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PATCH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PATCH=$ac_cv_path_PATCH
+if test -n "$PATCH"; then
+  { $as_echo "$as_me:$LINENO: result: $PATCH" >&5
+$as_echo "$PATCH" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "rmdir", so it can be a program name with args.
 set dummy rmdir; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -4310,6 +4598,46 @@
 fi
 
 
+# Extract the first word of "bsdmake", so it can be a program name with args.
+set dummy bsdmake; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BSDMAKE+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $BSDMAKE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BSDMAKE="$BSDMAKE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BSDMAKE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BSDMAKE=$ac_cv_path_BSDMAKE
+if test -n "$BSDMAKE"; then
+  { $as_echo "$as_me:$LINENO: result: $BSDMAKE" >&5
+$as_echo "$BSDMAKE" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "make", so it can be a program name with args.
 set dummy make; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5

Modified: branches/universal-sanity/base/configure.ac
===================================================================
--- branches/universal-sanity/base/configure.ac	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/configure.ac	2009-06-08 18:45:32 UTC (rev 52032)
@@ -90,17 +90,25 @@
 AC_PATH_PROG(CHOWN, [chown], [], [$PATH:/usr/sbin])
 AC_PATH_PROG(CP, [cp], [])
 AC_PATH_PROG(CPIO, [cpio], [])
+AC_PATH_PROG(DIFF, [diff], [])
 AC_PATH_PROG(DITTO, [ditto], [])
+AC_PATH_PROG(DSCL, [dscl], [])
+AC_PATH_PROG(FILE, [file], [])
 AC_PATH_PROG(CVS, [cvs], [])
 AC_PATH_PROG(SVN, [svn], [])
 AC_PATH_PROG(GIT, [git], [])
+AC_PATH_PROG(HG, [hg], [])
 AC_PATH_PROG(GZIP, [gzip], [])
+AC_PATH_PROG(LIPO, [lipo], [])
+AC_PATH_PROG(NICE, [nice], [])
+AC_PATH_PROG(PATCH, [patch], [])
 AC_PATH_PROG(RMDIR, [rmdir], [])
 AC_PATH_PROG(RSYNC, [rsync], [])
 AC_PATH_PROG(SED, [sed])
 AC_PATH_PROG(TAR, [tar])
 AC_PATH_PROG(UNZIP, [unzip])
 AC_PATH_PROG(ZIP, [zip])
+AC_PATH_PROG(BSDMAKE, [bsdmake])
 AC_PATH_PROG(MAKE, [make])
 AC_PATH_PROG(HDIUTIL, [hdiutil], [])
 AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])

Modified: branches/universal-sanity/base/doc/portgroup.7
===================================================================
--- branches/universal-sanity/base/doc/portgroup.7	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/doc/portgroup.7	2009-06-08 18:45:32 UTC (rev 52032)
@@ -158,26 +158,6 @@
 .Bd -literal -offset indent -compact
 xcode.destroot.settings SKIP_INSTALL=NO
 .Ed
-.It Ic xcode.universal.settings
-Settings passed to the xcode build tool when the +universal variant is selected. These settings should be in the X=Y form.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Bd -literal -offset indent -compact
-ARCHS="${universal_archs}" MACOSX_DEPLOYMENT_TARGET=${universal_target}
-.Ed
-.It Ic xcode.universal.sdk
-SDK to use when the +universal variant is selected. The argument may be an absolute path to an SDK, or the canonical name of an SDK.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Bd -literal -offset indent -compact
-${universal_sysroot}
-.Ed
 .El
 .Sh STANDARD PORTFILE VARIABLES AFFECTING XCODE PORTGROUP
 The following standard Portfile variables actually affect
@@ -285,6 +265,7 @@
 .It Ic set_local_library
 Sets GNUSTEP_LOCAL_LIBRARY according to the FilesystemLayout
 .br
+.El
 .Pp
 .Sh GNUSTEP PORTGROUP SUGAR
 Portfiles using gnustep PortGroup do not need to define the following variables:

Modified: branches/universal-sanity/base/src/macports1.0/macports.tcl
===================================================================
--- branches/universal-sanity/base/src/macports1.0/macports.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/macports1.0/macports.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -236,7 +236,7 @@
 }
 
 # check for a binary in the path
-# returns an error code if it can not be found
+# returns an error code if it cannot be found
 proc macports::binaryInPath {prog} {
     global env
     foreach dir [split $env(PATH) :] {

Modified: branches/universal-sanity/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/universal-sanity/base/src/pextlib1.0/Pextlib.c	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/pextlib1.0/Pextlib.c	2009-06-08 18:45:32 UTC (rev 52032)
@@ -574,7 +574,7 @@
 
 	if(onoblock && ounlock) {
 	  /* should not be specified together */
-	  Tcl_SetResult(interp, "-noblock can not be used with -unlock", TCL_STATIC);
+	  Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
 	  return TCL_ERROR;
 	}
 	  

Modified: branches/universal-sanity/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/universal-sanity/base/src/pextlib1.0/tracelib.c	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/pextlib1.0/tracelib.c	2009-06-08 18:45:32 UTC (rev 52032)
@@ -223,7 +223,6 @@
 			append_allow("/sbin", 0);
 			append_allow("/dev", 0);
 			append_allow(Tcl_GetVar(interp, "macports::prefix", TCL_GLOBAL_ONLY), 2);
-			append_allow("/Applications/MacPorts", 0);
 			/* If there is no SDK we will allow everything in /usr /System/Library etc, else add binaries to allow, and redirect root to SDK. */
 			if(sdk&&*sdk)
 			{
@@ -234,7 +233,6 @@
 				append_allow("/usr/sbin", 0);
 				append_allow("/usr/libexec/gcc", 0);
 				append_allow("/System/Library/Perl", 0);
-				append_allow("/usr/X11R6/bin", 0);
 				append_allow("/", 1);
 				strcpy(t-1, buf);
 				t+=strlen(t)+1;

Modified: branches/universal-sanity/base/src/port/port.tcl
===================================================================
--- branches/universal-sanity/base/src/port/port.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port/port.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -2103,16 +2103,6 @@
         if { [catch {portuninstall::uninstall $portname [composite_version $portversion [array get variations]] [array get options]} result] } {
             global errorInfo
             ui_debug "$errorInfo"
-
-            # start gsoc08-privileges
-            if { [string first "permission denied" $result] != -1 } {
-                set result "port requires root privileges for this action and needs you to execute 'sudo port uninstall $portname' to continue."
-                #ui_msg [exec sudo port uninstall $portname]
-                # The above line is what should be here to let the user simply enter his/her password to uninstall as root.
-                # However, for some as yet unknown reason, executing it here will not work.
-            }
-            # end gsoc08-privileges
-
             break_softcontinue "port uninstall failed: $result" 1 status
         }
     }
@@ -2885,25 +2875,6 @@
 
         mportclose $workername
         
-        # start gsoc08-privileges
-        if { [geteuid] != 0 && $result == 2} {
-            # mportexec will return an error result code 2 if eval_targets fails due to insufficient privileges.
-
-            set portbinary "${macports::prefix}/bin/port"
-
-            ui_info "Attempting port action with 'sudo port': 'sudo $portbinary $target $portname'."
-            set result 0
-            if {[catch {set sudomsgs [exec sudo $portbinary $target $portname]} sudomsgs]} {
-                global errorInfo
-                ui_debug "$errorInfo"
-                break_softcontinue "Unable to execute port: $errorInfo" 1 status
-            }
-
-            ui_msg $sudomsgs
-            ui_debug "'sudo $portbinary $target $portname' has completed."
-        }
-        # end gsoc08-privileges
-        
         # Process any error that wasn't thrown and handled already
         if {$result} {
             break_softcontinue "Status $result encountered during processing." 1 status

Modified: branches/universal-sanity/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- branches/universal-sanity/base/src/port1.0/port_autoconf.tcl.in	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/port_autoconf.tcl.in	2009-06-08 18:45:32 UTC (rev 52032)
@@ -34,16 +34,26 @@
 	variable bzip2_path "@BZIP2@"
 	variable cp_path "@CP@"
 	variable cpio_path "@CPIO@"
+	variable diff_path "@DIFF@"
 	variable ditto_path "@DITTO@"
+	variable dscl_path "@DSCL@"
+	variable file_path "@FILE@"
 	variable cvs_path "@CVS@"
 	variable svn_path "@SVN@"
 	variable git_path "@GIT@"
+	variable hg_path "@HG@"
 	variable gzip_path "@GZIP@"
+	variable lipo_path "@LIPO@"
+	variable nice_path "@NICE@"
+	variable patch_path "@PATCH@"
 	variable rmdir_path "@RMDIR@"
 	variable rsync_path "@RSYNC@"
 	variable unzip_path "@UNZIP@"
 	variable zip_path "@ZIP@"
 	variable lsbom_path "@LSBOM@"
+	variable make_path "@MAKE@"
+	variable gnumake_path "@GNUMAKE@"
+	variable bsdmake_path "@BSDMAKE@"
 	variable mkbom_path "@MKBOM@"
 	variable mtree_path "@MTREE@"
 	variable pax_path "@PAX@"

Modified: branches/universal-sanity/base/src/port1.0/portbuild.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portbuild.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portbuild.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -62,38 +62,35 @@
 
 proc portbuild::build_getmaketype {args} {
     if {![exists build.type]} {
-        return make
+        return [findBinary make $portutil::autoconf::make_path]
     }
     switch -exact -- [option build.type] {
         bsd {
             if {[option os.platform] == "darwin"} {
-                return bsdmake
+                return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
             } elseif {[option os.platform] == "freebsd"} {
-                return make
+                return [binaryInPath make]
             } else {
-                return pmake
+                return [binaryInPath pmake]
             }
         }
         gnu {
             if {[option os.platform] == "darwin"} {
-                return gnumake
+                return [findBinary gnumake $portutil::autoconf::gnumake_path]
             } elseif {[option os.platform] == "linux"} {
-                return make
+                return [binaryInPath make]
             } else {
-                return gmake
+                return [binaryInPath gmake]
             }
         }
         pbx {
-            set pbxbuild "pbxbuild"
-            set xcodebuild "xcodebuild"
-
             if {[option os.platform] != "darwin"} {
                 return -code error "[format [msgcat::mc "This port requires 'pbxbuild/xcodebuild', which is not available on %s."] [option os.platform]]"
             }
 
-            if {[catch {set xcodebuild [binaryInPath $xcodebuild]}] == 0} {
+            if {[catch {set xcodebuild [binaryInPath xcodebuild]}] == 0} {
                 return $xcodebuild
-            } elseif {[catch {set pbxbuild [binaryInPath $pbxbuild]}] == 0} {
+            } elseif {[catch {set pbxbuild [binaryInPath pbxbuild]}] == 0} {
                 return $pbxbuild
             } else {
                 return -code error "Neither pbxbuild nor xcodebuild were found on this system!"
@@ -101,7 +98,7 @@
         }
         default {
             ui_warn "[format [msgcat::mc "Unknown build.type %s, using 'gnumake'"] [option build.type]]"
-            return gnumake
+            return [findBinary gnumake $portutil::autoconf::gnumake_path]
         }
     }
 }
@@ -114,7 +111,7 @@
     if {![string is integer -strict $nice] || $nice <= 0} {
         return ""
     }
-    return "nice -n $nice "
+    return "[findBinary nice $portutil::autoconf::nice_path] -n $nice "
 }
 
 proc portbuild::build_getmakejobs {args} {
@@ -131,7 +128,11 @@
     set jobs [option build.jobs]
     # if set to '0', use the number of cores for the number of jobs
     if {$jobs == 0} {
-        set jobs [exec "/usr/sbin/sysctl" "-n" "hw.ncpu"]
+        if {[catch {set jobs [exec "/usr/sbin/sysctl" "-n" "hw.availcpu"]}]} {
+            set jobs 2
+            ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
+            ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
+        }
     }
     if {![string is integer -strict $jobs] || $jobs <= 1} {
         return ""
@@ -140,17 +141,9 @@
 }
 
 proc portbuild::build_start {args} {
-    global UI_PREFIX build.asroot
+    global UI_PREFIX
 
     ui_msg "$UI_PREFIX [format [msgcat::mc "Building %s"] [option name]]"
-
-    # start gsoc08-privileges
-    if { [tbool build.asroot] } {
-    # if port is marked as needing root
-        elevateToRoot "build"
-    }
-    # end gsoc08-privileges
-
 }
 
 proc portbuild::build_main {args} {

Modified: branches/universal-sanity/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portconfigure.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portconfigure.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -180,13 +180,6 @@
         default { return -code error "Invalid value for configure.compiler" }
     }
     ui_debug "Using compiler '$name'"
-    
-    # start gsoc08-privileges
-    if { [tbool configure.asroot] } {
-        # if port is marked as needing root
-        elevateToRoot "configure"
-    }
-    # end gsoc08-privileges
 }
 
 # internal function to determine the "-arch xy" flags for the compiler

Modified: branches/universal-sanity/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portdestroot.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portdestroot.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -106,9 +106,7 @@
     }
 
     if { [tbool destroot.asroot] && [getuid] != 0 } {
-        global errorisprivileges
-        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 "You cannot run this port without root privileges. You need to re-run with 'sudo port'.";
     }
 
     if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
@@ -301,15 +299,30 @@
                     # we've found a subpath of our prefix
                     lpush pathsToCheck $dfile
                 } else {
-                    # these files are outside of the prefix
-                    switch $dfile {
-                        $applications_dir -
-                        $developer_dir { ui_debug "port installs files in $dfile" }
-                        default {
-                            ui_warn "violation by $dfile"
-                            set mtree_violation "yes"
+                    set dir_allowed no
+                    # these files are (at least potentially) outside of the prefix
+                    foreach dir "$applications_dir $frameworks_dir /Library/LaunchAgents /Library/LaunchDaemons /Library/StartupItems" {
+                        if {[string equal -length [expr [string length $dfile] + 1] $dfile/ $dir]} {
+                            # it's a prefix of one of the allowed paths
+                            set dir_allowed yes
+                            break
                         }
                     }
+                    if {$dir_allowed} {
+                        lpush pathsToCheck $dfile
+                    } else {
+                        # not a prefix of an allowed path, so it's either the path itself or a violation
+                        switch $dfile \
+                            $applications_dir - \
+                            $frameworks_dir - \
+                            /Library/LaunchAgents - \
+                            /Library/LaunchDaemons - \
+                            /Library/StartupItems { ui_debug "port installs files in $dfile" } \
+                            default {
+                                ui_warn "violation by $dfile"
+                                set mtree_violation "yes"
+                            }
+                    }
                 }
             }
         }
@@ -321,15 +334,11 @@
             # error "mtree violation!"
         }
     } else {
-        ui_warn "[format [msgcat::mc "%s requests to install files outside the common directory structure!"] [option name]]"
+        ui_msg "[format [msgcat::mc "Note: %s installs files outside the common directory structure."] [option name]]"
     }
 
     # Restore umask
     umask $oldmask
 
-    # start gsoc08-privileges
-    chownAsRoot $destroot
-    # end gsoc08-privileges
-
     return 0
 }

Modified: branches/universal-sanity/base/src/port1.0/portextract.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portextract.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portextract.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -98,7 +98,7 @@
         option extract.post_args ""
     } elseif {[tbool use_dmg]} {
         global worksrcdir
-        set dmg_tmp_dir [exec mktemp -d -q "/tmp/mports.XXXXXXXX"]
+        set dmg_tmp_dir [mkdtemp "/tmp/mports.XXXXXXXX"]
         set dmg_mount ${dmg_tmp_dir}/${worksrcdir}
         file mkdir ${dmg_mount}
         option extract.cmd [findBinary hdiutil ${portutil::autoconf::hdiutil_path}]

Modified: branches/universal-sanity/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portfetch.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portfetch.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -58,8 +58,8 @@
     master_sites.mirror_subdir patch_sites.mirror_subdir \
     cvs.module cvs.root cvs.password cvs.date cvs.tag cvs.method \
     svn.url svn.revision svn.method \
-    git.url git.branch \
-    hg.url hg.tag
+    git.cmd git.url git.branch \
+    hg.cmd hg.url hg.tag
 
 # XXX we use the command framework to buy us some useful features,
 # but this is not a user-modifiable command
@@ -70,7 +70,7 @@
 default extract.suffix .tar.gz
 default fetch.type standard
 
-default cvs.cmd {$portutil::autoconf::cvs_path}
+default cvs.cmd {[findBinary cvs $portutil::autoconf::cvs_path]}
 default cvs.password ""
 default cvs.dir {${workpath}}
 default cvs.method {export}
@@ -82,7 +82,7 @@
 default cvs.args ""
 default cvs.post_args {"${cvs.module}"}
 
-default svn.cmd {$portutil::autoconf::svn_path}
+default svn.cmd {[findBinary svn $portutil::autoconf::svn_path]}
 default svn.dir {${workpath}}
 default svn.method {export}
 default svn.revision ""
@@ -91,9 +91,11 @@
 default svn.args ""
 default svn.post_args {"${svn.url}"}
 
+default git.cmd {[findBinary git $portutil::autoconf::git_path]}
 default git.dir {${workpath}}
 default git.branch {}
 
+default hg.cmd {[findBinary hg $portutil::autoconf::hg_path]}
 default hg.dir {${workpath}}
 default hg.tag {tip}
 
@@ -483,7 +485,7 @@
         set savecmd ${cvs.cmd}
         set saveargs ${cvs.args}
         set savepost_args ${cvs.post_args}
-        set cvs.cmd "echo ${cvs.password} | $portutil::autoconf::cvs_path"
+        set cvs.cmd "echo ${cvs.password} | ${cvs.cmd}"
         set cvs.args login
         set cvs.post_args ""
         if {[catch {command_exec cvs -notty "" "2>&1"} result]} {
@@ -508,24 +510,8 @@
 
 # Perform an svn fetch
 proc portfetch::svnfetch {args} {
-    global workpath prefix_frozen
-    global svn.env svn.cmd svn.args svn.post_args svn.revision svn.url svn.method
+    global svn.args svn.revision svn.method
 
-    # Look for the svn command, either in the path or in the prefix
-    set goodcmd 0
-    foreach svncmd "${svn.cmd} ${prefix_frozen}/bin/svn svn" {
-        if { [file executable ${svncmd}] } {
-            set svn.cmd $svncmd
-            set goodcmd 1
-            break;
-        }
-    }
-    if { !$goodcmd } {
-        ui_error "The subversion tool (svn) is required to fetch ${svn.url}."
-        ui_error "Please install the subversion port before proceeding."
-        return -code error [msgcat::mc "Subversion check out failed"]
-    }
-
     set svn.args "${svn.method} ${svn.args}"
     if {[string length ${svn.revision}]} {
         set svn.args "${svn.args} -r ${svn.revision}"
@@ -544,23 +530,9 @@
 
 # Perform a git fetch
 proc portfetch::gitfetch {args} {
-    global worksrcpath prefix_frozen
-    global git.url git.branch git.sha1
+    global worksrcpath
+    global git.url git.branch git.sha1 git.cmd
 
-    # Look for the git command
-    set git.cmd {}
-    foreach gitcmd "$portutil::autoconf::git_path $prefix_frozen/bin/git git" {
-        if {[file executable $gitcmd]} {
-            set git.cmd $gitcmd
-            break
-        }
-    }
-    if {${git.cmd} == {}} {
-        ui_error "git is required to fetch ${git.url}"
-        ui_error "Please install the git-core port before proceeding."
-        return -code error [msgcat::mc "Git command not found"]
-    }
-
     set options "-q"
     if {[string length ${git.branch}] == 0} {
         # if we're just using HEAD, we can make a shallow repo
@@ -591,22 +563,8 @@
 # Perform a mercurial fetch.
 proc portfetch::hgfetch {args} {
     global worksrcpath prefix_frozen
-    global hg.url hg.tag
+    global hg.url hg.tag hg.cmd
 
-    # Look for the hg command.
-    set hg.cmd {}
-    foreach hgcmd "$prefix_frozen/bin/hg hg" {
-        if {[file executable $hgcmd]} {
-            set hg.cmd $hgcmd
-            break
-        }
-    }
-    if {${hg.cmd} == {}} {
-        ui_error "hg is required to fetch ${hg.url}"
-        ui_error "Please install the mercurial port before proceeding."
-        return -code error [msgcat::mc "Mercurial command not found"]
-    }
-
     set cmdstring "${hg.cmd} clone --rev ${hg.tag} ${hg.url} ${worksrcpath} 2>&1"
     ui_debug "Executing: $cmdstring"
     if {[catch {system $cmdstring} result]} {
@@ -631,9 +589,17 @@
 
     if {![file isdirectory $distpath]} {
         if {[catch {file mkdir $distpath} result]} {
-            return -code error [format [msgcat::mc "Unable to create distribution files path: %s"] $result]
+            elevateToRoot "fetch"
+            set elevated yes
+            if {[catch {file mkdir $distpath} result]} {
+                return -code error [format [msgcat::mc "Unable to create distribution files path: %s"] $result]
+            }
         }
     }
+    chownAsRoot $distpath
+    if {[info exists elevated] && $elevated == yes} {
+        dropPrivileges
+    }
 
     set fetch_options {}
     if {[string length ${fetch.user}] || [string length ${fetch.password}]} {

Modified: branches/universal-sanity/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portinstall.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portinstall.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -56,14 +56,11 @@
 
 proc portinstall::install_start {args} {
     global UI_PREFIX name version revision variations portvariants
-    global install.asroot prefix
+    global prefix
     ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $name $version $revision $portvariants]"
     
     # start gsoc08-privileges
-    if { [tbool install.asroot] } {
-        # if port is marked as needing root
-        elevateToRoot "install"
-    } elseif { ![file writable $prefix] } {
+    if { ![file writable $prefix] } {
         # if install location is not writable, need root privileges to install
         elevateToRoot "install"
     }
@@ -79,18 +76,10 @@
     }
     
     # if the file is a symlink, do not try to set file attributes
-    # if the destination file is an existing directory,
-    # do not overwrite its file attributes
-    if {[file type $src_element] != "link" || [file isdirectory $dst_element]} {
-        set attributes [file attributes $src_element]
-        for {set i 0} {$i < [llength $attributes]} {incr i} {
-            set opt [lindex $attributes $i]
-            incr i
-            set arg [lindex $attributes $i]
-            file attributes $dst_element $opt $arg
-            # set mtime on installed element
-            exec touch -r $src_element $dst_element
-        }
+    if {[file type $src_element] != "link"} {
+        eval file attributes {$dst_element} [file attributes $src_element]
+        # set mtime on installed element
+        file mtime $dst_element [file mtime $src_element]
     }
 }
 

Modified: branches/universal-sanity/base/src/port1.0/portlivecheck.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portlivecheck.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portlivecheck.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -121,11 +121,11 @@
         if {${livecheck.type} eq "default"} {
             set livecheck.type "fallback"
         }
-        # If livecheck.name is still "default", set it to $name.
-        if {${livecheck.name} eq "default"} {
-            set livecheck.name $name
-        }
     }
+    # If livecheck.name is still "default", set it to $name.
+    if {${livecheck.name} eq "default"} {
+        set livecheck.name $name
+    }
     if {[lsearch -exact [split $available_types "|"] ${livecheck.type}] != -1} {
         # Load the defaults from _resources/port1.0/livecheck/${livecheck.type}.tcl.
         set defaults_file "$types_dir/${livecheck.type}.tcl"

Modified: branches/universal-sanity/base/src/port1.0/portmain.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portmain.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portmain.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -124,6 +124,10 @@
     option os.universal_supported yes
 }
 
+# Record initial euid/egid
+set euid [geteuid]
+set egid [getegid]
+
 proc portmain::main {args} {
     return 0
 }

Modified: branches/universal-sanity/base/src/port1.0/portpatch.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portpatch.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portpatch.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -49,7 +49,7 @@
 # Set up defaults
 default patch.asroot no
 default patch.dir {${worksrcpath}}
-default patch.cmd patch
+default patch.cmd {[findBinary patch $portutil::autoconf::patch_path]}
 default patch.pre_args -p0
 
 proc portpatch::patch_main {args} {
@@ -57,45 +57,35 @@
 
     # First make sure that patchfiles exists and isn't stubbed out.
     if {![exists patchfiles]} {
-    return 0
+        return 0
     }
 
     ui_msg "$UI_PREFIX [format [msgcat::mc "Applying patches to %s"] [option name]]"
 
-    # start gsoc08-privileges
-    if { [tbool patch.asroot] } {
-    # if port is marked as needing root
-        elevateToRoot "patch"
-    }
-    # end gsoc08-privileges
-
     foreach patch [option patchfiles] {
-    set patch_file [getdistname $patch]
-    if {[file exists [option filespath]/$patch_file]} {
-        lappend patchlist [option filespath]/$patch_file
-    } elseif {[file exists [option distpath]/$patch_file]} {
-        lappend patchlist [option distpath]/$patch_file
-    } else {
-        return -code error [format [msgcat::mc "Patch file %s is missing"] $patch]
+        set patch_file [getdistname $patch]
+        if {[file exists [option filespath]/$patch_file]} {
+            lappend patchlist [option filespath]/$patch_file
+        } elseif {[file exists [option distpath]/$patch_file]} {
+            lappend patchlist [option distpath]/$patch_file
+        } else {
+            return -code error [format [msgcat::mc "Patch file %s is missing"] $patch]
+        }
     }
-    }
     if {![info exists patchlist]} {
-    return -code error [msgcat::mc "Patch files missing"]
+        return -code error [msgcat::mc "Patch files missing"]
     }
     _cd [option worksrcpath]
+    set gzcat "[findBinary gzip $portutil::autoconf::gzip_path] -dc"
+    set bzcat "[findBinary bzip2 $portutil::autoconf::bzip2_path] -dc"
     foreach patch $patchlist {
-    ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] $patch]"
-    if {[option os.platform] == "linux"} {
-        set gzcat "zcat"
-    } else {
-        set gzcat "gzcat"
+        ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] $patch]"
+        switch -- [file extension $patch] {
+            .Z -
+            .gz {command_exec patch "$gzcat \"$patch\" | (" ")"}
+            .bz2 {command_exec patch "$bzcat \"$patch\" | (" ")"}
+            default {command_exec patch "" "< '$patch'"}
+        }
     }
-    switch -glob -- [file tail $patch] {
-        *.Z -
-        *.gz {command_exec patch "$gzcat \"$patch\" | (" ")"}
-        *.bz2 {command_exec patch "bzcat \"$patch\" | (" ")"}
-        default {command_exec patch "" "< '$patch'"}
-    }
-    }
     return 0
 }

Modified: branches/universal-sanity/base/src/port1.0/portutil.tcl
===================================================================
--- branches/universal-sanity/base/src/port1.0/portutil.tcl	2009-06-08 18:28:00 UTC (rev 52031)
+++ branches/universal-sanity/base/src/port1.0/portutil.tcl	2009-06-08 18:45:32 UTC (rev 52032)
@@ -829,7 +829,6 @@
 # reinplace
 # Provides "sed in place" functionality
 proc reinplace {args}  {
-    global euid macportsuser
 
     set extended 0
     while 1 {
@@ -1173,7 +1172,7 @@
         foreach arch $universal_archlist {
             append lipoSources "-arch ${arch} ${workpath}/${arch}/${file} "
         }
-        system "lipo ${lipoSources}-create -output ${file}"
+        system "[findBinary lipo $portutil::autoconf::lipo_path] ${lipoSources}-create -output ${file}"
     }
 }
 
@@ -1208,7 +1207,7 @@
 set ports_dry_last_skipped ""
 
 proc target_run {ditem} {
-    global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped errorisprivileges
+    global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped
     set portname [option name]
     set result 0
     set skipped 0
@@ -1220,6 +1219,9 @@
 
     if {$procedure != ""} {
         set targetname [ditem_key $ditem name]
+        if { [tbool ${targetname}.asroot] } {
+            elevateToRoot $targetname
+        }
 
         if {[ditem_contains $ditem init]} {
             set result [catch {[ditem_key $ditem init] $targetname} errstr]
@@ -1376,13 +1378,9 @@
             write_statefile target $targetname $target_state_fd
             }
         } else {
-            if {$errorisprivileges != "yes"} {
-                global errorInfo
-                ui_error "Target $targetname returned: $errstr"
-                ui_debug "Backtrace: $errorInfo"
-            } else {
-                ui_msg "Target $targetname returned: $errstr"
-            }
+            global errorInfo
+            ui_error "Target $targetname returned: $errstr"
+            ui_debug "Backtrace: $errorInfo"
             set result 1
         }
 
@@ -1432,9 +1430,8 @@
 
 
 proc eval_targets {target} {
-    global targets target_state_fd name version revision portvariants ports_dryrun user_options errorisprivileges
+    global targets target_state_fd name version revision portvariants ports_dryrun user_options
     set dlist $targets
-    set errorisprivileges "no"
 
     # the statefile will likely be autocleaned away after install,
     # so special-case ignore already-completed install and activate
@@ -1486,12 +1483,6 @@
         set result 0
     }
 
-    # start gsoc08-privileges
-    if { $result == 1 && $errorisprivileges == "yes" } {
-        set result 2
-    }
-    # end gsoc08-privileges
-
     return $result
 }
 
@@ -1502,10 +1493,6 @@
     global altprefix usealtworkpath env applications_dir portbuildpath distpath
 
     # start gsoc08-privileges
-
-    # de-escalate privileges - only run if MacPorts was started with sudo
-    dropPrivileges
-
     if { ![file exists $workpath] } {
         if {[catch {set result [file mkdir $workpath]} result]} {
             global errorInfo
@@ -1522,7 +1509,7 @@
 
         if { $userid !=0 } {
             ui_msg "MacPorts running without privileges.\
-                    You may be prompted for your sudo password in order to complete certain actions (eg install)."
+                    You may be unable to complete certain actions (eg install)."
         }
 
         # set global variable indicating to other functions to use ~/.macports as well
@@ -1579,6 +1566,7 @@
     if {![file isdirectory $workpath]} {
         file mkdir $workpath
     }
+
     # flock Portfile
     set statefile [file join $workpath .macports.${name}.state]
     if {[file exists $statefile]} {
@@ -1592,20 +1580,23 @@
             file mkdir [file join $workpath]
         }
     }
+    chownAsRoot $workpath
 
     # Create a symlink to the workpath for port authors
     if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
         ui_debug "Attempting ln -sf $workpath $worksymlink"
         ln -sf $workpath $worksymlink
     }
+    # de-escalate privileges - only run if MacPorts was started with sudo
+    dropPrivileges
 
     set fd [open $statefile a+]
     if {[catch {flock $fd -exclusive -noblock} result]} {
         if {"$result" == "EAGAIN"} {
             ui_msg "Waiting for lock on $statefile"
-    } elseif {"$result" == "EOPNOTSUPP"} {
-        # Locking not supported, just return
-        return $fd
+        } elseif {"$result" == "EOPNOTSUPP"} {
+            # Locking not supported, just return
+            return $fd
         } else {
             return -code error "$result obtaining lock on $statefile"
         }
@@ -1877,7 +1868,7 @@
     } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
         ui_debug "using xmkmf, so not adding the default universal variant"
         return no
-    } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.universal.settings]} {
+    } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.project]} {
         # Allow +universal if port uses xcode portgroup.
         ui_debug "not using configure, so not adding the default universal variant"
         return no
@@ -2071,12 +2062,13 @@
     }
 
     if {${os.platform} eq "darwin"} {
-        exec dscl . -create /Users/${name} Password ${passwd}
-        exec dscl . -create /Users/${name} UniqueID ${uid}
-        exec dscl . -create /Users/${name} PrimaryGroupID ${gid}
-        exec dscl . -create /Users/${name} RealName ${realname}
-        exec dscl . -create /Users/${name} NFSHomeDirectory ${home}
-        exec dscl . -create /Users/${name} UserShell ${shell}
+        set dscl [findBinary dscl $portutil::autoconf::dscl_path]
+        exec $dscl . -create /Users/${name} Password ${passwd}
+        exec $dscl . -create /Users/${name} UniqueID ${uid}
+        exec $dscl . -create /Users/${name} PrimaryGroupID ${gid}
+        exec $dscl . -create /Users/${name} RealName ${realname}
+        exec $dscl . -create /Users/${name} NFSHomeDirectory ${home}
+        exec $dscl . -create /Users/${name} UserShell ${shell}
     } else {
         # XXX adduser is only available for darwin, add more support here
         ui_warn "WARNING: adduser is not implemented on ${os.platform}."
@@ -2102,11 +2094,12 @@
     }
 
     if {${os.platform} eq "darwin"} {
-        exec dscl . -create /Groups/${name} Password ${passwd}
-        exec dscl . -create /Groups/${name} RealName ${realname}
-        exec dscl . -create /Groups/${name} PrimaryGroupID ${gid}
+        set dscl [findBinary dscl $portutil::autoconf::dscl_path]
+        exec $dscl . -create /Groups/${name} Password ${passwd}
+        exec $dscl . -create /Groups/${name} RealName ${realname}
+        exec $dscl . -create /Groups/${name} PrimaryGroupID ${gid}
         if {${users} ne ""} {
-            exec dscl . -create /Groups/${name} GroupMembership ${users}
+            exec $dscl . -create /Groups/${name} GroupMembership ${users}
         }
     } else {
         # XXX addgroup is only available for darwin, add more support here
@@ -2133,7 +2126,7 @@
 }
 
 # check for a binary in the path
-# returns an error code if it can not be found
+# returns an error code if it cannot be found
 proc binaryInPath {binary} {
     global env
     foreach dir [split $env(PATH) :] {
@@ -2264,7 +2257,7 @@
         set exec-lipo [concat ${exec-lipo} [list "-arch" "${arch}" "${base}/${arch}${file}"]]
     }
     set exec-lipo [concat ${exec-lipo}]
-    system "/usr/bin/lipo ${exec-lipo} -create -output ${target}${file}"
+    system "[findBinary lipo $portutil::autoconf::lipo_path] ${exec-lipo} -create -output ${target}${file}"
 }
 
 # private function
@@ -2288,7 +2281,7 @@
     ui_debug "ba: '${basearch}' ('${archs}')"
     foreach arch [lrange ${archs} 1 end] {
         # checking for differences; TODO: error more gracefully on non-equal files
-        exec "/usr/bin/diff" "-q" "${base}/${basearch}${file}" "${base}/${arch}${file}"
+        exec [findBinary diff $portutil::autoconf::diff_path] "-q" "${base}/${basearch}${file}" "${base}/${arch}${file}"
     }
     ui_debug "ba: '${basearch}'"
     file copy "${base}/${basearch}${file}" "${target}${file}"
@@ -2317,7 +2310,7 @@
         set fpath [string range "${file}" [string length "${basepath}"] [string length "${file}"]]
         if {${fpath} != ""} {
             # determine the type (dir/file/link)
-            set filetype [exec "/usr/bin/file" "-b" "${basepath}${fpath}"]
+            set filetype [exec [findBinary file $portutil::autoconf::file_path] "-b" "${basepath}${fpath}"]
             switch -regexp ${filetype} {
                 directory {
                     # just create directories
@@ -2399,7 +2392,7 @@
 #
 # @param action the action for which privileges are being elevated
 proc elevateToRoot {action} {
-    global euid egid macportsuser errorisprivileges
+    global euid egid macportsuser
 
     if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
     # if started with sudo but have dropped the privileges
@@ -2410,8 +2403,7 @@
     }
 
     if { [getuid] != 0 } {
-        set errorisprivileges yes
-        return -code error "port requires root privileges for this action and needs you to type your password for sudo.";
+        return -code error "MacPorts requires root privileges for this action";
     }
 }
 
@@ -2422,8 +2414,6 @@
     global euid egid macportsuser workpath
     if { [geteuid] == 0 } {
         if { [catch {
-                set euid [geteuid]
-                set egid [getegid]
                 ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
 
                 #seteuid [name_to_uid [file attributes $workpath -owner]]
@@ -2433,10 +2423,6 @@
                 seteuid [name_to_uid "$macportsuser"]
                 ui_debug "egid changed to: [getegid]"
                 ui_debug "euid changed to: [geteuid]"
-
-                if {![file writable $workpath]} {
-                    ui_debug "Privileges successfully de-escalated. Unable to write to default workpath."
-                }
             }]
         } {
             ui_debug "$::errorInfo"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090608/96e2a6db/attachment-0001.html>


More information about the macports-changes mailing list