[51135] trunk/base

jmr at macports.org jmr at macports.org
Mon May 18 20:59:02 PDT 2009


Revision: 51135
          http://trac.macports.org/changeset/51135
Author:   jmr at macports.org
Date:     2009-05-18 20:59:01 -0700 (Mon, 18 May 2009)
Log Message:
-----------
make findBinary available in port1.0 and use autoconf paths for a bunch of stuff (see #18149)

Modified Paths:
--------------
    trunk/base/configure
    trunk/base/configure.ac
    trunk/base/src/macports1.0/macports_autoconf.tcl.in
    trunk/base/src/package1.0/portarchive.tcl
    trunk/base/src/package1.0/portunarchive.tcl
    trunk/base/src/port/portindex.tcl
    trunk/base/src/port1.0/port_autoconf.tcl.in
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portextract.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/configure
===================================================================
--- trunk/base/configure	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/configure	2009-05-19 03:59:01 UTC (rev 51135)
@@ -715,19 +715,26 @@
 SED_EXT
 OPEN
 XAR
+PAX
 BZIP2
 GNUMAKE
 GNUTAR
 XCODEBUILD
 LAUNCHCTL
 HAVE_LAUNCHD
+HDIUTIL
 MAKE
+ZIP
+UNZIP
 TAR
 SED
 RSYNC
+RMDIR
+GZIP
 GIT
 SVN
 CVS
+CP
 MTREE
 LN_S
 SET_MAKE
@@ -3743,6 +3750,46 @@
 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
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_CP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $CP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CP="$CP" # 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_CP="$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
+CP=$ac_cv_path_CP
+if test -n "$CP"; then
+  { $as_echo "$as_me:$LINENO: result: $CP" >&5
+$as_echo "$CP" >&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
@@ -3863,6 +3910,86 @@
 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
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_GZIP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $GZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GZIP="$GZIP" # 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_GZIP="$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
+GZIP=$ac_cv_path_GZIP
+if test -n "$GZIP"; then
+  { $as_echo "$as_me:$LINENO: result: $GZIP" >&5
+$as_echo "$GZIP" >&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
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_RMDIR+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $RMDIR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RMDIR="$RMDIR" # 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_RMDIR="$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
+RMDIR=$ac_cv_path_RMDIR
+if test -n "$RMDIR"; then
+  { $as_echo "$as_me:$LINENO: result: $RMDIR" >&5
+$as_echo "$RMDIR" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "rsync", so it can be a program name with args.
 set dummy rsync; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -3983,6 +4110,86 @@
 fi
 
 
+# Extract the first word of "unzip", so it can be a program name with args.
+set dummy unzip; 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_UNZIP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $UNZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_UNZIP="$UNZIP" # 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_UNZIP="$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
+UNZIP=$ac_cv_path_UNZIP
+if test -n "$UNZIP"; then
+  { $as_echo "$as_me:$LINENO: result: $UNZIP" >&5
+$as_echo "$UNZIP" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "zip", so it can be a program name with args.
+set dummy zip; 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_ZIP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $ZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ZIP="$ZIP" # 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_ZIP="$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
+ZIP=$ac_cv_path_ZIP
+if test -n "$ZIP"; then
+  { $as_echo "$as_me:$LINENO: result: $ZIP" >&5
+$as_echo "$ZIP" >&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
@@ -4023,6 +4230,46 @@
 fi
 
 
+# Extract the first word of "hdiutil", so it can be a program name with args.
+set dummy hdiutil; 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_HDIUTIL+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $HDIUTIL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_HDIUTIL="$HDIUTIL" # 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_HDIUTIL="$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
+HDIUTIL=$ac_cv_path_HDIUTIL
+if test -n "$HDIUTIL"; then
+  { $as_echo "$as_me:$LINENO: result: $HDIUTIL" >&5
+$as_echo "$HDIUTIL" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "launchd", so it can be a program name with args.
 set dummy launchd; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -4272,6 +4519,46 @@
 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
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PAX+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $PAX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PAX="$PAX" # 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_PAX="$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
+PAX=$ac_cv_path_PAX
+if test -n "$PAX"; then
+  { $as_echo "$as_me:$LINENO: result: $PAX" >&5
+$as_echo "$PAX" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "xar", so it can be a program name with args.
 set dummy xar; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5

Modified: trunk/base/configure.ac
===================================================================
--- trunk/base/configure.ac	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/configure.ac	2009-05-19 03:59:01 UTC (rev 51135)
@@ -84,19 +84,26 @@
 AC_PROG_MAKE_SET
 AC_PROG_LN_S
 AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
+AC_PATH_PROG(CP, [cp], [])
 AC_PATH_PROG(CVS, [cvs], [])
 AC_PATH_PROG(SVN, [svn], [])
 AC_PATH_PROG(GIT, [git], [])
+AC_PATH_PROG(GZIP, [gzip], [])
+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(MAKE, [make])
+AC_PATH_PROG(HDIUTIL, [hdiutil], [])
 AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
 AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
 AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
 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(PAX, [pax], [])
 AC_PATH_PROG(XAR, [xar], [])
 AC_PATH_PROG(OPEN, [open], [])
 

Modified: trunk/base/src/macports1.0/macports_autoconf.tcl.in
===================================================================
--- trunk/base/src/macports1.0/macports_autoconf.tcl.in	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/macports1.0/macports_autoconf.tcl.in	2009-05-19 03:59:01 UTC (rev 51135)
@@ -32,9 +32,12 @@
 package provide macports 1.0
 
 namespace eval macports::autoconf {
+    variable gzip_path "@GZIP@"
     variable macports_conf_path "@MPCONFIGDIR_EXPANDED@"
     variable macports_version "@MACPORTS_VERSION@"
     variable macports_user_dir "~/.macports"
+    variable open_path "@OPEN@"
     variable rsync_path "@RSYNC@"
-    variable open_path "@OPEN@"
+    variable tar_command "@TAR_CMD@"
+    variable tar_path "@TAR@"
 }

Modified: trunk/base/src/package1.0/portarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portarchive.tcl	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/package1.0/portarchive.tcl	2009-05-19 03:59:01 UTC (rev 51135)
@@ -170,13 +170,13 @@
 	switch -regex ${archive.type} {
 		cp(io|gz) {
 			set pax "pax"
-			if {[catch {set pax [binaryInPath $pax]} errmsg] == 0} {
+			if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
 				ui_debug "Using $pax"
 				set archive.cmd "$pax"
 				set archive.pre_args {-w -v -x cpio}
 				if {[regexp {z$} ${archive.type}]} {
 					set gzip "gzip"
-					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+					if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
 						ui_debug "Using $gzip"
 						set archive.args {.}
 						set archive.post_args "| $gzip -c9 > ${archive.path}"
@@ -194,7 +194,7 @@
 		}
 		t(ar|bz|lz|gz) {
 			set tar "tar"
-			if {[catch {set tar [binaryInPath $tar]} errmsg] == 0} {
+			if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
 				ui_debug "Using $tar"
 				set archive.cmd "$tar"
 				set archive.pre_args {-cvf}
@@ -209,7 +209,12 @@
 						set gzip "gzip"
 						set level 9
 					}
-					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+					if {[info exists portutil::autoconf::${gzip}_path]} {
+					    set hint [set portutil::autoconf::${gzip}_path]
+					} else {
+					    set hint ""
+					}
+					if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
 						ui_debug "Using $gzip"
 						set archive.args {- .}
 						set archive.post_args "| $gzip -c$level > ${archive.path}"
@@ -227,7 +232,7 @@
 		}
 		xar {
 			set xar "xar"
-			if {[catch {set xar [binaryInPath $xar]} errmsg] == 0} {
+			if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
 				ui_debug "Using $xar"
 				set archive.cmd "$xar"
 				set archive.pre_args {-cvf}
@@ -240,7 +245,7 @@
 		xpkg {
 			set xar "xar"
 			set compression "bzip2"
-			if {[catch {set xar [binaryInPath $xar]} errmsg] == 0} {
+			if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
 				ui_debug "Using $xar"
 				set archive.cmd "$xar"
 				set archive.pre_args "-cv --exclude='\./\+.*' --compression=${compression} -n ${archive.metaname} -s ${archive.metapath} -f"
@@ -252,7 +257,7 @@
 		}
 		zip {
 			set zip "zip"
-			if {[catch {set zip [binaryInPath $zip]} errmsg] == 0} {
+			if {[catch {set zip [findBinary $zip ${portutil::autoconf::zip_path}]} errmsg] == 0} {
 				ui_debug "Using $zip"
 				set archive.cmd "$zip"
 				set archive.pre_args {-ry9}

Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/package1.0/portunarchive.tcl	2009-05-19 03:59:01 UTC (rev 51135)
@@ -170,7 +170,7 @@
 	switch -regex ${unarchive.type} {
 		cp(io|gz) {
 			set pax "pax"
-			if {[catch {set pax [binaryInPath $pax]} errmsg] == 0} {
+			if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
 				ui_debug "Using $pax"
 				set unarchive.cmd "$pax"
 				if {[info exists env(USER)] && $env(USER) == "root"} {
@@ -181,7 +181,7 @@
 				if {[regexp {z$} ${unarchive.type}]} {
 					set unarchive.args {.}
 					set gzip "gzip"
-					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+					if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
 						ui_debug "Using $gzip"
 						set unarchive.pipe_cmd "$gzip -d -c ${unarchive.path} |"
 					} else {
@@ -198,7 +198,7 @@
 		}
 		t(ar|bz|lz|gz) {
 			set tar "tar"
-			if {[catch {set tar [binaryInPath $tar]} errmsg] == 0} {
+			if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
 				ui_debug "Using $tar"
 				set unarchive.cmd "$tar"
 				set unarchive.pre_args {-xvpf}
@@ -211,7 +211,12 @@
 					} else {
 						set gzip "gzip"
 					}
-					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+					if {[info exists portutil::autoconf::${gzip}_path]} {
+					    set hint [set portutil::autoconf::${gzip}_path]
+					} else {
+					    set hint ""
+					}
+					if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
 						ui_debug "Using $gzip"
 						set unarchive.pipe_cmd "$gzip -d -c ${unarchive.path} |"
 					} else {
@@ -228,7 +233,7 @@
 		}
 		xar {
 			set xar "xar"
-			if {[catch {set xar [binaryInPath $xar]} errmsg] == 0} {
+			if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
 				ui_debug "Using $xar"
 				set unarchive.cmd "$xar"
 				set unarchive.pre_args {-xvpf}
@@ -240,7 +245,7 @@
 		}
 		zip {
 			set unzip "unzip"
-			if {[catch {set unzip [binaryInPath $unzip]} errmsg] == 0} {
+			if {[catch {set unzip [findBinary $unzip ${portutil::autoconf::unzip_path}]} errmsg] == 0} {
 				ui_debug "Using $unzip"
 				set unarchive.cmd "$unzip"
 				if {[info exists env(USER)] && $env(USER) == "root"} {

Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/port/portindex.tcl	2009-05-19 03:59:01 UTC (rev 51135)
@@ -60,7 +60,9 @@
             set portinfo(portarchive) [file join [file dirname $portdir] [file tail $portdir]].tgz
             cd [file join $directory [file dirname $portinfo(portdir)]]
             puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
-            if {[catch {exec tar -cf - [file tail $portdir] | gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
+            set tar [findBinary tar $macports::autoconf::tar_path]
+            set gzip [findBinary gzip $macports::autoconf::gzip_path]
+            if {[catch {exec $tar -cf - [file tail $portdir] | $gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
                 puts stderr "Failed to create port archive $portinfo(portarchive): $result"
                 exit 1
             }

Modified: trunk/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- trunk/base/src/port1.0/port_autoconf.tcl.in	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/port1.0/port_autoconf.tcl.in	2009-05-19 03:59:01 UTC (rev 51135)
@@ -31,15 +31,24 @@
 package provide port 1.0
 
 namespace eval portutil::autoconf {
+	variable bzip2_path "@BZIP2@"
+	variable cp_path "@CP@"
 	variable cvs_path "@CVS@"
 	variable svn_path "@SVN@"
 	variable git_path "@GIT@"
+	variable gzip_path "@GZIP@"
+	variable rmdir_path "@RMDIR@"
 	variable rsync_path "@RSYNC@"
+	variable unzip_path "@UNZIP@"
+	variable zip_path "@ZIP@"
 	variable mtree_path "@MTREE@"
+	variable pax_path "@PAX@"
 	variable xar_path "@XAR@"
 	variable sed_command "@SED@"
 	variable sed_ext_flag "@SED_EXT@"
 	variable tar_command "@TAR_CMD@"
+	variable tar_path "@TAR@"
+	variable hdiutil_path "@HDIUTIL@"
 	variable have_launchd "@HAVE_LAUNCHD@"
 	variable launchctl_path "@LAUNCHCTL@"
 	variable install_command "@INSTALL@"

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/port1.0/portdestroot.tcl	2009-05-19 03:59:01 UTC (rev 51135)
@@ -182,6 +182,9 @@
     # but NOT on Jaguar (Darwin 6.x)
     if {![regexp {darwin6} "${os.platform}${os.version}"]} {
         set manpath "${destroot}${prefix}/share/man"
+        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
+        set gunzip "$gzip -d"
+        set bunzip2 "[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d"
         if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} {
             ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${portname}]"
             set found 0
@@ -197,17 +200,17 @@
                             if {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$" ${manfile} gzfile manfile]} {
                                 set found 1
                                 system "cd ${manpath} && \
-                                gunzip -f [file join ${mandir} ${gzfile}] && \
-                                gzip -9vf [file join ${mandir} ${manfile}]"
+                                $gunzip -f [file join ${mandir} ${gzfile}] && \
+                                $gzip -9vf [file join ${mandir} ${manfile}]"
                             } elseif {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]bz2\$" ${manfile} bz2file manfile]} {
                                 set found 1
                                 system "cd ${manpath} && \
-                                bunzip2 -f [file join ${mandir} ${bz2file}] && \
-                                gzip -9vf [file join ${mandir} ${manfile}]"
+                                $bunzip2 -f [file join ${mandir} ${bz2file}] && \
+                                $gzip -9vf [file join ${mandir} ${manfile}]"
                             } elseif {[regexp "\[.\]${manindex}\[a-z\]*\$" ${manfile}]} {
                                 set found 1
                                 system "cd ${manpath} && \
-                                gzip -9vf [file join ${mandir} ${manfile}]"
+                                $gzip -9vf [file join ${mandir} ${manfile}]"
                             }
                             set gzmanfile ${manfile}.gz
                             set gzmanfilepath [file join ${mandirpath} ${gzmanfile}]

Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/port1.0/portextract.tcl	2009-05-19 03:59:01 UTC (rev 51135)
@@ -53,7 +53,7 @@
 default extract.only {[portextract::disttagclean $distfiles]}
 
 default extract.dir {${workpath}}
-default extract.cmd gzip
+default extract.cmd {[findBinary gzip ${portutil::autoconf::gzip_path}]}
 default extract.pre_args -dc
 default extract.post_args {"| ${portutil::autoconf::tar_command} -xf -"}
 default extract.mkdir no
@@ -85,11 +85,11 @@
     }
 
     if {[tbool use_bzip2]} {
-        option extract.cmd [binaryInPath "bzip2"]
+        option extract.cmd [findBinary bzip2 ${portutil::autoconf::bzip2_path}]
     } elseif {[tbool use_lzma]} {
         option extract.cmd [binaryInPath "lzma"]
     } elseif {[tbool use_zip]} {
-        option extract.cmd [binaryInPath "unzip"]
+        option extract.cmd [findBinary unzip ${portutil::autoconf::unzip_path}]
         option extract.pre_args -q
         option extract.post_args "-d [option extract.dir]"
     } elseif {[tbool use_7z]} {
@@ -101,9 +101,9 @@
         set dmg_tmp_dir [exec mktemp -d -q "/tmp/mports.XXXXXXXX"]
         set dmg_mount ${dmg_tmp_dir}/${worksrcdir}
         file mkdir ${dmg_mount}
-        option extract.cmd [binaryInPath "hdiutil"]
+        option extract.cmd [findBinary hdiutil ${portutil::autoconf::hdiutil_path}]
         option extract.pre_args attach
-        option extract.post_args "-private -readonly -nobrowse -mountpoint ${dmg_mount} && [binaryInPath "cp"] -Rp ${dmg_mount} ${extract.dir} && ${extract.cmd} detach ${dmg_mount} && [binaryInPath "rmdir"] ${dmg_mount} ${dmg_tmp_dir}"
+        option extract.post_args "-private -readonly -nobrowse -mountpoint ${dmg_mount} && [findBinary cp  ${portutil::autoconf::cp_path}] -Rp ${dmg_mount} ${extract.dir} && ${extract.cmd} detach ${dmg_mount} && [findBinary rmdir  ${portutil::autoconf::rmdir_path}] ${dmg_mount} ${dmg_tmp_dir}"
     }
 }
 

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-05-19 02:30:01 UTC (rev 51134)
+++ trunk/base/src/port1.0/portutil.tcl	2009-05-19 03:59:01 UTC (rev 51135)
@@ -2188,6 +2188,20 @@
     return -code error [format [msgcat::mc "Failed to locate '%s' in path: '%s'"] $binary $env(PATH)];
 }
 
+# find a binary either in a path defined at MacPorts' configuration time
+# or in the PATH environment variable through binaryInPath (fallback)
+proc findBinary {prog {autoconf_hint ""}} {
+    if {${autoconf_hint} != "" && [file executable ${autoconf_hint}]} {
+        return ${autoconf_hint}
+    } else {
+        if {[catch {set cmd_path [binaryInPath ${prog}]} result] == 0} {
+            return ${cmd_path}
+        } else {
+            return -code error "${result} or at its MacPorts configuration time location, did you move it?"
+        }
+    }
+}
+
 # Set the UI prefix to something standard (so it can be grepped for in output)
 proc set_ui_prefix {} {
     global UI_PREFIX env
@@ -2220,10 +2234,10 @@
     switch -regex $type {
         cp(io|gz) {
             set pax "pax"
-            if {[catch {set pax [binaryInPath $pax]} errmsg] == 0} {
+            if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
                 if {[regexp {z$} $type]} {
                     set gzip "gzip"
-                    if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+                    if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
                         return 0
                     }
                 } else {
@@ -2233,7 +2247,7 @@
         }
         t(ar|bz|lz|gz) {
             set tar "tar"
-            if {[catch {set tar [binaryInPath $tar]} errmsg] == 0} {
+            if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
                 if {[regexp {z2?$} $type]} {
                     if {[regexp {bz2?$} $type]} {
                         set gzip "bzip2"
@@ -2242,7 +2256,12 @@
                     } else {
                         set gzip "gzip"
                     }
-                    if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+                    if {[info exists portutil::autoconf::${gzip}_path]} {
+                        set hint [set portutil::autoconf::${gzip}_path]
+                    } else {
+                        set hint ""
+                    }
+                    if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
                         return 0
                     }
                 } else {
@@ -2252,15 +2271,15 @@
         }
         xar {
             set xar "xar"
-            if {[catch {set xar [binaryInPath $xar]} errmsg] == 0} {
+            if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
                 return 0
             }
         }
         zip {
             set zip "zip"
-            if {[catch {set zip [binaryInPath $zip]} errmsg] == 0} {
+            if {[catch {set zip [findBinary $zip ${portutil::autoconf::zip_path}]} errmsg] == 0} {
                 set unzip "unzip"
-                if {[catch {set unzip [binaryInPath $unzip]} errmsg] == 0} {
+                if {[catch {set unzip [findBinary $unzip ${portutil::autoconf::unzip_path}]} errmsg] == 0} {
                     return 0
                 }
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090518/0ba33975/attachment-0001.html>


More information about the macports-changes mailing list