[52679] branches/images-and-archives/base

blb at macports.org blb at macports.org
Sun Jun 21 00:39:17 PDT 2009


Revision: 52679
          http://trac.macports.org/changeset/52679
Author:   blb at macports.org
Date:     2009-06-21 00:39:16 -0700 (Sun, 21 Jun 2009)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/images-and-archives/base/configure
    branches/images-and-archives/base/configure.ac
    branches/images-and-archives/base/src/port1.0/portbuild.tcl
    branches/images-and-archives/base/src/port1.0/portutil.tcl

Property Changed:
----------------
    branches/images-and-archives/base/


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

Modified: branches/images-and-archives/base/configure
===================================================================
--- branches/images-and-archives/base/configure	2009-06-21 05:39:08 UTC (rev 52678)
+++ branches/images-and-archives/base/configure	2009-06-21 07:39:16 UTC (rev 52679)
@@ -859,6 +859,7 @@
 TAR
 MAKE
 GNUTAR
+BSDMAKE
 GNUMAKE
 BZIP2
 XAR
@@ -1549,6 +1550,7 @@
   TAR         path to tar command
   MAKE        path to make command
   GNUTAR      path to gnutar command
+  BSDMAKE     path to bsdmake/pmake command
   GNUMAKE     path to gnumake command
   BZIP2       path to bzip2 command
   XAR         path to xar command
@@ -4598,8 +4600,10 @@
 fi
 
 
-# Extract the first word of "bsdmake", so it can be a program name with args.
-set dummy bsdmake; ac_word=$2
+for ac_prog in bsdmake pmake
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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
@@ -4638,6 +4642,9 @@
 fi
 
 
+  test -n "$BSDMAKE" && break
+done
+
 # 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
@@ -5183,6 +5190,7 @@
 
 
 
+
 	# Extract the first word of "sed", so it can be a program name with args.
 set dummy sed; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5

Modified: branches/images-and-archives/base/configure.ac
===================================================================
--- branches/images-and-archives/base/configure.ac	2009-06-21 05:39:08 UTC (rev 52678)
+++ branches/images-and-archives/base/configure.ac	2009-06-21 07:39:16 UTC (rev 52679)
@@ -108,7 +108,7 @@
 AC_PATH_PROG(TAR, [tar])
 AC_PATH_PROG(UNZIP, [unzip])
 AC_PATH_PROG(ZIP, [zip])
-AC_PATH_PROG(BSDMAKE, [bsdmake])
+AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
 AC_PATH_PROG(MAKE, [make])
 AC_PATH_PROG(HDIUTIL, [hdiutil], [])
 AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
@@ -132,6 +132,7 @@
 AC_ARG_VAR(TAR, [path to tar command])
 AC_ARG_VAR(MAKE, [path to make command])
 AC_ARG_VAR(GNUTAR, [path to gnutar command])
+AC_ARG_VAR(BSDMAKE, [path to bsdmake/pmake command])
 AC_ARG_VAR(GNUMAKE, [path to gnumake command])
 AC_ARG_VAR(BZIP2, [path to bzip2 command])
 AC_ARG_VAR(XAR, [path to xar command])

Modified: branches/images-and-archives/base/src/port1.0/portbuild.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portbuild.tcl	2009-06-21 05:39:08 UTC (rev 52678)
+++ branches/images-and-archives/base/src/port1.0/portbuild.tcl	2009-06-21 07:39:16 UTC (rev 52679)
@@ -69,18 +69,18 @@
             if {[option os.platform] == "darwin"} {
                 return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
             } elseif {[option os.platform] == "freebsd"} {
-                return [binaryInPath make]
+                return [findBinary make $portutil::autoconf::make_path]
             } else {
-                return [binaryInPath pmake]
+                return [findBinary pmake $portutil::autoconf::bsdmake_path]
             }
         }
         gnu {
             if {[option os.platform] == "darwin"} {
                 return [findBinary gnumake $portutil::autoconf::gnumake_path]
             } elseif {[option os.platform] == "linux"} {
-                return [binaryInPath make]
+                return [findBinary make $portutil::autoconf::make_path]
             } else {
-                return [binaryInPath gmake]
+                return [findBinary gmake $portutil::autoconf::gnumake_path]
             }
         }
         pbx {

Modified: branches/images-and-archives/base/src/port1.0/portutil.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-06-21 05:39:08 UTC (rev 52678)
+++ branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-06-21 07:39:16 UTC (rev 52679)
@@ -2299,17 +2299,19 @@
 proc chownAsRoot {path} {
     global euid macportsuser
 
-    if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
-    # if started with sudo but have dropped the privileges
-        seteuid $euid
-        ui_debug "euid changed to: [geteuid]"
-        chown  ${path} ${macportsuser}
-        ui_debug "chowned $path to $macportsuser"
-        seteuid [name_to_uid "$macportsuser"]
-        ui_debug "euid changed to: [geteuid]"
-    } elseif { [getuid] == 0 } {
-    # if started with sudo but have elevated back to root already
-        chown  ${path} ${macportsuser}
+    if { [getuid] == 0 } {
+        if {[geteuid] != 0} {
+            # if started with sudo but have dropped the privileges
+            seteuid $euid
+            ui_debug "euid changed to: [geteuid]"
+            chown  ${path} ${macportsuser}
+            ui_debug "chowned $path to $macportsuser"
+            seteuid [name_to_uid "$macportsuser"]
+            ui_debug "euid changed to: [geteuid]"
+        } else {
+            # if started with sudo but have elevated back to root already
+            chown  ${path} ${macportsuser}
+        }
     }
 }
 
@@ -2320,17 +2322,15 @@
 proc elevateToRoot {action} {
     global euid egid macportsuser
 
-    if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
+    if { [getuid] == 0 && [geteuid] != 0 } {
     # if started with sudo but have dropped the privileges
         ui_debug "Can't run $action on this port without elevated privileges. Escalating privileges back to root."
         setegid $egid
         seteuid $euid
         ui_debug "euid changed to: [geteuid]. egid changed to: [getegid]."
+    } elseif { [getuid] != 0 } {
+        return -code error "MacPorts requires root privileges for this action"
     }
-
-    if { [getuid] != 0 } {
-        return -code error "MacPorts requires root privileges for this action";
-    }
 }
 
 ##
@@ -2340,15 +2340,17 @@
     global euid egid macportsuser workpath
     if { [geteuid] == 0 } {
         if { [catch {
-                ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
+                if {[name_to_uid "$macportsuser"] != 0} {
+                    ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
 
-                #seteuid [name_to_uid [file attributes $workpath -owner]]
-                #setegid [name_to_gid [file attributes $workpath -group]]
+                    #seteuid [name_to_uid [file attributes $workpath -owner]]
+                    #setegid [name_to_gid [file attributes $workpath -group]]
 
-                setegid [uname_to_gid "$macportsuser"]
-                seteuid [name_to_uid "$macportsuser"]
-                ui_debug "egid changed to: [getegid]"
-                ui_debug "euid changed to: [geteuid]"
+                    setegid [uname_to_gid "$macportsuser"]
+                    seteuid [name_to_uid "$macportsuser"]
+                    ui_debug "egid changed to: [getegid]"
+                    ui_debug "euid changed to: [geteuid]"
+                }
             }]
         } {
             ui_debug "$::errorInfo"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090621/68b4674a/attachment-0001.html>


More information about the macports-changes mailing list