[146654] trunk/base/src/port/port.tcl
g5pw at macports.org
g5pw at macports.org
Mon Mar 14 17:58:43 PDT 2016
Revision: 146654
https://trac.macports.org/changeset/146654
Author: g5pw at macports.org
Date: 2016-03-14 17:58:43 -0700 (Mon, 14 Mar 2016)
Log Message:
-----------
base: remove trailing whitespace from port.tcl
Modified Paths:
--------------
trunk/base/src/port/port.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2016-03-15 00:54:06 UTC (rev 146653)
+++ trunk/base/src/port/port.tcl 2016-03-15 00:58:43 UTC (rev 146654)
@@ -18,7 +18,7 @@
# 3. Neither the name of Apple Inc. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -115,12 +115,12 @@
Portnames that contain standard glob characters will be expanded to the
set of ports matching the glob pattern.
-
+
Port expressions
----------------
Portnames, port glob patterns, and pseudo-portnames may be logically
combined using expressions consisting of and, or, not, !, (, and ).
-
+
For more information
--------------------
See man pages: port(1), macports.conf(5), portfile(7), portgroup(7),
@@ -223,7 +223,7 @@
# we're handling errors in a soft fashion, in which
# case we continue
proc break_softcontinue { msg status name_status } {
- upvar $name_status status_var
+ upvar $name_status status_var
ui_error $msg
if {[macports::ui_isset ports_processall]} {
set status_var 0
@@ -245,7 +245,7 @@
# This function sorts the variants and presents them in a canonical representation
proc composite_version {version variations {emptyVersionOkay 0}} {
# Form a composite version out of the version and variations
-
+
# Select the variations into positive and negative
set pos {}
set neg {}
@@ -367,14 +367,14 @@
# Form the fully discriminated portname: portname/version_revison+-variants
set port(fullname) "$port(name)/[composite_version $port(version) $port(variants)]"
-
+
return [array get port]
}
proc add_to_portlist {listname portentry} {
upvar $listname portlist
-
+
# Form portlist entry and add to portlist
lappend portlist [entry_for_portlist $portentry]
}
@@ -455,7 +455,7 @@
proc foreachport {portlist block} {
set savedir [pwd]
foreach portspec $portlist {
-
+
# Set the variables for the block
uplevel 1 "array unset portspec; array set portspec { $portspec }"
uplevel 1 {
@@ -469,10 +469,10 @@
array unset options
array set options $portspec(options)
}
-
+
# Invoke block
uplevel 1 $block
-
+
# Restore cwd after each port, since mportopen changes it, and otherwise relative
# urls would break on subsequent passes
if {[file exists $savedir]} {
@@ -686,7 +686,7 @@
foreach m $list {
if {[string first "@" $m] < 0} {
if {[string first ":" $m] >= 0} {
- set m [regsub -- "(.*):(.*)" $m "\\2@\\1"]
+ set m [regsub -- "(.*):(.*)" $m "\\2@\\1"]
} elseif {$m ne "openmaintainer" && $m ne "nomaintainer"} {
set m "$m at macports.org"
}
@@ -706,15 +706,15 @@
foreach {name info} $infos {
array unset portinfo
array set portinfo $info
-
+
set portentry [entry_for_portlist [list url $portinfo(porturl) name $name]]
-
+
array unset entry
array set entry $portentry
-
+
if {[info exists unique($entry(fullname))]} continue
set unique($entry(fullname)) 1
-
+
lappend result $portentry
}
return $result
@@ -728,7 +728,7 @@
fatal "search for portname $pattern failed: $result"
}
set results [unique_results_to_portlist $res]
-
+
# Return the list of all ports, sorted
return [portlist_sort $results]
}
@@ -891,12 +891,12 @@
# Get information about latest available version and revision
set latest_version $portinfo(version)
set latest_revision 0
- if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
+ if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
set latest_revision $portinfo(revision)
}
set latest_compound "${latest_version}_${latest_revision}"
set latest_epoch 0
- if {[info exists portinfo(epoch)]} {
+ if {[info exists portinfo(epoch)]} {
set latest_epoch $portinfo(epoch)
}
@@ -1108,7 +1108,7 @@
array unset portinfo
array set portinfo [lindex $result 1]
set porturl $portinfo(porturl)
-
+
# open its portfile
if {[catch {set mport [mportopen $porturl [list subport $portinfo(name)] [array get global_variations]]} result]} {
ui_debug "$::errorInfo"
@@ -1198,7 +1198,7 @@
proc seqExpr { resname } {
upvar $resname reslist
-
+
# Evaluate a sequence of expressions a b c...
# These act the same as a or b or c
@@ -1217,14 +1217,14 @@
set reslist [opUnion $reslist $blist]
}
}
-
+
return $result
}
proc orExpr { resname } {
upvar $resname reslist
-
+
set a [andExpr reslist]
while ($a) {
switch -- [lookahead] {
@@ -1234,7 +1234,7 @@
if {![andExpr blist]} {
return 0
}
-
+
# Calculate a union b
set reslist [opUnion $reslist $blist]
}
@@ -1243,26 +1243,26 @@
}
}
}
-
+
return $a
}
proc andExpr { resname } {
upvar $resname reslist
-
+
set a [unaryExpr reslist]
while {$a} {
switch -- [lookahead] {
and {
advance
-
+
set blist {}
set b [unaryExpr blist]
if {!$b} {
return 0
}
-
+
# Calculate a intersect b
set reslist [opIntersection $reslist $blist]
}
@@ -1271,7 +1271,7 @@
}
}
}
-
+
return $a
}
@@ -1295,7 +1295,7 @@
set result [element reslist]
}
}
-
+
return $result
}
@@ -1303,13 +1303,13 @@
proc element { resname } {
upvar $resname reslist
set el 0
-
+
set url ""
set name ""
set version ""
array unset requested_variants
array unset options
-
+
set token [lookahead]
switch -regex -- $token {
^\\)$ -
@@ -1411,10 +1411,10 @@
set recursive [string equal $selector "rdependentof"]
add_multiple_ports reslist [get_dependent_ports $portname $recursive]
-
+
set el 1
}
-
+
^depof: -
^rdepof: {
advance
@@ -1424,7 +1424,7 @@
set recursive [string equal $selector "rdepof"]
add_multiple_ports reslist [get_dep_ports $portname $recursive]
-
+
set el 1
}
@@ -1481,12 +1481,12 @@
proc add_multiple_ports { resname ports {remainder ""} } {
upvar $resname reslist
-
+
set version ""
array unset variants
array unset options
parsePortSpec version variants options $remainder
-
+
array unset overrides
if {$version ne ""} { set overrides(version) $version }
if {[array size variants]} {
@@ -1525,7 +1525,7 @@
proc opIntersection { a b } {
set result {}
-
+
# Rules we follow in performing the intersection of two port lists:
#
# a/, a/ ==> a/
@@ -1536,7 +1536,7 @@
#
# If there's an exact match, we take it.
# If there's a match between simple and discriminated, we take the later.
-
+
# First create a list of the fully discriminated names in b
array unset bfull
set i 0
@@ -1545,14 +1545,14 @@
set bfull($port(fullname)) $i
incr i
}
-
+
# Walk through each item in a, matching against b
foreach aitem [unique_entries $a] {
array set port $aitem
-
+
# Quote the fullname and portname to avoid special characters messing up the regexp
set safefullname [regex_pat_sanitize $port(fullname)]
-
+
set simpleform [expr { "$port(name)/" == $port(fullname) }]
if {$simpleform} {
set pat "^${safefullname}"
@@ -1560,7 +1560,7 @@
set safename [regex_pat_sanitize $port(name)]
set pat "^${safefullname}$|^${safename}/$"
}
-
+
set matches [array names bfull -regexp $pat]
foreach match $matches {
if {$simpleform} {
@@ -1571,16 +1571,16 @@
}
}
}
-
+
return $result
}
proc opComplement { a b } {
set result {}
-
+
# Return all elements of a not matching elements in b
-
+
# First create a list of the fully discriminated names in b
array unset bfull
set i 0
@@ -1589,14 +1589,14 @@
set bfull($port(fullname)) $i
incr i
}
-
+
# Walk through each item in a, taking all those items that don't match b
foreach aitem $a {
array set port $aitem
-
+
# Quote the fullname and portname to avoid special characters messing up the regexp
set safefullname [regex_pat_sanitize $port(fullname)]
-
+
set simpleform [expr { "$port(name)/" == $port(fullname) }]
if {$simpleform} {
set pat "^${safefullname}"
@@ -1604,7 +1604,7 @@
set safename [regex_pat_sanitize $port(name)]
set pat "^${safefullname}$|^${safename}/$"
}
-
+
set matches [array names bfull -regexp $pat]
# We copy this element to result only if it didn't match against b
@@ -1612,7 +1612,7 @@
lappend result $aitem
}
}
-
+
return $result
}
@@ -1623,12 +1623,12 @@
upvar $vername portversion
upvar $varname portvariants
upvar $optname portoptions
-
+
set portname ""
set portversion ""
array unset portvariants
array unset portoptions
-
+
if { [moreargs] } {
# Look first for a potential portname
#
@@ -1641,7 +1641,7 @@
if {|[[:alpha:]_]+[\w\.]*=)} $token match]} {
advance
regexp {^([^@]+)(@.*)?} $token match portname remainder
-
+
# If the portname contains a /, then try to use it as a URL
if {[string match "*/*" $portname]} {
set url "file://$portname"
@@ -1662,7 +1662,7 @@
}
}
}
-
+
# Now parse the rest of the spec
parsePortSpec portversion portvariants portoptions $remainder
}
@@ -1680,25 +1680,25 @@
}
}
-
+
proc parsePortSpec { vername varname optname {remainder ""} } {
upvar $vername portversion
upvar $varname portvariants
upvar $optname portoptions
-
+
global global_options
-
+
set portversion ""
array unset portoptions
array set portoptions [array get global_options]
array unset portvariants
-
+
# Parse port version/variants/options
set opt $remainder
set adv 0
set consumed 0
for {set firstTime 1} {$opt ne "" || [moreargs]} {set firstTime 0} {
-
+
# Refresh opt as needed
if {$opt eq ""} {
if {$adv} advance
@@ -1706,14 +1706,14 @@
set adv 1
set consumed 0
}
-
+
# Version must be first, if it's there at all
if {$firstTime && [string match {@*} $opt]} {
# Parse the version
-
+
# Strip the @
set opt [string range $opt 1 end]
-
+
# Handle the version
set sepPos [string first "/" $opt]
if {$sepPos >= 0} {
@@ -1736,7 +1736,7 @@
set consumed 1
} else {
# Parse all other options
-
+
# Look first for a variable setting: VARNAME=VALUE
if {[regexp {^([[:alpha:]_]+[\w\.]*)=(.*)} $opt match key val] == 1} {
# It's a variable setting
@@ -2018,10 +2018,10 @@
# specified for the port (so we get e.g. dependencies right)
array unset merged_variations
array set merged_variations [array get variations]
- foreach { variation value } [array get global_variations] {
- if { ![info exists merged_variations($variation)] } {
- set merged_variations($variation) $value
- }
+ foreach { variation value } [array get global_variations] {
+ if { ![info exists merged_variations($variation)] } {
+ set merged_variations($variation) $value
+ }
}
if {![info exists options(subport)]} {
if {[info exists portinfo(name)]} {
@@ -2030,7 +2030,7 @@
set options(subport) $portname
}
}
-
+
if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
ui_debug "$::errorInfo"
break_softcontinue "Unable to open port: $result" 1 status
@@ -2122,13 +2122,13 @@
set options(ports_info_depends_run) yes
set options(ports_info_depends_test) yes
}
-
+
# Set up our field separators
set show_label 1
set field_sep "\n"
set subfield_sep ", "
set pretty_print 0
-
+
# For human-readable summary, which is the default with no options
if {[llength [array get options ports_info_*]] == 0} {
set pretty_print 1
@@ -2145,7 +2145,7 @@
set field_sep "\t"
set subfield_sep ","
}
-
+
# Figure out whether to show field name
set quiet [macports::ui_isset ports_quiet]
if {$quiet} {
@@ -2165,9 +2165,9 @@
set opts_todo {ports_info_heading
ports_info_replaced_by
ports_info_subports
- ports_info_variants
+ ports_info_variants
ports_info_skip_line
- ports_info_long_description ports_info_homepage
+ ports_info_long_description ports_info_homepage
ports_info_skip_line ports_info_depends_fetch
ports_info_depends_extract ports_info_depends_build
ports_info_depends_lib ports_info_depends_run
@@ -2201,7 +2201,7 @@
} else {
# Map from friendly name
set ropt [map_friendly_field_names $opt]
-
+
# If there's no such info, move on
if {![info exists portinfo($ropt)]} {
set inf ""
@@ -2221,7 +2221,7 @@
} elseif {$show_label} {
set label "$opt: "
}
-
+
# Format the data
if { $ropt eq "maintainers" } {
set inf [unobscure_maintainers $inf]
@@ -2257,7 +2257,7 @@
}
lappend inf "$varmodifier$v"
}
- } elseif {[string match "depend*" $ropt]
+ } elseif {[string match "depend*" $ropt]
&& ![macports::ui_isset ports_verbose]} {
set pi_deps $inf
set inf {}
@@ -2265,14 +2265,14 @@
lappend inf [lindex [split $d :] end]
}
}
- }
+ }
#End of special pretty-print formatting for certain fields
if {[info exists list_map($ropt)]} {
set field [join $inf $subfield_sep]
} else {
set field $inf
}
-
+
# Assemble the entry
if {$pretty_print} {
# The two special fields are considered headings and are
@@ -2320,7 +2320,7 @@
set separator "--\n"
}
}
-
+
return $status
}
@@ -2349,7 +2349,7 @@
ui_notice "Port $portname ${version}_${revision}${variants} is installed as an image in:"
puts $imagedir
}
-
+
return $status
}
@@ -2377,15 +2377,15 @@
array set portinfo [lindex $result 1]
set porturl $portinfo(porturl)
}
-
+
# Add any global_variations to the variations
# specified for the port
array unset merged_variations
array set merged_variations [array get variations]
- foreach { variation value } [array get global_variations] {
- if { ![info exists merged_variations($variation)] } {
- set merged_variations($variation) $value
- }
+ foreach { variation value } [array get global_variations] {
+ if { ![info exists merged_variations($variation)] } {
+ set merged_variations($variation) $value
+ }
}
if {![info exists options(subport)]} {
if {[info exists portinfo(name)]} {
@@ -2457,7 +2457,7 @@
}
}
registry::close_file_map
-
+
return 0
}
@@ -2489,7 +2489,7 @@
ui_msg "Skipping activate $portname (dry run)"
}
}
-
+
return $status
}
@@ -2526,7 +2526,7 @@
ui_msg "Skipping deactivate $portname (dry run)"
}
}
-
+
return $status
}
@@ -2548,7 +2548,7 @@
}
set group [lindex $portlist 0]
-
+
# If no command (--set, --show, --list, --summary) is specified *but*
# more than one argument is specified, default to the set command.
if {[llength $commands] < 1 && [llength $portlist] > 1} {
@@ -2710,7 +2710,7 @@
}
fatal "port selfupdate failed: $result"
}
-
+
if {$base_updated} {
# exit immediately if in batch/interactive mode
return -999
@@ -2741,7 +2741,7 @@
break_softcontinue "$result" 1 status
}
}
-
+
return $status
}
@@ -2757,7 +2757,7 @@
if {[prefix_unwritable]} {
return 1
}
- macports::reclaim_main
+ macports::reclaim_main
return 0
}
@@ -2780,7 +2780,7 @@
}
}
}
-
+
if {$status != 0 && $status != 2 && $status != 3} {
print_tickets_url
} elseif {$status == 0} {
@@ -2857,7 +2857,7 @@
set irevision [lindex $ilist $index 2]
set ivariants [lindex $ilist $index 3]
}
-
+
set deplist [registry::list_dependents $portname $iversion $irevision $ivariants]
if { [llength $deplist] > 0 } {
if {$action eq "rdependents"} {
@@ -2993,10 +2993,10 @@
# specified for the port, so we get dependencies right
array unset merged_variations
array set merged_variations [array get variations]
- foreach { variation value } [array get global_variations] {
- if { ![info exists merged_variations($variation)] } {
- set merged_variations($variation) $value
- }
+ foreach { variation value } [array get global_variations] {
+ if { ![info exists merged_variations($variation)] } {
+ set merged_variations($variation) $value
+ }
}
if {![info exists options(subport)]} {
if {[info exists portinfo(name)]} {
@@ -3071,7 +3071,7 @@
set depname [lindex [split $dep :] end]
if {![info exists seen($depname)]} {
set seen($depname) 1
-
+
# look up the dep
if {[catch {mportlookup $depname} result]} {
ui_debug "$::errorInfo"
@@ -3084,7 +3084,7 @@
array set portinfo [lindex $result 1]
set porturl $portinfo(porturl)
set options(subport) $portinfo(name)
-
+
# open the portfile if requested
if {!([info exists options(ports_${action}_index)] && $options(ports_${action}_index) eq "yes")} {
if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
@@ -3095,7 +3095,7 @@
array set portinfo [mportinfo $mport]
mportclose $mport
}
-
+
# get list of the dep's deps
set rdeplist {}
foreach type $deptypes {
@@ -3222,7 +3222,7 @@
set status 0
set restrictedList 0
set ilist {}
-
+
if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
set restrictedList 1
foreachport $portlist {
@@ -3322,7 +3322,7 @@
set num_outdated 0
if { [llength $ilist] > 0 } {
foreach i [portlist_sortint $ilist] {
-
+
# Get information about the installed port
set portname [lindex $i 0]
set installed_version [lindex $i 1]
@@ -3349,7 +3349,7 @@
}
array unset portinfo
array set portinfo [lindex $res 1]
-
+
# Get information about latest available version and revision
if {![info exists portinfo(version)]} {
ui_warn "$portname has no version field"
@@ -3357,15 +3357,15 @@
}
set latest_version $portinfo(version)
set latest_revision 0
- if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
+ if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
set latest_revision $portinfo(revision)
}
set latest_compound "${latest_version}_${latest_revision}"
set latest_epoch 0
- if {[info exists portinfo(epoch)]} {
+ if {[info exists portinfo(epoch)]} {
set latest_epoch $portinfo(epoch)
}
-
+
# Compare versions, first checking epoch, then version, then revision
set epoch_comp_result [expr {$installed_epoch - $latest_epoch}]
set comp_result [vercmp $installed_version $latest_version]
@@ -3389,10 +3389,10 @@
set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
}
}
-
+
# Report outdated (or, for verbose, predated) versions
if { $comp_result != 0 } {
-
+
# Form a relation between the versions
set flag ""
if { $comp_result > 0 } {
@@ -3401,10 +3401,10 @@
} else {
set relation "<"
}
-
+
# Emit information
if {$comp_result < 0 || [macports::ui_isset ports_verbose]} {
-
+
if {$num_outdated == 0} {
ui_notice "The following installed ports are outdated:"
}
@@ -3412,10 +3412,10 @@
puts [format "%-30s %-24s %1s" $portname "$installed_compound $relation $latest_compound [subst $reason]" $flag]
}
-
+
}
}
-
+
if {$num_outdated == 0} {
ui_notice "No installed ports are outdated."
}
@@ -3424,7 +3424,7 @@
} else {
ui_notice "No ports are installed."
}
-
+
return $status
}
@@ -3805,12 +3805,12 @@
proc action_list { action portlist opts } {
global private_options
set status 0
-
+
# Default to list all ports if no portnames are supplied
if { ![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
add_to_portlist portlist [list name "-all-"]
}
-
+
foreachport $portlist {
if {$portname eq "-all-"} {
if {[catch {set res [mportlistall]} result]} {
@@ -3841,7 +3841,7 @@
puts [format "%-30s @%-14s %s" $portinfo(name) $portinfo(version) $outdir]
}
}
-
+
return $status
}
@@ -3880,7 +3880,7 @@
global env boot_env current_portdir
array set local_options $opts
-
+
set status 0
if {[require_portlist portlist]} {
return 1
@@ -3889,7 +3889,7 @@
array unset portinfo
# If we have a url, use that, since it's most specific, otherwise try to map the portname to a url
if {$porturl eq ""} {
-
+
# Verify the portname, getting portinfo to map to a porturl
if {[catch {set res [mportlookup $portname]} result]} {
global errorInfo
@@ -3903,13 +3903,13 @@
set porturl $portinfo(porturl)
set portname $portinfo(name)
}
-
-
+
+
# Calculate portdir, porturl, and portfile from initial porturl
set portdir [file normalize [macports::getportdir $porturl]]
set porturl "file://${portdir}"; # Rebuild url so it's fully qualified
set portfile "${portdir}/Portfile"
-
+
# Now execute the specific action
if {[file readable $portfile]} {
switch -- $action {
@@ -3921,17 +3921,17 @@
}
close $f
}
-
+
edit {
# Edit the port's portfile with the user's editor
-
+
# Restore our entire environment from start time.
# We need it to evaluate the editor, and the editor
# may want stuff from it as well, like TERM.
array unset env_save; array set env_save [array get env]
array unset env *
array set env [array get boot_env]
-
+
# Find an editor to edit the portfile
set editor ""
set editor_var "ports_${action}_editor"
@@ -3945,17 +3945,17 @@
}
}
}
-
+
# Use a reasonable canned default if no editor specified or set in env
if { $editor eq "" } { set editor "/usr/bin/vi" }
-
+
# Invoke the editor
if {[catch {exec -ignorestderr >@stdout <@stdin {*}$editor $portfile} result]} {
global errorInfo
ui_debug "$errorInfo"
break_softcontinue "unable to invoke editor $editor: $result" 1 status
}
-
+
# Restore internal MacPorts environment
array unset env *
array set env [array get env_save]
@@ -4032,7 +4032,7 @@
break_softcontinue "Could not read $portfile" 1 status
}
}
-
+
return $status
}
@@ -4047,7 +4047,7 @@
ui_msg "port sync failed: $result"
set status 1
}
-
+
return $status
}
@@ -4136,14 +4136,14 @@
}
mportclose $workername
-
+
# Process any error that wasn't thrown and handled already
if {$result} {
print_tickets_url
break_softcontinue "Processing of port $portname failed" 1 status
}
}
-
+
if {$status == 0 && $action eq "install" && ![macports::global_option_isset ports_dryrun]} {
array set options $opts
if {![info exists options(ports_nodeps)] && ![info exists options(ports_install_no-rev-upgrade)] && ${macports::revupgrade_autorun}} {
@@ -4316,7 +4316,7 @@
# Returns an action proc, or a list of matching action procs, or the action passed in
proc find_action { action } {
global action_array
-
+
if { ! [info exists action_array($action)] } {
set guess [guess_action $action]
if { [info exists action_array($guess)] } {
@@ -4324,7 +4324,7 @@
}
return $guess
}
-
+
return $action
}
@@ -4332,7 +4332,7 @@
# If there's more than one match, return the next possibility
proc find_action_proc { action } {
global action_array
-
+
set action_proc ""
if { [info exists action_array($action)] } {
set action_proc [lindex $action_array($action) 0]
@@ -4342,18 +4342,18 @@
set action_proc [lindex $action_array($action) 0]
}
}
-
+
return $action_proc
}
proc get_action_proc { action } {
global action_array
-
+
set action_proc ""
if { [info exists action_array($action)] } {
set action_proc [lindex $action_array($action) 0]
}
-
+
return $action_proc
}
@@ -4464,10 +4464,10 @@
upvar $ui_options_name ui_options
upvar $global_options_name global_options
global cmdname cmd_opts_array
-
+
while {[moreargs]} {
set arg [lookahead]
-
+
if {[string index $arg 0] ne "-"} {
break
} elseif {[string index $arg 1] eq "-"} {
@@ -4528,7 +4528,7 @@
# Ignore errors while processing within a command
set ui_options(ports_processall) yes
}
- N {
+ N {
# Interactive mode is available or not
set ui_options(ports_noninteractive) yes
}
@@ -4623,12 +4623,12 @@
while {($action_status == 0 || [macports::ui_isset ports_processall]) && [moreargs]} {
set action [lookahead]
advance
-
+
# Handle command separator
if { $action == ";" } {
continue
}
-
+
# Handle a comment
if { [string index $action 0] == "#" } {
while { [moreargs] } { advance }
@@ -4646,11 +4646,11 @@
}
# Always start out processing an action in current_portdir
cd $current_portdir
-
+
# Reset global_options from base before each action, as we munge it just below...
array unset global_options
array set global_options $global_options_base
-
+
# Find an action to execute
set actions [find_action $action]
if {[llength $actions] == 1} {
@@ -4719,7 +4719,7 @@
}
}
}
-
+
# execute the action
set action_status [$action_proc $action $portlist [array get global_options]]
@@ -4734,14 +4734,14 @@
# semaphore to exit
if {$action_status == -999} break
}
-
+
return $action_status
}
-proc complete_portname { text state } {
+proc complete_portname { text state } {
global complete_choices complete_position
-
+
if {$state == 0} {
set complete_position 0
set complete_choices {}
@@ -4756,16 +4756,16 @@
lappend complete_choices $name
}
}
-
+
set word [lindex $complete_choices $complete_position]
incr complete_position
-
+
return $word
}
# return text action beginning with $text
-proc complete_action { text state } {
+proc complete_action { text state } {
global action_array complete_choices complete_position
if {$state == 0} {
@@ -4780,7 +4780,7 @@
}
# return all actions beginning with $text
-proc guess_action { text } {
+proc guess_action { text } {
global action_array
return [array names action_array "[string tolower $text]*"]
@@ -4801,14 +4801,14 @@
# Decide how to do completion based on where we are in the string
set prefix [string range $text 0 [expr {$start - 1}]]
-
+
# If only whitespace characters preceed us, or if the
# previous non-whitespace character was a ;, then we're
# an action (the first word of a command)
if { [regexp {(^\s*$)|(;\s*$)} $prefix] } {
return complete_action
}
-
+
# Otherwise, do completion on portname
return complete_portname
}
@@ -4816,7 +4816,7 @@
proc get_next_cmdline { in out use_readline prompt linename } {
upvar $linename line
-
+
set line ""
while { $line eq "" } {
@@ -4831,14 +4831,14 @@
if { $len < 0 } {
return -1
}
-
+
set line [string trim $line]
if { $use_readline && $line ne "" } {
rl_history add $line
}
}
-
+
return [llength $line]
}
@@ -4885,7 +4885,7 @@
# Process the command
set exit_status [process_cmd $line]
-
+
# Check for semaphore to exit
if {$exit_status == -999} {
set exit_status 0
@@ -5330,7 +5330,7 @@
# Create namespace for questions
namespace eval portclient::questions {
-
+
package require Tclx
##
# Function that handles printing of a timeout.
@@ -5361,7 +5361,7 @@
signal -restart error {TERM INT}
return $def
}
-
+
##
# Main function that displays numbered choices for a multiple choice question.
#
@@ -5374,7 +5374,7 @@
proc ui_choice {msg name ports} {
# Print the main message
puts $msg
-
+
# Print portname or port list suitably
set i 1
foreach port $ports {
@@ -5383,9 +5383,9 @@
incr i
}
}
-
+
##
- # Displays a question with 'yes' and 'no' as options.
+ # Displays a question with 'yes' and 'no' as options.
# Waits for user input indefinitely unless a timeout is specified.
# Shows the list of port passed to it without any numbers.
#
@@ -5408,10 +5408,10 @@
} else {
set default 1
}
-
+
puts -nonewline $msg
set leftmargin " "
-
+
# Print portname or port list suitably
if {[llength $ports] == 1} {
puts -nonewline " "
@@ -5420,17 +5420,17 @@
} else {
puts ""
foreach port $ports {
- puts -nonewline $leftmargin
+ puts -nonewline $leftmargin
puts [string map {@ " @"} $port]
}
}
-
+
# Check if timeout is set or not
if {$timeout > 0} {
# Run ui_timeout and skip the rest of the stuff here
- return [ui_timeout $default $timeout]
+ return [ui_timeout $default $timeout]
}
-
+
# Check for the default and print accordingly
if {$def == {y}} {
puts -nonewline "${question} \[Y/n\]: "
@@ -5439,8 +5439,8 @@
puts -nonewline "${question} \[y/N\]: "
flush stdout
}
-
- # User input (probably requires some input error checking code)
+
+ # User input (probably requires some input error checking code)
while 1 {
signal error {TERM INT}
if {[catch {set input [gets stdin]} err]} {
@@ -5458,7 +5458,7 @@
}
}
}
-
+
##
# Displays a question with a list of numbered choices and asks the user to enter a number to specify their choice.
# Waits for user input indefinitely.
@@ -5471,7 +5471,7 @@
# The port/list of ports for which the question is being asked.
proc ui_ask_singlechoice {msg name ports} {
ui_choice $msg $name $ports
-
+
# User Input (single input restriction)
while 1 {
puts -nonewline "Enter a number to select an option: "
@@ -5488,7 +5488,7 @@
}
}
}
-
+
##
# Displays a question with a list of numbered choices and asks the user to enter a space separated string of numbers to specify their choice.
# Waits for user input indefinitely.
@@ -5500,10 +5500,10 @@
# @param ports
# The list of ports for which the question is being asked.
proc ui_ask_multichoice {msg name ports} {
-
+
ui_choice $msg $name $ports
-
- # User Input (with Multiple input parsing)
+
+ # User Input (with Multiple input parsing)
while 1 {
puts -nonewline "Enter the numbers to select the options: "
flush stdout
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160314/7e536474/attachment-0001.html>
More information about the macports-changes
mailing list