<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[116448] trunk/base/src/port</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/116448">116448</a></dd>
<dt>Author</dt> <dd>cal@macports.org</dd>
<dt>Date</dt> <dd>2014-01-25 08:52:01 -0800 (Sat, 25 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>port: Tcl cleanup, from a patch by Gustaf Neumann
- braced expressions to allow for bytecode compilation
- removed numeric comparisons where not necessary
- removed unneeded calls to expr
- consolidated nested lindex invocations
- added brackets around if conditions</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbasesrcportporttcl">trunk/base/src/port/port.tcl</a></li>
<li><a href="#trunkbasesrcportportindextcl">trunk/base/src/port/portindex.tcl</a></li>
<li><a href="#trunkbasesrcportportmirrortcl">trunk/base/src/port/portmirror.tcl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbasesrcportporttcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port/port.tcl (116447 => 116448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port/port.tcl        2014-01-25 16:49:02 UTC (rev 116447)
+++ trunk/base/src/port/port.tcl        2014-01-25 16:52:01 UTC (rev 116448)
</span><span class="lines">@@ -169,22 +169,22 @@
</span><span class="cx"> }
</span><span class="cx"> switch -- $unit {
</span><span class="cx"> KiB {
</span><del>- set siz [expr $siz / 1024.0]
</del><ins>+ set siz [expr {$siz / 1024.0}]
</ins><span class="cx"> }
</span><span class="cx"> kB {
</span><del>- set siz [expr $siz / 1000.0]
</del><ins>+ set siz [expr {$siz / 1000.0}]
</ins><span class="cx"> }
</span><span class="cx"> MiB {
</span><del>- set siz [expr $siz / 1048576.0]
</del><ins>+ set siz [expr {$siz / 1048576.0}]
</ins><span class="cx"> }
</span><span class="cx"> MB {
</span><del>- set siz [expr $siz / 1000000.0]
</del><ins>+ set siz [expr {$siz / 1000000.0}]
</ins><span class="cx"> }
</span><span class="cx"> GiB {
</span><del>- set siz [expr $siz / 1073741824.0]
</del><ins>+ set siz [expr {$siz / 1073741824.0}]
</ins><span class="cx"> }
</span><span class="cx"> GB {
</span><del>- set siz [expr $siz / 1000000000.0]
</del><ins>+ set siz [expr {$siz / 1000000000.0}]
</ins><span class="cx"> }
</span><span class="cx"> B { }
</span><span class="cx"> default {
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx"> set unit "B"
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {[expr round($siz)] != $siz} {
</del><ins>+ if {[expr {round($siz)}] != $siz} {
</ins><span class="cx"> set siz [format {%.3f} $siz]
</span><span class="cx"> }
</span><span class="cx"> return "$siz $unit"
</span><span class="lines">@@ -250,16 +250,16 @@
</span><span class="cx"> set pos {}
</span><span class="cx"> set neg {}
</span><span class="cx"> foreach { key val } $variations {
</span><del>- if {$val == "+"} {
</del><ins>+ if {$val eq "+"} {
</ins><span class="cx"> lappend pos $key
</span><del>- } elseif {$val == "-"} {
</del><ins>+ } elseif {$val eq "-"} {
</ins><span class="cx"> lappend neg $key
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # If there is no version, we have nothing to do
</span><span class="cx"> set composite_version ""
</span><del>- if {$version != "" || $emptyVersionOkay} {
</del><ins>+ if {$version ne "" || $emptyVersionOkay} {
</ins><span class="cx"> set pos_str ""
</span><span class="cx"> set neg_str ""
</span><span class="cx">
</span><span class="lines">@@ -314,7 +314,7 @@
</span><span class="cx"> set ilist [registry::installed $portname $portversion]
</span><span class="cx"> if { [llength $ilist] > 1 } {
</span><span class="cx"> # set portname again since the one we were passed may not have had the correct case
</span><del>- set portname [lindex [lindex $ilist 0] 0]
</del><ins>+ set portname [lindex $ilist 0 0]
</ins><span class="cx"> ui_notice "The following versions of $portname are currently installed:"
</span><span class="cx"> foreach i [portlist_sortint $ilist] {
</span><span class="cx"> set iname [lindex $i 0]
</span><span class="lines">@@ -356,12 +356,12 @@
</span><span class="cx"> if {![info exists port(options)]} { set port(options) [array get global_options] }
</span><span class="cx">
</span><span class="cx"> # If neither portname nor url is specified, then default to the current port
</span><del>- if { $port(url) == "" && $port(name) == "" } {
</del><ins>+ if { $port(url) eq "" && $port(name) eq "" } {
</ins><span class="cx"> set url file://.
</span><span class="cx"> set portname [url_to_portname $url]
</span><span class="cx"> set port(url) $url
</span><span class="cx"> set port(name) $portname
</span><del>- if {$portname == ""} {
</del><ins>+ if {$portname eq ""} {
</ins><span class="cx"> ui_error "A default port name could not be supplied."
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -423,7 +423,7 @@
</span><span class="cx"> global private_options
</span><span class="cx"> upvar $nameportlist portlist
</span><span class="cx">
</span><del>- if {[llength $portlist] == 0 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
</del><ins>+ if {[llength $portlist] == 0 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</ins><span class="cx"> if {${is_upgrade} == "yes"} {
</span><span class="cx"> # $> port upgrade outdated
</span><span class="cx"> # Error: No ports matched the given expression
</span><span class="lines">@@ -642,7 +642,7 @@
</span><span class="cx"> set string [split $line " "]
</span><span class="cx"> if {$indentfirstline == 0} {
</span><span class="cx"> set newline ""
</span><del>- set maxlen [expr $maxlen - [string length $indent]]
</del><ins>+ set maxlen [expr {$maxlen - [string length $indent]}]
</ins><span class="cx"> } else {
</span><span class="cx"> set newline $indent
</span><span class="cx"> }
</span><span class="lines">@@ -657,7 +657,7 @@
</span><span class="cx"> # If indentfirstline is set to 0, reset maxlen to its
</span><span class="cx"> # original length after appending the first line to lines.
</span><span class="cx"> if {$first == 1 && $indentfirstline == 0} {
</span><del>- set maxlen [expr $maxlen + [string length $indent]]
</del><ins>+ set maxlen [expr {$maxlen + [string length $indent]}]
</ins><span class="cx"> }
</span><span class="cx"> set first 0
</span><span class="cx"> }
</span><span class="lines">@@ -678,7 +678,7 @@
</span><span class="cx"> # @param maxlen text width (0 defaults to current terminal width)
</span><span class="cx"> # @return wrapped string
</span><span class="cx"> proc wraplabel {label string maxlen {indent ""}} {
</span><del>- append label ": [string repeat " " [expr [string length $indent] - [string length "$label: "]]]"
</del><ins>+ append label ": [string repeat " " [expr {[string length $indent] - [string length "$label: "]}]]"
</ins><span class="cx"> return "$label[wrap $string $maxlen $indent 0]"
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -761,7 +761,7 @@
</span><span class="cx"> proc get_current_port {} {
</span><span class="cx"> set url file://.
</span><span class="cx"> set portname [url_to_portname $url]
</span><del>- if {$portname == ""} {
</del><ins>+ if {$portname eq ""} {
</ins><span class="cx"> ui_msg "To use the current port, you must be in a port's directory."
</span><span class="cx"> return [list]
</span><span class="cx"> }
</span><span class="lines">@@ -775,7 +775,7 @@
</span><span class="cx"> proc get_installed_ports { {ignore_active yes} {active yes} } {
</span><span class="cx"> set ilist {}
</span><span class="cx"> if { [catch {set ilist [registry::installed]} result] } {
</span><del>- if {$result != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</span><span class="lines">@@ -850,7 +850,7 @@
</span><span class="cx"> # Get the list of installed ports
</span><span class="cx"> set ilist {}
</span><span class="cx"> if { [catch {set ilist [registry::installed]} result] } {
</span><del>- if {$result != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</span><span class="lines">@@ -904,20 +904,20 @@
</span><span class="cx"> # Compare versions, first checking epoch, then version, then revision
</span><span class="cx"> set comp_result 0
</span><span class="cx"> if {$installed_version != $latest_version} {
</span><del>- set comp_result [expr $installed_epoch - $latest_epoch]
</del><ins>+ set comp_result [expr {$installed_epoch - $latest_epoch}]
</ins><span class="cx"> if { $comp_result == 0 } {
</span><span class="cx"> set comp_result [vercmp $installed_version $latest_version]
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if { $comp_result == 0 } {
</span><del>- set comp_result [expr $installed_revision - $latest_revision]
</del><ins>+ set comp_result [expr {$installed_revision - $latest_revision}]
</ins><span class="cx"> }
</span><span class="cx"> if {$comp_result == 0} {
</span><span class="cx"> set regref [registry::open_entry $portname $installed_version $installed_revision $installed_variants $installed_epoch]
</span><span class="cx"> set os_platform_installed [registry::property_retrieve $regref os_platform]
</span><span class="cx"> set os_major_installed [registry::property_retrieve $regref os_major]
</span><del>- if {$os_platform_installed != "" && $os_platform_installed != 0
- && $os_major_installed != "" && $os_major_installed != 0
</del><ins>+ if {$os_platform_installed ne "" && $os_platform_installed != 0
+ && $os_major_installed ne "" && $os_major_installed != 0
</ins><span class="cx"> && ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
</span><span class="cx"> set comp_result -1
</span><span class="cx"> }
</span><span class="lines">@@ -959,7 +959,7 @@
</span><span class="cx"> proc get_ports_with_prop {propname propval} {
</span><span class="cx"> set ilist {}
</span><span class="cx"> if { [catch {set ilist [registry::installed]} result] } {
</span><del>- if {$result != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</span><span class="lines">@@ -994,7 +994,7 @@
</span><span class="cx"> proc get_leaves_ports {} {
</span><span class="cx"> set ilist {}
</span><span class="cx"> if { [catch {set ilist [registry::installed]} result] } {
</span><del>- if {$result != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</span><span class="lines">@@ -1004,7 +1004,7 @@
</span><span class="cx"> set results {}
</span><span class="cx"> foreach i $ilist {
</span><span class="cx"> set iname [lindex $i 0]
</span><del>- if {[registry::list_dependents $iname] == ""} {
</del><ins>+ if {[registry::list_dependents $iname] eq ""} {
</ins><span class="cx"> add_to_portlist results [list name $iname version "[lindex $i 1]_[lindex $i 2]" variants [split_variants [lindex $i 3]]]
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1408,7 +1408,7 @@
</span><span class="cx"> # Break up the token, because older Tcl switch doesn't support -matchvar
</span><span class="cx"> regexp {^(\w+):(.*)} $token matchvar selector portname
</span><span class="cx">
</span><del>- set recursive [string equal $selector rdependentof]
</del><ins>+ set recursive [string equal $selector "rdependentof"]
</ins><span class="cx"> add_multiple_ports reslist [get_dependent_ports $portname $recursive]
</span><span class="cx">
</span><span class="cx"> set el 1
</span><span class="lines">@@ -1421,7 +1421,7 @@
</span><span class="cx"> # Break up the token, because older Tcl switch doesn't support -matchvar
</span><span class="cx"> regexp {^(\w+):(.*)} $token matchvar selector portname
</span><span class="cx">
</span><del>- set recursive [string equal $selector rdepof]
</del><ins>+ set recursive [string equal $selector "rdepof"]
</ins><span class="cx"> add_multiple_ports reslist [get_dep_ports $portname $recursive]
</span><span class="cx">
</span><span class="cx"> set el 1
</span><span class="lines">@@ -1446,7 +1446,7 @@
</span><span class="cx"> ^\\w+:.+ { # Handle a url by trying to open it as a port and mapping the name
</span><span class="cx"> advance
</span><span class="cx"> set name [url_to_portname $token]
</span><del>- if {$name != ""} {
</del><ins>+ if {$name ne ""} {
</ins><span class="cx"> parsePortSpec version requested_variants options
</span><span class="cx"> add_to_portlist reslist [list url $token \
</span><span class="cx"> name $name \
</span><span class="lines">@@ -1487,7 +1487,7 @@
</span><span class="cx"> parsePortSpec version variants options $remainder
</span><span class="cx">
</span><span class="cx"> array unset overrides
</span><del>- if {$version != ""} { set overrides(version) $version }
</del><ins>+ if {$version ne ""} { set overrides(version) $version }
</ins><span class="cx"> if {[array size variants]} {
</span><span class="cx"> # we always record the requested variants separately,
</span><span class="cx"> # but requested ones always override existing ones
</span><span class="lines">@@ -1645,7 +1645,7 @@
</span><span class="cx"> if {[string match "*/*" $portname]} {
</span><span class="cx"> set url "file://$portname"
</span><span class="cx"> set name [url_to_portname $url 1]
</span><del>- if { $name != "" } {
</del><ins>+ if { $name ne "" } {
</ins><span class="cx"> # We mapped the url to valid port
</span><span class="cx"> set porturl $url
</span><span class="cx"> set portname $name
</span><span class="lines">@@ -1696,10 +1696,10 @@
</span><span class="cx"> set opt $remainder
</span><span class="cx"> set adv 0
</span><span class="cx"> set consumed 0
</span><del>- for {set firstTime 1} {$opt != "" || [moreargs]} {set firstTime 0} {
</del><ins>+ for {set firstTime 1} {$opt ne "" || [moreargs]} {set firstTime 0} {
</ins><span class="cx">
</span><span class="cx"> # Refresh opt as needed
</span><del>- if {$opt == ""} {
</del><ins>+ if {$opt eq ""} {
</ins><span class="cx"> if {$adv} advance
</span><span class="cx"> set opt [lookahead]
</span><span class="cx"> set adv 1
</span><span class="lines">@@ -1717,14 +1717,14 @@
</span><span class="cx"> set sepPos [string first "/" $opt]
</span><span class="cx"> if {$sepPos >= 0} {
</span><span class="cx"> # Version terminated by "/" to disambiguate -variant from part of version
</span><del>- set portversion [string range $opt 0 [expr $sepPos-1]]
- set opt [string range $opt [expr $sepPos+1] end]
</del><ins>+ set portversion [string range $opt 0 $sepPos-1]
+ set opt [string range $opt $sepPos+1 end]
</ins><span class="cx"> } else {
</span><span class="cx"> # Version terminated by "+", or else is complete
</span><span class="cx"> set sepPos [string first "+" $opt]
</span><span class="cx"> if {$sepPos >= 0} {
</span><span class="cx"> # Version terminated by "+"
</span><del>- set portversion [string range $opt 0 [expr $sepPos-1]]
</del><ins>+ set portversion [string range $opt 0 $sepPos-1]
</ins><span class="cx"> set opt [string range $opt $sepPos end]
</span><span class="cx"> } else {
</span><span class="cx"> # Unterminated version
</span><span class="lines">@@ -1745,7 +1745,7 @@
</span><span class="cx"> } elseif {[regexp {^([-+])([[:alpha:]_]+[\w\.]*)} $opt match sign variant] == 1} {
</span><span class="cx"> # It's a variant
</span><span class="cx"> set portvariants($variant) $sign
</span><del>- set opt [string range $opt [expr [string length $variant]+1] end]
</del><ins>+ set opt [string range $opt [string length $variant]+1 end]
</ins><span class="cx"> set consumed 1
</span><span class="cx"> } else {
</span><span class="cx"> # Not an option we recognize, so break from port option processing
</span><span class="lines">@@ -1793,7 +1793,7 @@
</span><span class="cx">
</span><span class="cx"> set ret "Usage: "
</span><span class="cx"> set len [string length $action]
</span><del>- append ret [wrap "$action$cmds$args" 0 [string repeat " " [expr 8 + $len]] 0]
</del><ins>+ append ret [wrap "$action$cmds$args" 0 [string repeat " " [expr {8 + $len}]] 0]
</ins><span class="cx"> append ret "\n"
</span><span class="cx">
</span><span class="cx"> return $ret
</span><span class="lines">@@ -1889,8 +1889,8 @@
</span><span class="cx"> set portdir [file split [macports::getportdir $porturl]]
</span><span class="cx"> set lsize [llength $portdir]
</span><span class="cx"> set portdir \
</span><del>- [file join [lindex $portdir [expr $lsize - 2]] \
- [lindex $portdir [expr $lsize - 1]]]
</del><ins>+ [file join [lindex $portdir $lsize-2] \
+ [lindex $portdir $lsize-1]]
</ins><span class="cx"> if {[catch {mportsearch $portdir no exact portdir} result]} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="cx"> break_softcontinue "Portdir $portdir not found" 1 status
</span><span class="lines">@@ -1966,7 +1966,7 @@
</span><span class="cx"> array unset portinfo
</span><span class="cx"> # If we have a url, use that, since it's most specific
</span><span class="cx"> # otherwise try to map the portname to a url
</span><del>- if {$porturl == "" || $index_only} {
</del><ins>+ if {$porturl eq "" || $index_only} {
</ins><span class="cx"> # Verify the portname, getting portinfo to map to a porturl
</span><span class="cx"> if {[catch {mportlookup $portname} result]} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="lines">@@ -2074,7 +2074,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Interpret a convenient field abbreviation
</span><del>- if {[info exists options(ports_info_depends)] && $options(ports_info_depends) == "yes"} {
</del><ins>+ if {[info exists options(ports_info_depends)] && $options(ports_info_depends) eq "yes"} {
</ins><span class="cx"> array unset options ports_info_depends
</span><span class="cx"> set options(ports_info_depends_fetch) yes
</span><span class="cx"> set options(ports_info_depends_extract) yes
</span><span class="lines">@@ -2226,7 +2226,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> #End of special pretty-print formatting for certain fields
</span><del>- if [info exists list_map($ropt)] {
</del><ins>+ if {[info exists list_map($ropt)]} {
</ins><span class="cx"> set field [join $inf $subfield_sep]
</span><span class="cx"> } else {
</span><span class="cx"> set field $inf
</span><span class="lines">@@ -2244,10 +2244,10 @@
</span><span class="cx"> }
</span><span class="cx"> lappend fields_tried $label
</span><span class="cx"> if {$pretty_print} {
</span><del>- if {![string length $field]} {
</del><ins>+ if {$field eq ""} {
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><del>- if {![string length $label]} {
</del><ins>+ if {$label eq ""} {
</ins><span class="cx"> set wrap_len 0
</span><span class="cx"> if {[info exists pretty_wrap($ropt)]} {
</span><span class="cx"> set wrap_len $pretty_wrap($ropt)
</span><span class="lines">@@ -2401,7 +2401,7 @@
</span><span class="cx"> foreach filename $portlist {
</span><span class="cx"> set file [file normalize $filename]
</span><span class="cx"> if {[file exists $file] || ![catch {file type $file}]} {
</span><del>- if {![file isdirectory $file] || [file type $file] == "link"} {
</del><ins>+ if {![file isdirectory $file] || [file type $file] eq "link"} {
</ins><span class="cx"> set port [registry::file_registered $file]
</span><span class="cx"> if { $port != 0 } {
</span><span class="cx"> puts "$file is provided by: $port"
</span><span class="lines">@@ -2434,7 +2434,7 @@
</span><span class="cx">
</span><span class="cx"> set i [lindex $ilist 0]
</span><span class="cx"> set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
</span><del>- if {[$regref installtype] == "image" && [registry::run_target $regref activate [array get options]]} {
</del><ins>+ if {[$regref installtype] eq "image" && [registry::run_target $regref activate [array get options]]} {
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2468,9 +2468,9 @@
</span><span class="cx"> set iversion [lindex $i 1]
</span><span class="cx"> set irevision [lindex $i 2]
</span><span class="cx"> set ivariants [lindex $i 3]
</span><del>- if {$composite_version == "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
</del><ins>+ if {$composite_version eq "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
</ins><span class="cx"> set regref [registry::entry open $portname $iversion $irevision $ivariants [lindex $i 5]]
</span><del>- if {[$regref installtype] == "image" && [registry::run_target $regref deactivate [array get options]]} {
</del><ins>+ if {[$regref installtype] eq "image" && [registry::run_target $regref deactivate [array get options]]} {
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2629,7 +2629,7 @@
</span><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx"> # set or unset?
</span><del>- set val [string equal $action setrequested]
</del><ins>+ set val [string equal $action "setrequested"]
</ins><span class="cx"> foreachport $portlist {
</span><span class="cx"> set composite_version [composite_version $portversion [array get variations]]
</span><span class="cx"> if {![catch {set ilist [registry::installed $portname $composite_version]} result]} {
</span><span class="lines">@@ -2690,7 +2690,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> proc action_version { action portlist opts } {
</span><del>- if ![macports::ui_isset ports_quiet] {
</del><ins>+ if {![macports::ui_isset ports_quiet]} {
</ins><span class="cx"> puts -nonewline "Version: "
</span><span class="cx"> }
</span><span class="cx"> puts [macports::version]
</span><span class="lines">@@ -2699,7 +2699,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> proc action_platform { action portlist opts } {
</span><del>- if ![macports::ui_isset ports_quiet] {
</del><ins>+ if {![macports::ui_isset ports_quiet]} {
</ins><span class="cx"> puts -nonewline "Platform: "
</span><span class="cx"> }
</span><span class="cx"> puts "${macports::os_platform} ${macports::os_major} ${macports::os_arch}"
</span><span class="lines">@@ -2736,15 +2736,15 @@
</span><span class="cx"> set index 0
</span><span class="cx"> }
</span><span class="cx"> # set portname again since the one we were passed may not have had the correct case
</span><del>- set portname [lindex [lindex $ilist $index] 0]
- set iversion [lindex [lindex $ilist $index] 1]
- set irevision [lindex [lindex $ilist $index] 2]
- set ivariants [lindex [lindex $ilist $index] 3]
</del><ins>+ set portname [lindex $ilist $index 0]
+ set iversion [lindex $ilist $index 1]
+ set irevision [lindex $ilist $index 2]
+ set ivariants [lindex $ilist $index 3]
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> set deplist [registry::list_dependents $portname $iversion $irevision $ivariants]
</span><span class="cx"> if { [llength $deplist] > 0 } {
</span><del>- if {$action == "rdependents"} {
</del><ins>+ if {$action eq "rdependents"} {
</ins><span class="cx"> set toplist $deplist
</span><span class="cx"> while 1 {
</span><span class="cx"> set newlist {}
</span><span class="lines">@@ -2854,8 +2854,8 @@
</span><span class="cx"> set portdir [file split [macports::getportdir $porturl]]
</span><span class="cx"> set lsize [llength $portdir]
</span><span class="cx"> set portdir \
</span><del>- [file join [lindex $portdir [expr $lsize - 2]] \
- [lindex $portdir [expr $lsize - 1]]]
</del><ins>+ [file join [lindex $portdir $lsize-2] \
+ [lindex $portdir $lsize-1]]
</ins><span class="cx"> if {[catch {mportsearch $portdir no exact portdir} result]} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="cx"> break_softcontinue "Portdir $portdir not found" 1 status
</span><span class="lines">@@ -2909,7 +2909,7 @@
</span><span class="cx"> # get list of direct deps
</span><span class="cx"> foreach type $deptypes {
</span><span class="cx"> if {[info exists portinfo($type)]} {
</span><del>- if {$action == "rdeps" || [macports::ui_isset ports_verbose]} {
</del><ins>+ if {$action eq "rdeps" || [macports::ui_isset ports_verbose]} {
</ins><span class="cx"> foreach dep $portinfo($type) {
</span><span class="cx"> lappend deplist $dep
</span><span class="cx"> }
</span><span class="lines">@@ -2918,7 +2918,7 @@
</span><span class="cx"> lappend deplist [lindex [split $dep :] end]
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {$action == "deps"} {
</del><ins>+ if {$action eq "deps"} {
</ins><span class="cx"> set label "$labeldict($type) Dependencies"
</span><span class="cx"> lappend deps_output [wraplabel $label [join $deplist ", "] 0 [string repeat " " 22]]
</span><span class="cx"> incr ndeps [llength $deplist]
</span><span class="lines">@@ -2936,7 +2936,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> puts -nonewline $separator
</span><del>- if {$action == "deps"} {
</del><ins>+ if {$action eq "deps"} {
</ins><span class="cx"> if {$ndeps == 0} {
</span><span class="cx"> ui_notice "$portname @${version}_${revision}${variants} has no dependencies."
</span><span class="cx"> } else {
</span><span class="lines">@@ -3107,7 +3107,7 @@
</span><span class="cx"> set restrictedList 0
</span><span class="cx"> set ilist {}
</span><span class="cx">
</span><del>- if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
</del><ins>+ if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</ins><span class="cx"> set restrictedList 1
</span><span class="cx"> foreachport $portlist {
</span><span class="cx"> set composite_version [composite_version $portversion [array get variations]]
</span><span class="lines">@@ -3121,7 +3121,7 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> if { [catch {set ilist [registry::installed]} result] } {
</span><del>- if {$result != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> ui_error "port installed failed: $result"
</span><span class="lines">@@ -3148,10 +3148,10 @@
</span><span class="cx"> set os_platform [registry::property_retrieve $regref os_platform]
</span><span class="cx"> set os_major [registry::property_retrieve $regref os_major]
</span><span class="cx"> set archs [registry::property_retrieve $regref archs]
</span><del>- if {$os_platform != 0 && $os_platform != "" && $os_major != 0 && $os_major != ""} {
</del><ins>+ if {$os_platform != 0 && $os_platform ne "" && $os_major != 0 && $os_major ne ""} {
</ins><span class="cx"> append extra " platform='$os_platform $os_major'"
</span><span class="cx"> }
</span><del>- if {$archs != 0 && $archs != ""} {
</del><ins>+ if {$archs != 0 && $archs ne ""} {
</ins><span class="cx"> append extra " archs='$archs'"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3178,7 +3178,7 @@
</span><span class="cx"> # If port names were supplied, limit ourselves to those ports, else check all installed ports
</span><span class="cx"> set ilist {}
</span><span class="cx"> set restrictedList 0
</span><del>- if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
</del><ins>+ if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</ins><span class="cx"> set restrictedList 1
</span><span class="cx"> foreach portspec $portlist {
</span><span class="cx"> array set port $portspec
</span><span class="lines">@@ -3194,7 +3194,7 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> if { [catch {set ilist [registry::installed]} result] } {
</span><del>- if {$result != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> ui_error "port installed failed: $result"
</span><span class="lines">@@ -3251,10 +3251,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Compare versions, first checking epoch, then version, then revision
</span><del>- set epoch_comp_result [expr $installed_epoch - $latest_epoch]
</del><ins>+ set epoch_comp_result [expr {$installed_epoch - $latest_epoch}]
</ins><span class="cx"> set comp_result [vercmp $installed_version $latest_version]
</span><span class="cx"> if { $comp_result == 0 } {
</span><del>- set comp_result [expr $installed_revision - $latest_revision]
</del><ins>+ set comp_result [expr {$installed_revision - $latest_revision}]
</ins><span class="cx"> }
</span><span class="cx"> set reason ""
</span><span class="cx"> if {$epoch_comp_result != 0 && $installed_version != $latest_version} {
</span><span class="lines">@@ -3266,8 +3266,8 @@
</span><span class="cx"> set regref [registry::open_entry $portname $installed_version $installed_revision [lindex $i 3] $installed_epoch]
</span><span class="cx"> set os_platform_installed [registry::property_retrieve $regref os_platform]
</span><span class="cx"> set os_major_installed [registry::property_retrieve $regref os_major]
</span><del>- if {$os_platform_installed != "" && $os_platform_installed != 0
- && $os_major_installed != "" && $os_major_installed != 0
</del><ins>+ if {$os_platform_installed ne "" && $os_platform_installed != 0
+ && $os_major_installed ne "" && $os_major_installed != 0
</ins><span class="cx"> && ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
</span><span class="cx"> set comp_result -1
</span><span class="cx"> set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
</span><span class="lines">@@ -3331,7 +3331,7 @@
</span><span class="cx"> foreachport $portlist {
</span><span class="cx"> if { ![catch {set ilist [registry::installed $portname]} result] } {
</span><span class="cx"> # set portname again since the one we were passed may not have had the correct case
</span><del>- set portname [lindex [lindex $ilist 0] 0]
</del><ins>+ set portname [lindex $ilist 0 0]
</ins><span class="cx"> }
</span><span class="cx"> set files [registry::port_registered $portname]
</span><span class="cx"> if { $files != 0 } {
</span><span class="lines">@@ -3354,17 +3354,17 @@
</span><span class="cx">
</span><span class="cx"> # expand abbreviations of size units
</span><span class="cx"> proc complete_size_units {units} {
</span><del>- if {$units == "K" || $units == "Ki"} {
</del><ins>+ if {$units eq "K" || $units eq "Ki"} {
</ins><span class="cx"> return "KiB"
</span><del>- } elseif {$units == "k"} {
</del><ins>+ } elseif {$units eq "k"} {
</ins><span class="cx"> return "kB"
</span><del>- } elseif {$units == "Mi"} {
</del><ins>+ } elseif {$units eq "Mi"} {
</ins><span class="cx"> return "MiB"
</span><del>- } elseif {$units == "M"} {
</del><ins>+ } elseif {$units eq "M"} {
</ins><span class="cx"> return "MB"
</span><del>- } elseif {$units == "Gi"} {
</del><ins>+ } elseif {$units eq "Gi"} {
</ins><span class="cx"> return "GiB"
</span><del>- } elseif {$units == "G"} {
</del><ins>+ } elseif {$units eq "G"} {
</ins><span class="cx"> return "GB"
</span><span class="cx"> } else {
</span><span class="cx"> return $units
</span><span class="lines">@@ -3388,17 +3388,17 @@
</span><span class="cx"> if { [llength $files] > 0 } {
</span><span class="cx"> foreach file $files {
</span><span class="cx"> catch {
</span><del>- set space [expr $space + [file size $file] ]
</del><ins>+ set space [expr {$space + [file size $file]}]
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {![info exists options(ports_space_total)] || $options(ports_space_total) != "yes"} {
</del><ins>+ if {![info exists options(ports_space_total)] || $options(ports_space_total) ne "yes"} {
</ins><span class="cx"> set msg "[bytesize $space $units] $portname"
</span><span class="cx"> if { $portversion != {} } {
</span><span class="cx"> append msg " @$portversion"
</span><span class="cx"> }
</span><span class="cx"> puts $msg
</span><span class="cx"> }
</span><del>- set spaceall [expr $space + $spaceall]
</del><ins>+ set spaceall [expr {$space + $spaceall}]
</ins><span class="cx"> } else {
</span><span class="cx"> puts stderr "Port $portname does not contain any file or is not active."
</span><span class="cx"> }
</span><span class="lines">@@ -3406,7 +3406,7 @@
</span><span class="cx"> puts stderr "Port $portname is not installed."
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {[llength $portlist] > 1 || ([info exists options(ports_space_total)] && $options(ports_space_total) == "yes")} {
</del><ins>+ if {[llength $portlist] > 1 || ([info exists options(ports_space_total)] && $options(ports_space_total) eq "yes")} {
</ins><span class="cx"> puts "[bytesize $spaceall $units] total"
</span><span class="cx"> }
</span><span class="cx"> return 0
</span><span class="lines">@@ -3535,7 +3535,7 @@
</span><span class="cx"> proc action_search { action portlist opts } {
</span><span class="cx"> global private_options global_options
</span><span class="cx"> set status 0
</span><del>- if {![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) == "yes"} {
</del><ins>+ if {![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
</ins><span class="cx"> ui_error "You must specify a search pattern"
</span><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="lines">@@ -3543,7 +3543,7 @@
</span><span class="cx"> # Copy global options as we are going to modify the array
</span><span class="cx"> array set options [array get global_options]
</span><span class="cx">
</span><del>- if {[info exists options(ports_search_depends)] && $options(ports_search_depends) == "yes"} {
</del><ins>+ if {[info exists options(ports_search_depends)] && $options(ports_search_depends) eq "yes"} {
</ins><span class="cx"> array unset options ports_search_depends
</span><span class="cx"> set options(ports_search_depends_fetch) yes
</span><span class="cx"> set options(ports_search_depends_extract) yes
</span><span class="lines">@@ -3560,7 +3560,7 @@
</span><span class="cx"> foreach { option } [array names options ports_search_*] {
</span><span class="cx"> set opt [string range $option 13 end]
</span><span class="cx">
</span><del>- if { $options($option) != "yes" } {
</del><ins>+ if { $options($option) ne "yes" } {
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><span class="cx"> switch -- $opt {
</span><span class="lines">@@ -3596,7 +3596,7 @@
</span><span class="cx">
</span><span class="cx"> set searchstring $portname
</span><span class="cx"> set matchstyle $filter_matchstyle
</span><del>- if {$matchstyle == "none"} {
</del><ins>+ if {$matchstyle eq "none"} {
</ins><span class="cx"> # Guess if the given string was a glob expression, if not do a substring search
</span><span class="cx"> if {[string first "*" $portname] == -1 && [string first "?" $portname] == -1} {
</span><span class="cx"> set searchstring "*$portname*"
</span><span class="lines">@@ -3647,7 +3647,7 @@
</span><span class="cx"> puts $portinfo(name)
</span><span class="cx"> } else {
</span><span class="cx"> if {[info exists options(ports_search_line)]
</span><del>- && $options(ports_search_line) == "yes"} {
</del><ins>+ && $options(ports_search_line) eq "yes"} {
</ins><span class="cx"> # check for ports without category, e.g. replaced_by stubs
</span><span class="cx"> if {[info exists portinfo(categories)]} {
</span><span class="cx"> puts "$portinfo(name)\t$portinfo(version)\t$portinfo(categories)\t$portinfo(description)"
</span><span class="lines">@@ -3677,7 +3677,7 @@
</span><span class="cx"> ui_notice "No match for $portname found"
</span><span class="cx"> } elseif {[llength $res] > 1} {
</span><span class="cx"> if {(![info exists global_options(ports_search_line)]
</span><del>- || $global_options(ports_search_line) != "yes")} {
</del><ins>+ || $global_options(ports_search_line) ne "yes")} {
</ins><span class="cx"> ui_notice "\nFound [llength $res] ports."
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3697,12 +3697,12 @@
</span><span class="cx"> set status 0
</span><span class="cx">
</span><span class="cx"> # Default to list all ports if no portnames are supplied
</span><del>- if { ![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) == "yes"} {
</del><ins>+ if { ![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
</ins><span class="cx"> add_to_portlist portlist [list name "-all-"]
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreachport $portlist {
</span><del>- if {$portname == "-all-"} {
</del><ins>+ if {$portname eq "-all-"} {
</ins><span class="cx"> if {[catch {set res [mportlistall]} result]} {
</span><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="lines">@@ -3740,13 +3740,13 @@
</span><span class="cx"> if {![macports::ui_isset ports_quiet]} {
</span><span class="cx"> set opts {}
</span><span class="cx"> foreach { key value } [array get options] {
</span><del>- if ![info exists global_options($key)] {
</del><ins>+ if {![info exists global_options($key)]} {
</ins><span class="cx"> lappend opts "$key=$value"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> set composite_version [composite_version $portversion [array get variations] 1]
</span><del>- if { $composite_version != "" } {
</del><ins>+ if { $composite_version ne "" } {
</ins><span class="cx"> set ver_field "@$composite_version"
</span><span class="cx"> } else {
</span><span class="cx"> set ver_field ""
</span><span class="lines">@@ -3774,7 +3774,7 @@
</span><span class="cx"> foreachport $portlist {
</span><span class="cx"> array unset portinfo
</span><span class="cx"> # If we have a url, use that, since it's most specific, otherwise try to map the portname to a url
</span><del>- if {$porturl == ""} {
</del><ins>+ if {$porturl eq ""} {
</ins><span class="cx">
</span><span class="cx"> # Verify the portname, getting portinfo to map to a porturl
</span><span class="cx"> if {[catch {set res [mportlookup $portname]} result]} {
</span><span class="lines">@@ -3836,7 +3836,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Use a reasonable canned default if no editor specified or set in env
</span><del>- if { $editor == "" } { set editor "/usr/bin/vi" }
</del><ins>+ if { $editor eq "" } { set editor "/usr/bin/vi" }
</ins><span class="cx">
</span><span class="cx"> # Invoke the editor
</span><span class="cx"> if {[catch {eval exec >@stdout <@stdin 2>@stderr $editor {$portfile}} result]} {
</span><span class="lines">@@ -3900,7 +3900,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # If not available, get the homepage for the port by opening the Portfile
</span><del>- if {$homepage == "" && ![catch {set ctx [mportopen $porturl]} result]} {
</del><ins>+ if {$homepage eq "" && ![catch {set ctx [mportopen $porturl]} result]} {
</ins><span class="cx"> array set portinfo [mportinfo $ctx]
</span><span class="cx"> if {[info exists portinfo(homepage)]} {
</span><span class="cx"> set homepage $portinfo(homepage)
</span><span class="lines">@@ -3909,7 +3909,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Try to open a browser to the homepage for the given port
</span><del>- if { $homepage != "" } {
</del><ins>+ if { $homepage ne "" } {
</ins><span class="cx"> if {[catch {system "${macports::autoconf::open_path} '$homepage'"} result]} {
</span><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="lines">@@ -3950,14 +3950,14 @@
</span><span class="cx"> if {[require_portlist portlist]} {
</span><span class="cx"> return 1
</span><span class="cx"> }
</span><del>- if {($action == "install" || $action == "archive") && [prefix_unwritable] && ![macports::global_option_isset ports_dryrun]} {
</del><ins>+ if {($action eq "install" || $action eq "archive") && [prefix_unwritable] && ![macports::global_option_isset ports_dryrun]} {
</ins><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx"> foreachport $portlist {
</span><span class="cx"> array unset portinfo
</span><span class="cx"> # If we have a url, use that, since it's most specific
</span><span class="cx"> # otherwise try to map the portname to a url
</span><del>- if {$porturl == ""} {
</del><ins>+ if {$porturl eq ""} {
</ins><span class="cx"> # Verify the portname, getting portinfo to map to a porturl
</span><span class="cx"> if {[catch {set res [mportlookup $portname]} result]} {
</span><span class="cx"> global errorInfo
</span><span class="lines">@@ -3978,7 +3978,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # use existing variants iff none were explicitly requested
</span><del>- if {[array get requested_variations] == "" && [array get variations] != ""} {
</del><ins>+ if {[array get requested_variations] eq "" && [array get variations] ne ""} {
</ins><span class="cx"> array unset requested_variations
</span><span class="cx"> array set requested_variations [array get variations]
</span><span class="cx"> }
</span><span class="lines">@@ -3997,13 +3997,13 @@
</span><span class="cx"> set options(ports_version_glob) $portversion
</span><span class="cx"> }
</span><span class="cx"> # if installing, mark the port as explicitly requested
</span><del>- if {$action == "install"} {
</del><ins>+ if {$action eq "install"} {
</ins><span class="cx"> if {![info exists options(ports_install_unrequested)]} {
</span><span class="cx"> set options(ports_requested) 1
</span><span class="cx"> }
</span><span class="cx"> # we actually activate as well
</span><span class="cx"> set target activate
</span><del>- } elseif {$action == "archive"} {
</del><ins>+ } elseif {$action eq "archive"} {
</ins><span class="cx"> set target install
</span><span class="cx"> } else {
</span><span class="cx"> set target $action
</span><span class="lines">@@ -4036,7 +4036,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$status == 0 && $action == "install" && ![macports::global_option_isset ports_dryrun]} {
</del><ins>+ if {$status == 0 && $action eq "install" && ![macports::global_option_isset ports_dryrun]} {
</ins><span class="cx"> array set options $opts
</span><span class="cx"> if {![info exists options(ports_nodeps)] && ![info exists options(ports_install_no-rev-upgrade)] && ${macports::revupgrade_autorun}} {
</span><span class="cx"> set status [action_revupgrade $action $portlist $opts]
</span><span class="lines">@@ -4343,9 +4343,9 @@
</span><span class="cx"> while {[moreargs]} {
</span><span class="cx"> set arg [lookahead]
</span><span class="cx">
</span><del>- if {[string index $arg 0] != "-"} {
</del><ins>+ if {[string index $arg 0] ne "-"} {
</ins><span class="cx"> break
</span><del>- } elseif {[string index $arg 1] == "-"} {
</del><ins>+ } elseif {[string index $arg 1] eq "-"} {
</ins><span class="cx"> # Process long arguments
</span><span class="cx"> switch -- $arg {
</span><span class="cx"> -- { # This is the options terminator; do no further option processing
</span><span class="lines">@@ -4363,8 +4363,8 @@
</span><span class="cx"> }
</span><span class="cx"> return -code error "\"port ${action} --${key}\" is ambiguous: \n port ${action} [join $errlst "\n port ${action} "]"
</span><span class="cx"> }
</span><del>- set key [lindex [lindex $kopts 0] 0]
- set kargc [lindex [lindex $kopts 0] 1]
</del><ins>+ set key [lindex $kopts 0 0]
+ set kargc [lindex $kopts 0 1]
</ins><span class="cx"> if {$kargc == 0} {
</span><span class="cx"> set global_options(ports_${action}_${key}) yes
</span><span class="cx"> } else {
</span><span class="lines">@@ -4372,10 +4372,10 @@
</span><span class="cx"> while {[moreargs] && $kargc > 0} {
</span><span class="cx"> advance
</span><span class="cx"> lappend args [lookahead]
</span><del>- set kargc [expr $kargc - 1]
</del><ins>+ set kargc [expr {$kargc - 1}]
</ins><span class="cx"> }
</span><span class="cx"> if {$kargc > 0} {
</span><del>- return -code error "--${key} expects [expr $kargc + [llength $args]] parameters!"
</del><ins>+ return -code error "--${key} expects [expr {$kargc + [llength $args]}] parameters!"
</ins><span class="cx"> }
</span><span class="cx"> set global_options(ports_${action}_${key}) $args
</span><span class="cx"> }
</span><span class="lines">@@ -4647,7 +4647,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Decide how to do completion based on where we are in the string
</span><del>- set prefix [string range $text 0 [expr $start - 1]]
</del><ins>+ set prefix [string range $text 0 $start-1]
</ins><span class="cx">
</span><span class="cx"> # If only whitespace characters preceed us, or if the
</span><span class="cx"> # previous non-whitespace character was a ;, then we're
</span><span class="lines">@@ -4665,7 +4665,7 @@
</span><span class="cx"> upvar $linename line
</span><span class="cx">
</span><span class="cx"> set line ""
</span><del>- while { $line == "" } {
</del><ins>+ while { $line eq "" } {
</ins><span class="cx">
</span><span class="cx"> if {$use_readline} {
</span><span class="cx"> set len [readline read -attempted_completion attempt_completion line $prompt]
</span><span class="lines">@@ -4681,7 +4681,7 @@
</span><span class="cx">
</span><span class="cx"> set line [string trim $line]
</span><span class="cx">
</span><del>- if { $use_readline && $line != "" } {
</del><ins>+ if { $use_readline && $line ne "" } {
</ins><span class="cx"> rl_history add $line
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4696,7 +4696,7 @@
</span><span class="cx"> # Initialize readline
</span><span class="cx"> set isstdin [string match $in "stdin"]
</span><span class="cx"> set name "port"
</span><del>- set use_readline [expr $isstdin && [readline init $name]]
</del><ins>+ set use_readline [expr {$isstdin && [readline init $name]}]
</ins><span class="cx"> set history_file [file normalize "${macports::macports_user_dir}/history"]
</span><span class="cx">
</span><span class="cx"> # Read readline history
</span><span class="lines">@@ -4764,7 +4764,7 @@
</span><span class="cx"> # For each file in the command list, process commands
</span><span class="cx"> # in the file
</span><span class="cx"> foreach file $filelist {
</span><del>- if {$file == "-"} {
</del><ins>+ if {$file eq "-"} {
</ins><span class="cx"> set in stdin
</span><span class="cx"> } else {
</span><span class="cx"> if {[catch {set in [open $file]} result]} {
</span><span class="lines">@@ -4774,7 +4774,7 @@
</span><span class="cx">
</span><span class="cx"> set exit_status [process_command_file $in]
</span><span class="cx">
</span><del>- if {$in != "stdin"} {
</del><ins>+ if {$in ne "stdin"} {
</ins><span class="cx"> close $in
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4823,7 +4823,7 @@
</span><span class="cx"> # If we've been invoked as portf, then the first argument is assumed
</span><span class="cx"> # to be the name of a command file (i.e., there is an implicit -F
</span><span class="cx"> # before any arguments).
</span><del>-if {[moreargs] && $cmdname == "portf"} {
</del><ins>+if {[moreargs] && $cmdname eq "portf"} {
</ins><span class="cx"> lappend ui_options(ports_commandfiles) [lookahead]
</span><span class="cx"> advance
</span><span class="cx"> }
</span><span class="lines">@@ -4842,7 +4842,7 @@
</span><span class="cx"> # interactive mode
</span><span class="cx"> if { [llength $remaining_args] == 0 && ![info exists ui_options(ports_commandfiles)] } {
</span><span class="cx"> lappend ui_options(ports_commandfiles) -
</span><del>-} elseif {[lookahead] == "selfupdate" || [lookahead] == "sync"} {
</del><ins>+} elseif {[lookahead] eq "selfupdate" || [lookahead] eq "sync"} {
</ins><span class="cx"> # tell mportinit not to tell the user they should selfupdate
</span><span class="cx"> set ui_options(ports_no_old_index_warning) 1
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbasesrcportportindextcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port/portindex.tcl (116447 => 116448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port/portindex.tcl        2014-01-25 16:49:02 UTC (rev 116447)
+++ trunk/base/src/port/portindex.tcl        2014-01-25 16:52:01 UTC (rev 116448)
</span><span class="lines">@@ -102,12 +102,12 @@
</span><span class="cx">
</span><span class="cx"> foreach availkey [array names portinfo] {
</span><span class="cx"> # store list of subports for top-level ports only
</span><del>- if {![info exists keepkeys($availkey)] && $availkey != "subports"} {
</del><ins>+ if {![info exists keepkeys($availkey)] && $availkey ne "subports"} {
</ins><span class="cx"> unset portinfo($availkey)
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> set output [array get portinfo]
</span><del>- set len [expr [string length $output] + 1]
</del><ins>+ set len [expr {[string length $output] + 1}]
</ins><span class="cx"> puts $fd [list $portinfo(name) $len]
</span><span class="cx"> puts $fd $output
</span><span class="cx"> set mtime [file mtime [file join $directory $portdir Portfile]]
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> set output [array get portinfo]
</span><del>- set len [expr [string length $output] + 1]
</del><ins>+ set len [expr {[string length $output] + 1}]
</ins><span class="cx"> puts $fd [list $portinfo(name) $len]
</span><span class="cx"> puts $fd $output
</span><span class="cx"> }
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if {[expr $argc > 8]} {
</del><ins>+if {[expr {$argc > 8}]} {
</ins><span class="cx"> print_usage
</span><span class="cx"> exit 1
</span><span class="cx"> }
</span><span class="lines">@@ -155,23 +155,23 @@
</span><span class="cx"> set arg [lindex $argv $i]
</span><span class="cx"> switch -regex -- $arg {
</span><span class="cx"> {^-.+} {
</span><del>- if {$arg == "-d"} { # Turn on debug output
</del><ins>+ if {$arg eq "-d"} { # Turn on debug output
</ins><span class="cx"> set ui_options(ports_debug) yes
</span><del>- } elseif {$arg == "-o"} { # Set output directory
</del><ins>+ } elseif {$arg eq "-o"} { # Set output directory
</ins><span class="cx"> incr i
</span><span class="cx"> set outdir [file join [pwd] [lindex $argv $i]]
</span><del>- } elseif {$arg == "-p"} { # Set platform
</del><ins>+ } elseif {$arg eq "-p"} { # Set platform
</ins><span class="cx"> incr i
</span><span class="cx"> set platlist [split [lindex $argv $i] _]
</span><span class="cx"> set os_platform [lindex $platlist 0]
</span><span class="cx"> set os_major [lindex $platlist 1]
</span><span class="cx"> set os_arch [lindex $platlist 2]
</span><del>- if {$os_platform == "macosx"} {
</del><ins>+ if {$os_platform eq "macosx"} {
</ins><span class="cx"> lappend port_options os.subplatform $os_platform os.universal_supported yes
</span><span class="cx"> set os_platform darwin
</span><span class="cx"> }
</span><span class="cx"> lappend port_options os.platform $os_platform os.major $os_major os.arch $os_arch
</span><del>- } elseif {$arg == "-f"} { # Completely rebuild index
</del><ins>+ } elseif {$arg eq "-f"} { # Completely rebuild index
</ins><span class="cx"> set full_reindex 1
</span><span class="cx"> } else {
</span><span class="cx"> puts stderr "Unknown option: $arg"
</span><span class="lines">@@ -249,6 +249,6 @@
</span><span class="cx"> file mtime $outpath $newest
</span><span class="cx"> mports_generate_quickindex $outpath
</span><span class="cx"> puts "\nTotal number of ports parsed:\t$stats(total)\
</span><del>- \nPorts successfully parsed:\t[expr $stats(total) - $stats(failed)]\
</del><ins>+ \nPorts successfully parsed:\t[expr {$stats(total) - $stats(failed)}]\
</ins><span class="cx"> \nPorts failed:\t\t\t$stats(failed)\
</span><span class="cx"> \nUp-to-date ports skipped:\t$stats(skipped)\n"
</span></span></pre></div>
<a id="trunkbasesrcportportmirrortcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port/portmirror.tcl (116447 => 116448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port/portmirror.tcl        2014-01-25 16:49:02 UTC (rev 116447)
+++ trunk/base/src/port/portmirror.tcl        2014-01-25 16:52:01 UTC (rev 116448)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> puts "Usage: $argv0"
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if {[expr $argc > 0]} {
</del><ins>+if {[expr {$argc > 0}]} {
</ins><span class="cx"> print_usage
</span><span class="cx"> exit 1
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>