[120361] contrib/mpab
jmr at macports.org
jmr at macports.org
Sat May 24 02:35:15 PDT 2014
Revision: 120361
https://trac.macports.org/changeset/120361
Author: jmr at macports.org
Date: 2014-05-24 02:35:15 -0700 (Sat, 24 May 2014)
Log Message:
-----------
mpab: update other tcl scripts to work with base 2.3.0
Modified Paths:
--------------
contrib/mpab/chroot-scripts/archivepath.tcl
contrib/mpab/chroot-scripts/genportlist.tcl
contrib/mpab/oldports.tcl
contrib/mpab/subports.tcl
Modified: contrib/mpab/chroot-scripts/archivepath.tcl
===================================================================
--- contrib/mpab/chroot-scripts/archivepath.tcl 2014-05-24 08:58:11 UTC (rev 120360)
+++ contrib/mpab/chroot-scripts/archivepath.tcl 2014-05-24 09:35:15 UTC (rev 120361)
@@ -1,4 +1,6 @@
-#!/usr/bin/tclsh
+#!/bin/sh
+# \
+if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" -i `which port-tclsh` "$@"; else exec /usr/bin/tclsh "$0" -i /usr/bin/tclsh "$@"; fi
#
# Prints the archive filename for the given port with the given variations.
#
@@ -35,7 +37,26 @@
set prefix /opt/local
}
-source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+if {[llength $::argv] == 0} {
+ puts stderr "Usage: $argv0 <portname>"
+ exit 1
+} elseif {[llength $::argv] >= 3 && [lindex $argv 0] eq "-i"} {
+ set prefixFromInterp [file dirname [file dirname [lindex $argv 1]]]
+ if {$prefixFromInterp eq "/usr" && [file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+ } elseif {$prefixFromInterp ne $prefix} {
+ if {[file executable ${prefix}/bin/port-tclsh]} {
+ exec ${prefix}/bin/port-tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+ } else {
+ exec /usr/bin/tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+ }
+ exit 0
+ }
+ set ::argv [lrange $::argv 2 end]
+} elseif {[file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+}
+
package require macports
if {[catch {mportinit "" "" ""} result]} {
@@ -44,11 +65,6 @@
exit 1
}
-if {[llength $::argv] == 0} {
- puts stderr "Usage: $argv0 <portname>"
- exit 1
-}
-
set portname [lindex $::argv 0]
if {[llength $::argv] > 1} {
set variations [lindex $::argv 1]
Modified: contrib/mpab/chroot-scripts/genportlist.tcl
===================================================================
--- contrib/mpab/chroot-scripts/genportlist.tcl 2014-05-24 08:58:11 UTC (rev 120360)
+++ contrib/mpab/chroot-scripts/genportlist.tcl 2014-05-24 09:35:15 UTC (rev 120361)
@@ -1,4 +1,6 @@
-#!/usr/bin/env tclsh
+#!/bin/sh
+# \
+if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" -i `which port-tclsh` "$@"; else exec /usr/bin/tclsh "$0" -i /usr/bin/tclsh "$@"; fi
#
# Generates a list of ports where a port is only listed after all of its
# dependencies (sans variants) have already been listed
@@ -37,7 +39,23 @@
set prefix /opt/local
}
-source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+if {[llength $::argv] >= 2 && [lindex $argv 0] eq "-i"} {
+ set prefixFromInterp [file dirname [file dirname [lindex $argv 1]]]
+ if {$prefixFromInterp eq "/usr" && [file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+ } elseif {$prefixFromInterp ne $prefix} {
+ if {[file executable ${prefix}/bin/port-tclsh]} {
+ exec ${prefix}/bin/port-tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+ } else {
+ exec /usr/bin/tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+ }
+ exit 0
+ }
+ set ::argv [lrange $::argv 2 end]
+} elseif {[file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+}
+
package require macports
@@ -69,12 +87,12 @@
if {[catch {mportinit "" "" ""} result]} {
puts "$errorInfo"
- fatal "Failed to initialize ports sytem: $result"
+ error "Failed to initialize ports sytem: $result"
}
if {[catch {set search_result [mportlistall]} result]} {
puts "$errorInfo"
- fatal "Failed to find any ports: $result"
+ error "Failed to find any ports: $result"
}
array set portdepinfo {}
Modified: contrib/mpab/oldports.tcl
===================================================================
--- contrib/mpab/oldports.tcl 2014-05-24 08:58:11 UTC (rev 120360)
+++ contrib/mpab/oldports.tcl 2014-05-24 09:35:15 UTC (rev 120361)
@@ -1,32 +1,40 @@
-#!/usr/bin/tclsh
+#!/bin/sh
+# \
+if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" -i `which port-tclsh` "$@"; else exec /usr/bin/tclsh "$0" -i /usr/bin/tclsh "$@"; fi
proc printUsage {} {
- puts "Usage: $::argv0 \[-hV\] \[-t macports-tcl-path\]"
+ puts "Usage: $::argv0 \[-hV\] \[-p macports-prefix\]"
puts " -h This help"
- puts " -t Give a different location for the base MacPorts Tcl"
- puts " file (defaults to /Library/Tcl)"
+ puts " -p Use a different MacPorts prefix"
+ puts " (defaults to /opt/local)"
puts " -V show version and MacPorts version being used"
}
set MY_VERSION 0.1
-set macportsTclPath /Library/Tcl
+set macportsPrefix /opt/local
set showVersion 0
+set origArgv $::argv
while {[string index [lindex $::argv 0] 0] == "-" } {
switch [string range [lindex $::argv 0] 1 end] {
h {
printUsage
exit 0
}
- t {
+ i {
+ set interp_path [lindex $::argv 1]
+ set ::argv [lrange $::argv 1 end]
+ }
+ p {
if {[llength $::argv] < 2} {
- puts "-t needs a path"
+ puts "-p needs a path"
printUsage
exit 2
}
- set macportsTclPath [lindex $::argv 1]
+ set macportsPrefix [lindex $::argv 1]
set ::argv [lrange $::argv 1 end]
+ set userPrefix 1
}
V {
set showVersion 1
@@ -40,7 +48,28 @@
set ::argv [lrange $::argv 1 end]
}
-source "${macportsTclPath}/macports1.0/macports_fastload.tcl"
+# check that default prefix exists
+if {![info exists userPrefix] && ![file isdirectory $macportsPrefix]} {
+ error "prefix '$macportsPrefix' does not exist; maybe you need to use the -p option?"
+}
+
+if {[info exists interp_path]} {
+ set prefixFromInterp [file dirname [file dirname $interp_path]]
+ # make sure we're running in the port-tclsh associated with the correct prefix
+ if {$prefixFromInterp eq "/usr" && [file isfile ${macportsPrefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${macportsPrefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+ } elseif {$prefixFromInterp ne $macportsPrefix} {
+ if {[file executable ${macportsPrefix}/bin/port-tclsh]} {
+ exec ${macportsPrefix}/bin/port-tclsh $argv0 {*}[lrange $origArgv 2 end] <@stdin >@stdout 2>@stderr
+ } else {
+ exec /usr/bin/tclsh $argv0 {*}[lrange $origArgv 2 end] <@stdin >@stdout 2>@stderr
+ }
+ exit 0
+ }
+} elseif {[file isfile ${macportsPrefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${macportsPrefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+}
+
package require macports
mportinit
Modified: contrib/mpab/subports.tcl
===================================================================
--- contrib/mpab/subports.tcl 2014-05-24 08:58:11 UTC (rev 120360)
+++ contrib/mpab/subports.tcl 2014-05-24 09:35:15 UTC (rev 120361)
@@ -53,6 +53,8 @@
exit 0
}
set ::argv [lrange $::argv 2 end]
+} elseif {[file isfile ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl]} {
+ source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
}
package require macports
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140524/e294dc08/attachment-0001.html>
More information about the macports-changes
mailing list