[51849] trunk/base

jmr at macports.org jmr at macports.org
Fri Jun 5 06:49:28 PDT 2009


Revision: 51849
          http://trac.macports.org/changeset/51849
Author:   jmr at macports.org
Date:     2009-06-05 06:49:27 -0700 (Fri, 05 Jun 2009)
Log Message:
-----------
less exec calls, more use of autoconfed paths (including the Xcode dir)

Modified Paths:
--------------
    trunk/base/aclocal.m4
    trunk/base/configure
    trunk/base/configure.ac
    trunk/base/doc/macports.conf.in
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/macports1.0/macports_autoconf.tcl.in
    trunk/base/src/package1.0/portarchive.tcl
    trunk/base/src/package1.0/portdmg.tcl
    trunk/base/src/package1.0/portmdmg.tcl
    trunk/base/src/package1.0/portpkg.tcl
    trunk/base/src/package1.0/portunarchive.tcl
    trunk/base/src/port1.0/port_autoconf.tcl.in
    trunk/base/src/port1.0/portconfigure.tcl
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portmain.tcl

Modified: trunk/base/aclocal.m4
===================================================================
--- trunk/base/aclocal.m4	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/aclocal.m4	2009-06-05 13:49:27 UTC (rev 51849)
@@ -502,9 +502,9 @@
 
 	if test "x$UNIVERSAL_SYSROOT" = "x"; then
 	    if test "${MACOSX_MAJOR_VERSION}" = "10.4"; then
-		UNIVERSAL_SYSROOT=/Developer/SDKs/MacOSX${MACOSX_MAJOR_VERSION}u.sdk
+		UNIVERSAL_SYSROOT=${DEVELOPER_DIR}/SDKs/MacOSX${MACOSX_MAJOR_VERSION}u.sdk
 	    else
-		UNIVERSAL_SYSROOT=/Developer/SDKs/MacOSX${MACOSX_MAJOR_VERSION}.sdk
+		UNIVERSAL_SYSROOT=${DEVELOPER_DIR}/SDKs/MacOSX${MACOSX_MAJOR_VERSION}.sdk
 	    fi
 	fi
 

Modified: trunk/base/configure
===================================================================
--- trunk/base/configure	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/configure	2009-06-05 13:49:27 UTC (rev 51849)
@@ -714,6 +714,8 @@
 OPEN
 XAR
 PAX
+MKBOM
+LSBOM
 BZIP2
 GNUMAKE
 GNUTAR
@@ -732,7 +734,10 @@
 GIT
 SVN
 CVS
+DITTO
+CPIO
 CP
+CHOWN
 MTREE
 LN_S
 SET_MAKE
@@ -749,6 +754,7 @@
 LDFLAGS
 CFLAGS
 CC
+DEVELOPER_DIR
 XCODE_SELECT
 DEFAULTS
 SW_VERS
@@ -2348,8 +2354,11 @@
   DEVELOPER_DIR=`$XCODE_SELECT -print-path`
   { $as_echo "$as_me:$LINENO: result: $DEVELOPER_DIR" >&5
 $as_echo "$DEVELOPER_DIR" >&6; }
+else
+  DEVELOPER_DIR=/Developer
 fi
 
+
 XCODEPLIST=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version.plist
 if test -r "$XCODEPLIST"; then
   { $as_echo "$as_me:$LINENO: checking Xcode version" >&5
@@ -3748,6 +3757,47 @@
 fi
 
 
+# Extract the first word of "chown", so it can be a program name with args.
+set dummy chown; 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_CHOWN+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $CHOWN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CHOWN="$CHOWN" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$PATH:/usr/sbin"
+for as_dir in $as_dummy
+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_CHOWN="$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
+CHOWN=$ac_cv_path_CHOWN
+if test -n "$CHOWN"; then
+  { $as_echo "$as_me:$LINENO: result: $CHOWN" >&5
+$as_echo "$CHOWN" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -3788,6 +3838,86 @@
 fi
 
 
+# Extract the first word of "cpio", so it can be a program name with args.
+set dummy cpio; 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_CPIO+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $CPIO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CPIO="$CPIO" # 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_CPIO="$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
+CPIO=$ac_cv_path_CPIO
+if test -n "$CPIO"; then
+  { $as_echo "$as_me:$LINENO: result: $CPIO" >&5
+$as_echo "$CPIO" >&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
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DITTO+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $DITTO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DITTO="$DITTO" # 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_DITTO="$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
+DITTO=$ac_cv_path_DITTO
+if test -n "$DITTO"; then
+  { $as_echo "$as_me:$LINENO: result: $DITTO" >&5
+$as_echo "$DITTO" >&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
@@ -4517,6 +4647,86 @@
 fi
 
 
+# Extract the first word of "lsbom", so it can be a program name with args.
+set dummy lsbom; 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_LSBOM+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $LSBOM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LSBOM="$LSBOM" # 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_LSBOM="$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
+LSBOM=$ac_cv_path_LSBOM
+if test -n "$LSBOM"; then
+  { $as_echo "$as_me:$LINENO: result: $LSBOM" >&5
+$as_echo "$LSBOM" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "mkbom", so it can be a program name with args.
+set dummy mkbom; 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_MKBOM+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $MKBOM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MKBOM="$MKBOM" # 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_MKBOM="$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
+MKBOM=$ac_cv_path_MKBOM
+if test -n "$MKBOM"; then
+  { $as_echo "$as_me:$LINENO: result: $MKBOM" >&5
+$as_echo "$MKBOM" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "pax", so it can be a program name with args.
 set dummy pax; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -7565,9 +7775,9 @@
 
 	if test "x$UNIVERSAL_SYSROOT" = "x"; then
 	    if test "${MACOSX_MAJOR_VERSION}" = "10.4"; then
-		UNIVERSAL_SYSROOT=/Developer/SDKs/MacOSX${MACOSX_MAJOR_VERSION}u.sdk
+		UNIVERSAL_SYSROOT=${DEVELOPER_DIR}/SDKs/MacOSX${MACOSX_MAJOR_VERSION}u.sdk
 	    else
-		UNIVERSAL_SYSROOT=/Developer/SDKs/MacOSX${MACOSX_MAJOR_VERSION}.sdk
+		UNIVERSAL_SYSROOT=${DEVELOPER_DIR}/SDKs/MacOSX${MACOSX_MAJOR_VERSION}.sdk
 	    fi
 	fi
 
@@ -10446,7 +10656,7 @@
 
 # Check whether --with-trace-sdk was given.
 if test "${with_trace_sdk+set}" = set; then
-  withval=$with_trace_sdk; test -d /Developer/SDKs/$withval && cat >>confdefs.h <<_ACEOF
+  withval=$with_trace_sdk; test -d ${DEVELOPER_DIR}/SDKs/$withval && cat >>confdefs.h <<_ACEOF
 #define TRACE_SDK "${withval}"
 _ACEOF
 

Modified: trunk/base/configure.ac
===================================================================
--- trunk/base/configure.ac	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/configure.ac	2009-06-05 13:49:27 UTC (rev 51849)
@@ -48,7 +48,10 @@
   AC_MSG_CHECKING(Xcode location)
   DEVELOPER_DIR=`$XCODE_SELECT -print-path`
   AC_MSG_RESULT([$DEVELOPER_DIR])
+else
+  DEVELOPER_DIR=/Developer
 fi
+AC_SUBST(DEVELOPER_DIR)
 
 XCODEPLIST=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version.plist
 if test -r "$XCODEPLIST"; then
@@ -84,7 +87,10 @@
 AC_PROG_MAKE_SET
 AC_PROG_LN_S
 AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
+AC_PATH_PROG(CHOWN, [chown], [], [$PATH:/usr/sbin])
 AC_PATH_PROG(CP, [cp], [])
+AC_PATH_PROG(CPIO, [cpio], [])
+AC_PATH_PROG(DITTO, [ditto], [])
 AC_PATH_PROG(CVS, [cvs], [])
 AC_PATH_PROG(SVN, [svn], [])
 AC_PATH_PROG(GIT, [git], [])
@@ -103,6 +109,8 @@
 AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
 AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
 AC_PATH_PROG(BZIP2, [bzip2], [])
+AC_PATH_PROG(LSBOM, [lsbom], [])
+AC_PATH_PROG(MKBOM, [mkbom], [])
 AC_PATH_PROG(PAX, [pax], [])
 AC_PATH_PROG(XAR, [xar], [])
 AC_PATH_PROG(OPEN, [open], [])
@@ -313,7 +321,7 @@
 	trace-sdk,
 	AS_HELP_STRING([--with-trace-sdk=SDK],
 		[SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
-	[test -d /Developer/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
+	[test -d ${DEVELOPER_DIR}/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
 
 # Allows building of shared libraries
 SC_ENABLE_SHARED

Modified: trunk/base/doc/macports.conf.in
===================================================================
--- trunk/base/doc/macports.conf.in	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/doc/macports.conf.in	2009-06-05 13:49:27 UTC (rev 51849)
@@ -21,6 +21,9 @@
 # paths are given in the example; it need not be uncommented.  Customizing binpath is intended for advanced users only.
 #binpath		@prefix_expanded@/bin:@prefix_expanded@/sbin:/bin:/sbin:/usr/bin:/usr/sbin
 
+# Directory containing Xcode Tools
+developer_dir       @DEVELOPER_DIR@
+
 # Directory containing Applications from ports.
 applications_dir	@MPAPPLICATIONSDIR@
 

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/macports1.0/macports.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -45,7 +45,7 @@
         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 developer_dir universal_target universal_sysroot universal_archs \
         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
@@ -54,7 +54,7 @@
         portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
         rsync_options rsync_dir startupitem_type place_worksymlink \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir universal_target universal_sysroot universal_archs $user_options"
+        applications_dir frameworks_dir developer_dir universal_target universal_sysroot universal_archs $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
@@ -644,20 +644,25 @@
     if {![info exists macports::buildmakejobs]} {
         set macports::buildmakejobs 0
     }
+    
+    # Default Xcode Tools path
+    if {![info exists macports::developer_dir]} {
+        set macports::developer_dir "/Developer"
+    }
 
     # Default mp universal options
     if {![info exists macports::universal_target]} {
-        if {[file exists /Developer/SDKs/MacOSX10.5.sdk]} {
+        if {[file exists ${macports::developer_dir}/SDKs/MacOSX10.5.sdk]} {
             set macports::universal_target "10.5"
         } else {
             set macports::universal_target "10.4"
         }
     }
     if {![info exists macports::universal_sysroot]} {
-        if {[file exists /Developer/SDKs/MacOSX10.5.sdk]} {
-            set macports::universal_sysroot "/Developer/SDKs/MacOSX10.5.sdk"
+        if {[file exists ${macports::developer_dir}/SDKs/MacOSX10.5.sdk]} {
+            set macports::universal_sysroot "${macports::developer_dir}/SDKs/MacOSX10.5.sdk"
         } else {
-            set macports::universal_sysroot "/Developer/SDKs/MacOSX10.4u.sdk"
+            set macports::universal_sysroot "${macports::developer_dir}/SDKs/MacOSX10.4u.sdk"
         }
     }
     if {![info exists macports::universal_archs]} {
@@ -910,11 +915,11 @@
     if {![file writable $fetchdir]} {
         return -code error "Port remote fetch failed: You do not have permission to write to $fetchdir"
     }
-    if {[catch {exec curl -L -s -S -o [file join $fetchdir $fetchfile] $url} result]} {
+    if {[catch {curl fetch $url [file join $fetchdir $fetchfile]} result]} {
         return -code error "Port remote fetch failed: $result"
     }
     cd $fetchdir
-    if {[catch {exec tar -zxf $fetchfile} result]} {
+    if {[catch {exec [findBinary tar $macports::autoconf::tar_path] -zxf $fetchfile} result]} {
         return -code error "Port extract failed: $result"
     }
     if {[regexp {(.+).tgz} $fetchfile match portdir] != 1} {
@@ -1647,7 +1652,7 @@
                     # sync just a PortIndex file
                     set indexfile [macports::getindex $source]
                     file mkdir [file dirname $indexfile]
-                    exec curl -L -s -S -o $indexfile $source/PortIndex
+                    curl $source/PortIndex $indexfile
                 }
             }
             default {
@@ -2153,9 +2158,8 @@
             set owner [file attributes ${prefix} -owner]
             set group [file attributes ${prefix} -group]
             set perms [string range [file attributes ${prefix} -permissions] end-3 end]
-            set installing_user [exec /usr/bin/id -un]
-            if {![string equal $installing_user $owner]} {
-                return -code error "User $installing_user does not own ${prefix} - try using sudo"
+            if {![string equal $tcl_platform(user) $owner]} {
+                return -code error "User $tcl_platform(user) does not own ${prefix} - try using sudo"
             }
             ui_debug "Permissions OK"
 
@@ -2193,7 +2197,7 @@
     # set the MacPorts sources to the right owner
     set sources_owner [file attributes [file join $portdbpath sources/] -owner]
     ui_debug "Setting MacPorts sources ownership to $sources_owner"
-    if { [catch { exec chown -R $sources_owner [file join $portdbpath sources/] } result] } {
+    if { [catch { exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/] } result] } {
         return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to $sources_owner: $result"
     }
 

Modified: trunk/base/src/macports1.0/macports_autoconf.tcl.in
===================================================================
--- trunk/base/src/macports1.0/macports_autoconf.tcl.in	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/macports1.0/macports_autoconf.tcl.in	2009-06-05 13:49:27 UTC (rev 51849)
@@ -32,6 +32,7 @@
 package provide macports 1.0
 
 namespace eval macports::autoconf {
+    variable chown_path "@CHOWN@"
     variable gzip_path "@GZIP@"
     variable macports_conf_path "@MPCONFIGDIR_EXPANDED@"
     variable macports_version "@MACPORTS_VERSION@"

Modified: trunk/base/src/package1.0/portarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portarchive.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/package1.0/portarchive.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -359,7 +359,10 @@
 			puts $fd "@portvariant +${v}"
 		}
 	}
-	foreach fullpath [exec find $destpath ! -type d] {
+	fs-traverse fullpath $destpath {
+	    if {[file isdirectory $fullpath]} {
+	        continue
+	    }
 		set relpath [strsed $fullpath "s|^$destpath/||"]
 		if {![regexp {^[+]} $relpath]} {
 			puts $fd "$relpath"

Modified: trunk/base/src/package1.0/portdmg.tcl
===================================================================
--- trunk/base/src/package1.0/portdmg.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/package1.0/portdmg.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -89,20 +89,23 @@
         set subdev 2
     }
     
-    if {[system "hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
+    set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
+    if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
     }
-    if {[catch {set devicename [exec hdid ${tmp_image} | grep s${subdev} | awk "{ print \$1 }"]} error]} {
+    if {[catch {set attach_output [exec $hdiutil attach -puppetstrings ${tmp_image} | grep s${subdev}]} error]} {
         return -code error [format [msgcat::mc "Failed to attach temporary image: %s"] ${error}]
     }
-    set mount_point [exec mount | grep "${devicename}"]
+    set attach_output [split $attach_output "\t"]
+    set devicename [string trim [lindex $attach_output 0]]
+    set mount_point [string trim [lindex $attach_output 2]]
     regexp {(\/Volumes/[A-Za-z0-9\-\_\s].+)\s\(} $mount_point code mount_point
-    system "ditto -rsrcFork ${pkgpath} '${mount_point}/${portname}-${portversion}.pkg'"
-    system "hdiutil detach ${devicename} -quiet"
-    if {[system "hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
+    system "[findBinary ditto $portutil::autoconf::ditto_path] -rsrcFork ${pkgpath} '${mount_point}/${portname}-${portversion}.pkg'"
+    system "$hdiutil detach ${devicename} -quiet"
+    if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
         return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
     }
-    if {[system "hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
+    if {[system "$hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
     }
     file delete -force "${tmp_image}"

Modified: trunk/base/src/package1.0/portmdmg.tcl
===================================================================
--- trunk/base/src/package1.0/portmdmg.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/package1.0/portmdmg.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -88,27 +88,30 @@
 	# Apple_partition_scheme (Apple_partition_map is at s1)
         set subdev 2
     }
-    
+
+  set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
   if {false} {
-    if {[system "hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
+    if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
     }
-    if {[catch {set devicename [exec hdid ${tmp_image} | grep s${subdev} | awk "{ print \$1 }"]} error]} {
+    if {[catch {set attach_output [exec $hdiutil attach -puppetstrings ${tmp_image} | grep s${subdev}]} error]} {
         return -code error [format [msgcat::mc "Failed to attach temporary image: %s"] ${error}]
     }
-    set mount_point [exec mount | grep "${devicename}"]
+    set attach_output [split $attach_output "\t"]
+    set devicename [string trim [lindex $attach_output 0]]
+    set mount_point [string trim [lindex $attach_output 2]]
     regexp {(\/Volumes/[A-Za-z0-9\-\_\s].+)\s\(} $mount_point code mount_point
-    system "ditto -rsrcFork ${mpkgpath} '${mount_point}/${portname}-${portversion}.mpkg'"
-    system "hdiutil detach ${devicename} -quiet"
+    system "[findBinary ditto $portutil::autoconf::ditto_path] -rsrcFork ${mpkgpath} '${mount_point}/${portname}-${portversion}.mpkg'"
+    system "$hdiutil detach ${devicename} -quiet"
   } else {
-    if {[system "hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}"] != ""} {
+    if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
     }
   }
-    if {[system "hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
+    if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
         return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
     }
-    if {[system "hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
+    if {[system "$hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
     }
     file delete -force "${tmp_image}"

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/package1.0/portpkg.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -73,7 +73,7 @@
         return 0
     }
 
-    set packagemaker "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"
+    set packagemaker "[option developer_dir]/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"
     if ([file exists "$packagemaker"]) {
         set resourcepath ${workpath}/pkg_resources
     } else {
@@ -81,7 +81,8 @@
     }
 
     set language "English"
-    system "mkdir -p -m 0755 ${resourcepath}/$language.lproj"
+    file mkdir "${resourcepath}/${language}.lproj"
+    file attributes "${resourcepath}/${language}.lproj" -permissions 0755
 	
     # long_description, description, or homepage may not exist
     foreach variable {long_description description homepage} {
@@ -135,8 +136,8 @@
         write_PkgInfo ${pkgpath}/Contents/PkgInfo
         write_info_plist ${pkgpath}/Contents/Info.plist $portname $portversion $portrevision
 
-        system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
-        system "cd ${destpath} && pax -x cpio -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
+        system "[findBinary mkbom $portutil::autoconf::mkbom_path] ${destpath} ${pkgpath}/Contents/Archive.bom"
+        system "cd ${destpath} && [findBinary pax $portutil::autoconf::pax_path] -x [findBinary cpio $portutil::autoconf::cpio_path] -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
 
         write_description_plist ${resourcepath}/Description.plist $portname $portversion $description
         write_sizes_file ${resourcepath}/Archive.sizes ${portname} ${portversion} ${pkgpath} ${destpath}
@@ -146,9 +147,10 @@
     foreach dir {etc var tmp} {
         if ([file exists "${destpath}/private/$dir"]) {
             # restore any directories that were moved, to avoid confusing the rest of the ports system.
-            system "mv ${destpath}/private/$dir ${destpath}/$dir; rmdir ${destpath}/private 2>/dev/null"
+            file rename ${destpath}/private/$dir ${destpath}/$dir
         }
     }
+    catch {file delete ${destpath}/private}
 
     return 0
 }
@@ -297,7 +299,7 @@
 
 proc portpkg::write_sizes_file {sizesfile portname portversion pkgpath destpath} {
     
-    if {[catch {set numFiles [exec lsbom -s ${pkgpath}/Contents/Archive.bom | wc -l]} result]} {
+    if {[catch {set numFiles [llength [split [exec [findBinary lsbom $portutil::autoconf::lsbom_path] -s ${pkgpath}/Contents/Archive.bom] "\n"]]} result]} {
         return -code error [format [msgcat::mc "Reading package bom failed: %s"] $result]
     }
     if {[catch {set compressedSize [expr [dirSize ${pkgpath}] / 1024]} result]} {

Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/package1.0/portunarchive.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -299,7 +299,7 @@
 	# Reset state file with archive version
     set statefile [file join $workpath .macports.${name}.state]
 	file copy -force [file join $destpath "+STATE"] $statefile
-	exec touch $statefile
+	file mtime $statefile [clock seconds]
 
 # Hack to temporarily move com.apple.* strings in statefiles extracted from old archives
 # to the org.macports.* namespace. "temporarily" because old archives will still have a

Modified: trunk/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- trunk/base/src/port1.0/port_autoconf.tcl.in	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/port1.0/port_autoconf.tcl.in	2009-06-05 13:49:27 UTC (rev 51849)
@@ -33,6 +33,8 @@
 namespace eval portutil::autoconf {
 	variable bzip2_path "@BZIP2@"
 	variable cp_path "@CP@"
+	variable cpio_path "@CPIO@"
+	variable ditto_path "@DITTO@"
 	variable cvs_path "@CVS@"
 	variable svn_path "@SVN@"
 	variable git_path "@GIT@"
@@ -41,6 +43,8 @@
 	variable rsync_path "@RSYNC@"
 	variable unzip_path "@UNZIP@"
 	variable zip_path "@ZIP@"
+	variable lsbom_path "@LSBOM@"
+	variable mkbom_path "@MKBOM@"
 	variable mtree_path "@MTREE@"
 	variable pax_path "@PAX@"
 	variable xar_path "@XAR@"

Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/port1.0/portconfigure.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -129,10 +129,10 @@
 default configure.pkg_config_path   {}
 
 # backwards compatibility for hardcoded ports
-if {[file exists /Developer/SDKs/MacOSX10.5.sdk]} {
-    set sysroot "/Developer/SDKs/MacOSX10.5.sdk"
+if {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} {
+    set sysroot "${developer_dir}/SDKs/MacOSX10.5.sdk"
 } else {
-    set sysroot "/Developer/SDKs/MacOSX10.4u.sdk"
+    set sysroot "${developer_dir}/SDKs/MacOSX10.4u.sdk"
 }
 
 options configure.universal_target configure.universal_sysroot configure.universal_archs configure.universal_args configure.universal_cflags configure.universal_cppflags configure.universal_cxxflags configure.universal_ldflags
@@ -264,7 +264,7 @@
 
 # internal function to find correct compilers
 proc portconfigure::configure_get_compiler {type} {
-    global configure.compiler prefix
+    global configure.compiler prefix developer_dir
     set ret ""
     switch -exact ${configure.compiler} {
         gcc {
@@ -300,16 +300,16 @@
         }
         llvm-gcc-4.2 {
             switch -exact ${type} {
-                cc   { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 }
-                objc { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 }
-                cxx  { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2 }
-                cpp  { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 }
+                cc   { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 }
+                objc { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 }
+                cxx  { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-g++-4.2 }
+                cpp  { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 }
             }
         }
         clang {
             switch -exact ${type} {
-                cc   { set ret /Developer/usr/bin/clang }
-                objc { set ret /Developer/usr/bin/clang }
+                cc   { set ret ${developer_dir}/usr/bin/clang }
+                objc { set ret ${developer_dir}/usr/bin/clang }
             }
         }
         apple-gcc-3.3 {

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/port1.0/portdestroot.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -122,7 +122,7 @@
     # end gsoc08-privileges
 
     set oldmask [umask ${destroot.umask}]
-    set mtree ${portutil::autoconf::mtree_path}
+    set mtree [findBinary mtree ${portutil::autoconf::mtree_path}]
 
     if { ${destroot.clean} == "yes" } {
         delete "${destroot}"
@@ -145,6 +145,7 @@
 
 proc portdestroot::destroot_finish {args} {
     global UI_PREFIX destroot prefix name startupitem.create destroot.violate_mtree
+    global applications_dir frameworks_dir developer_dir destroot.keepdirs
     global os.platform os.version
     variable oldmask
 
@@ -162,21 +163,19 @@
     }
 
     # Prune empty directories in ${destroot}
-    set exclude_dirs [list]
-    set exclude_phrase ""
-    foreach path [option destroot.keepdirs] {
+    foreach path ${destroot.keepdirs} {
         if {![file isdirectory ${path}]} {
             xinstall -m 0755 -d ${path}
         }
         if {![file exists ${path}/.turd_${name}]} {
             xinstall -c -m 0644 /dev/null ${path}/.turd_${name}
         }
-        lappend exclude_dirs "-path \"${path}\""
     }
-    if { [llength ${exclude_dirs}] > 0 } {
-        set exclude_phrase "! \\( [join ${exclude_dirs} " -or "] \\)"
+    fs-traverse -depth dir ${destroot} {
+        if {[file isdirectory $dir]} {
+            catch {file delete $dir}
+        }
     }
-    catch {system "find \"${destroot}\" -depth -type d ${exclude_phrase} -exec rmdir -- \{\} \\; 2>/dev/null"}
 
     # Compress all manpages with gzip (instead)
     # but NOT on Jaguar (Darwin 6.x)
@@ -309,9 +308,8 @@
                 } else {
                     # these files are outside of the prefix
                     switch $dfile {
-                        /Applications -
-                        /Developer -
-                        /Library { ui_debug "port installs files in $dfile" }
+                        $applications_dir -
+                        $developer_dir { ui_debug "port installs files in $dfile" }
                         default {
                             ui_warn "violation by $dfile"
                             set mtree_violation "yes"

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2009-06-05 08:53:58 UTC (rev 51848)
+++ trunk/base/src/port1.0/portmain.tcl	2009-06-05 13:49:27 UTC (rev 51849)
@@ -61,6 +61,7 @@
 default prefix /opt/local
 default applications_dir /Applications/MacPorts
 default frameworks_dir {${prefix}/Library/Frameworks}
+default developer_dir {/Developer}
 default destdir destroot
 default destpath {${workpath}/${destdir}}
 # destroot is provided as a clearer name for the "destpath" variable
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090605/5c45db6f/attachment-0001.html>


More information about the macports-changes mailing list