[116449] trunk/base/src/port1.0
cal at macports.org
cal at macports.org
Sat Jan 25 08:57:17 PST 2014
Revision: 116449
https://trac.macports.org/changeset/116449
Author: cal at macports.org
Date: 2014-01-25 08:57:17 -0800 (Sat, 25 Jan 2014)
Log Message:
-----------
port1.0: Tcl cleanup, from a patch by Gustaf Neumann
- removed numeric comparisons where not necessary
- braced expressions to allow for bytecode compilation
- removed unneeded calls to expr
- added brackets around if conditions
- quoted match expressions
Modified Paths:
--------------
trunk/base/src/port1.0/fetch_common.tcl
trunk/base/src/port1.0/portbuild.tcl
trunk/base/src/port1.0/portchecksum.tcl
trunk/base/src/port1.0/portclean.tcl
trunk/base/src/port1.0/portconfigure.tcl
trunk/base/src/port1.0/portdestroot.tcl
trunk/base/src/port1.0/portdistcheck.tcl
trunk/base/src/port1.0/portdistfiles.tcl
trunk/base/src/port1.0/portfetch.tcl
trunk/base/src/port1.0/portinstall.tcl
trunk/base/src/port1.0/portlint.tcl
trunk/base/src/port1.0/portlivecheck.tcl
trunk/base/src/port1.0/portload.tcl
trunk/base/src/port1.0/portmain.tcl
trunk/base/src/port1.0/portmirror.tcl
trunk/base/src/port1.0/portpatch.tcl
trunk/base/src/port1.0/portsandbox.tcl
trunk/base/src/port1.0/portstartupitem.tcl
trunk/base/src/port1.0/porttrace.tcl
trunk/base/src/port1.0/portunload.tcl
trunk/base/src/port1.0/portutil.tcl
trunk/base/src/port1.0/tests/test.tcl
Modified: trunk/base/src/port1.0/fetch_common.tcl
===================================================================
--- trunk/base/src/port1.0/fetch_common.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/fetch_common.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -48,7 +48,7 @@
# percent-encode all characters in str that are not unreserved in URIs
proc portfetch::percent_encode {str} {
set outstr ""
- while {[string length $str] > 0} {
+ while {$str ne ""} {
set char [string index $str 0]
set str [string range $str 1 end]
switch -- $char {
@@ -75,7 +75,7 @@
# Given a site url and the name of the distfile, assemble url and
# return it.
proc portfetch::assemble_url {site distfile} {
- if {[string index $site end] != "/"} {
+ if {[string index $site end] ne "/"} {
append site /
}
return "${site}[percent_encode ${distfile}]"
@@ -106,11 +106,11 @@
# tag will be after the last colon after the
# first slash after the ://
set lastcolon [string last : $element]
- set aftersep [expr [string first : $element] + 3]
+ set aftersep [expr {[string first : $element] + 3}]
set firstslash [string first / $element $aftersep]
if {$firstslash != -1 && $firstslash < $lastcolon} {
- set mirror_tag [string range $element [expr $lastcolon + 1] end]
- set element [string range $element 0 [expr $lastcolon - 1]]
+ set mirror_tag [string range $element $lastcolon+1 end]
+ set element [string range $element 0 $lastcolon-1]
} else {
set mirror_tag ""
}
@@ -122,9 +122,9 @@
set mirror_tag ""
}
- if {$mirror_tag == "mirror"} {
+ if {$mirror_tag eq "mirror"} {
set thesubdir ${dist_subdir}
- } elseif {$subdir == "" && $mirror_tag != "nosubdir"} {
+ } elseif {$subdir eq "" && $mirror_tag ne "nosubdir"} {
set thesubdir ${name}
} else {
set thesubdir ${subdir}
@@ -192,10 +192,10 @@
# add in the global, fallback and user-defined mirrors for each tag
foreach site $site_list {
if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag] && ![info exists extras_added($tag)]} {
- if {$sglobal != ""} {
+ if {$sglobal ne ""} {
set site_list [concat $site_list [mirror_sites $sglobal $tag "" $mirrorfile]]
}
- if {$sfallback != ""} {
+ if {$sfallback ne ""} {
set site_list [concat $site_list [mirror_sites $sfallback $tag "" $mirrorfile]]
}
if {[info exists env($senv)]} {
@@ -247,7 +247,7 @@
}
foreach site $urllist {
- if {[string range $site 0 6] == "file://"} {
+ if {[string range $site 0 6] eq "file://"} {
set pingtimes(localhost) 0
continue
}
@@ -299,7 +299,7 @@
set pinglist {}
foreach site $urllist {
- if {[string range $site 0 6] == "file://"} {
+ if {[string range $site 0 6] eq "file://"} {
set host localhost
} else {
regexp $hostregex $site -> host
Modified: trunk/base/src/port1.0/portbuild.tcl
===================================================================
--- trunk/base/src/port1.0/portbuild.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portbuild.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -69,12 +69,12 @@
if {!${build.type.add_deps}} {
return
}
- if {[option build.type] == "bsd" && [option os.platform] == "darwin"} {
+ if {[option build.type] eq "bsd" && [option os.platform] eq "darwin"} {
ui_debug "build.type is BSD, adding bin:bsdmake:bsdmake build dependency"
depends_build-delete bin:bsdmake:bsdmake
depends_build-append bin:bsdmake:bsdmake
}
- if {[option build.type] == "gnu" && [option os.platform] == "freebsd"} {
+ if {[option build.type] eq "gnu" && [option os.platform] eq "freebsd"} {
ui_debug "build.type is GNU, adding bin:gmake:gmake build dependency"
depends_build-delete bin:gmake:gmake
depends_build-append bin:gmake:gmake
@@ -87,23 +87,23 @@
default build.type.add_deps yes
proc portbuild::build_getmaketype {args} {
- if {[option build.type] == "default"} {
+ if {[option build.type] eq "default"} {
return [findBinary make $portutil::autoconf::make_path]
}
switch -exact -- [option build.type] {
bsd {
- if {[option os.platform] == "darwin"} {
+ if {[option os.platform] eq "darwin"} {
return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
- } elseif {[option os.platform] == "freebsd"} {
+ } elseif {[option os.platform] eq "freebsd"} {
return [findBinary make $portutil::autoconf::make_path]
} else {
return [findBinary pmake $portutil::autoconf::bsdmake_path]
}
}
gnu {
- if {[option os.platform] == "darwin"} {
+ if {[option os.platform] eq "darwin"} {
return [findBinary gnumake $portutil::autoconf::gnumake_path]
- } elseif {[option os.platform] == "linux"} {
+ } elseif {[option os.platform] eq "linux"} {
return [findBinary make $portutil::autoconf::make_path]
} else {
return [findBinary gmake $portutil::autoconf::gnumake_path]
@@ -111,12 +111,12 @@
}
pbx -
xcode {
- if {[option os.platform] != "darwin"} {
+ if {[option os.platform] ne "darwin"} {
return -code error "[format [msgcat::mc "This port requires 'xcodebuild', which is not available on %s."] [option os.platform]]"
}
global xcodebuildcmd
- if {$xcodebuildcmd != "none"} {
+ if {$xcodebuildcmd ne "none"} {
return $xcodebuildcmd
} else {
return -code error "xcodebuild was not found on this system!"
@@ -140,7 +140,7 @@
ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
}
if {[info exists memsize] && $jobs > $memsize / 1000000000 + 1} {
- set jobs [expr $memsize / 1000000000 + 1]
+ set jobs [expr {$memsize / 1000000000 + 1}]
}
}
if {![string is integer -strict $jobs] || $jobs <= 1} {
@@ -150,8 +150,8 @@
}
proc portbuild::build_getargs {args} {
- if {(([option build.type] == "default" && [option os.platform] != "freebsd") || \
- ([option build.type] == "gnu")) \
+ if {(([option build.type] eq "default" && [option os.platform] ne "freebsd") || \
+ ([option build.type] eq "gnu")) \
&& [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option build.cmd]]} {
# Print "Entering directory" lines for better log debugging
return "-w [option build.target]"
Modified: trunk/base/src/port1.0/portchecksum.tcl
===================================================================
--- trunk/base/src/port1.0/portchecksum.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portchecksum.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -82,8 +82,8 @@
set nb_checksum [llength $checksums_str]
if {[llength $all_dist_files] == 1
- && [expr $nb_checksum % 2] == 0
- && [expr $nb_checksum / 2] <= $checksum_types_count
+ && [expr {$nb_checksum % 2}] == 0
+ && [expr {$nb_checksum / 2}] <= $checksum_types_count
&& [lsearch -exact $checksum_types [lindex $checksums_str 0]] >= 0} {
# Convert to format #2
set checksums_str [linsert $checksums_str 0 [lindex $all_dist_files 0]]
@@ -226,7 +226,7 @@
# if everything is fine with the syntax, keep on and check the checksum of
# the distfiles.
- if {[parse_checksums $checksums_str] == "yes"} {
+ if {[parse_checksums $checksums_str] eq "yes"} {
set distpath [option distpath]
foreach distfile $all_dist_files {
@@ -268,7 +268,7 @@
# Used for regression testing
ui_debug "[format [msgcat::mc "Calculated (%s) is %s"] $type $calculated_sum]"
- if {[string equal $sum $calculated_sum]} {
+ if {$sum eq $calculated_sum} {
ui_debug "[format [msgcat::mc "Correct (%s) checksum for %s"] $type $distfile]"
} else {
ui_error "[format [msgcat::mc "Checksum (%s) mismatch for %s"] $type $distfile]"
Modified: trunk/base/src/port1.0/portclean.tcl
===================================================================
--- trunk/base/src/port1.0/portclean.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portclean.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -67,26 +67,26 @@
ui_warn "Only cleaning in ~/.macports; insufficient privileges for standard locations"
}
- if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
- [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
+ if {[info exists ports_clean_all] && $ports_clean_all eq "yes" || \
+ [info exists ports_clean_dist] && $ports_clean_dist eq "yes"} {
ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option subport]]"
clean_dist
}
- if {([info exists ports_clean_all] && $ports_clean_all == "yes" || \
- [info exists ports_clean_archive] && $ports_clean_archive == "yes")
+ if {([info exists ports_clean_all] && $ports_clean_all eq "yes" || \
+ [info exists ports_clean_archive] && $ports_clean_archive eq "yes")
&& !$usealtworkpath} {
ui_info "$UI_PREFIX [format [msgcat::mc "Removing temporary archives for %s"] [option subport]]"
clean_archive
}
- if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
- [info exists ports_clean_work] && $ports_clean_work == "yes" || \
- [info exists ports_clean_archive] && $ports_clean_archive == "yes" || \
- [info exists ports_clean_dist] && $ports_clean_dist == "yes" || \
- !([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
+ if {[info exists ports_clean_all] && $ports_clean_all eq "yes" || \
+ [info exists ports_clean_work] && $ports_clean_work eq "yes" || \
+ [info exists ports_clean_archive] && $ports_clean_archive eq "yes" || \
+ [info exists ports_clean_dist] && $ports_clean_dist eq "yes" || \
+ !([info exists ports_clean_logs] && $ports_clean_logs eq "yes")} {
ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
clean_work
}
- if {(([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no"))
+ if {(([info exists ports_clean_logs] && $ports_clean_logs eq "yes") || ($keeplogs eq "no"))
&& !$usealtworkpath} {
clean_logs
}
@@ -165,7 +165,7 @@
# or if user forces us to
set dirlist [list]
if {$dist_subdir != $name} {
- if {!([info exists ports_force] && $ports_force == "yes")
+ if {!([info exists ports_force] && $ports_force eq "yes")
&& [file isdirectory $distpath]
&& [llength [readdir $distpath]] > 0} {
ui_warn [format [msgcat::mc "Distfiles directory '%s' may contain distfiles needed for other ports, use the -f flag to force removal" ] $distpath]
@@ -291,7 +291,7 @@
# delete anything ending in .TMP since those are incomplete and
# thus can't be checked and aren't useful anyway.
set archivetype [string range [file extension $path] 1 end]
- if {[file isfile $path] && ($archivetype == "TMP"
+ if {[file isfile $path] && ($archivetype eq "TMP"
|| [extract_archive_metadata $path $archivetype portname] == $subport)} {
ui_debug "Removing archive: $path"
if {[catch {delete $path} result]} {
Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portconfigure.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -246,10 +246,10 @@
if {${configure.ccache}} {
# Create ccache directory with correct permissions with root privileges
elevateToRoot "configure ccache"
- if [catch {
+ if {[catch {
file mkdir ${ccache_dir}
file attributes ${ccache_dir} -owner ${macportsuser} -permissions 0755
- } result] {
+ } result]} {
ui_warn "ccache_dir ${ccache_dir} could not be created; disabling ccache: $result"
set configure.ccache no
}
@@ -257,9 +257,9 @@
# Initialize ccache directory with the given maximum size
if {${configure.ccache}} {
- if [catch {
+ if {[catch {
exec ccache -M ${ccache_size} >/dev/null
- } result] {
+ } result]} {
ui_warn "ccache_dir ${ccache_dir} could not be initialized; disabling ccache: $result"
set configure.ccache no
}
@@ -272,7 +272,7 @@
# universal_archs
proc portconfigure::choose_supported_archs {archs} {
global supported_archs
- if {$supported_archs == ""} {
+ if {$supported_archs eq ""} {
return $archs
}
set ret {}
@@ -354,7 +354,7 @@
global configure.universal_archs
set flags ""
foreach arch ${configure.universal_archs} {
- if {$flags == ""} {
+ if {$flags eq ""} {
set flags "-arch $arch"
} else {
append flags " -arch $arch"
@@ -397,7 +397,7 @@
}
proc portconfigure::compiler_is_port {compiler} {
- return [expr {[portconfigure::compiler_port_name ${compiler}] != ""}]
+ return [expr {[portconfigure::compiler_port_name ${compiler}] ne ""}]
}
# internal function to determine the default compiler
@@ -431,7 +431,7 @@
global xcodeversion macosx_deployment_target default_compilers configure.sdkroot
if {[info exists default_compilers]} {
return $default_compilers
- } elseif {$xcodeversion == "none" || $xcodeversion == ""} {
+ } elseif {$xcodeversion eq "none" || $xcodeversion eq ""} {
return {cc}
} elseif {[vercmp $xcodeversion 5.0] >= 0} {
return {clang macports-llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
@@ -744,7 +744,7 @@
}
# Add flags to specify C++ STL implementation
- if {${configure.cxx_stdlib} ne {} && [string match *clang* [option configure.cxx]]} {
+ if {${configure.cxx_stdlib} ne {} && [string match "*clang*" [option configure.cxx]]} {
append_to_environment_value configure CXXFLAGS -stdlib=${configure.cxx_stdlib}
append_to_environment_value configure OBJCXXFLAGS -stdlib=${configure.cxx_stdlib}
}
Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portdestroot.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -93,8 +93,8 @@
set_ui_prefix
proc portdestroot::destroot_getargs {args} {
- if {(([option build.type] == "default" && [option os.platform] != "freebsd") || \
- ([option build.type] == "gnu")) \
+ if {(([option build.type] eq "default" && [option os.platform] ne "freebsd") || \
+ ([option build.type] eq "gnu")) \
&& [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option destroot.cmd]]} {
# Print "Entering directory" lines for better log debugging
return "-w [option destroot.target]"
@@ -163,7 +163,7 @@
}
foreach fileToDelete {share/info/dir lib/charset.alias} {
- if [file exists "${destroot}${prefix}/${fileToDelete}"] {
+ if {[file exists "${destroot}${prefix}/${fileToDelete}"]} {
ui_debug "Deleting stray ${fileToDelete} file."
file delete "${destroot}${prefix}/${fileToDelete}"
}
@@ -172,7 +172,7 @@
# Prevent overlinking due to glibtool .la files: https://trac.macports.org/ticket/38010
ui_debug "Fixing glibtool .la files in destroot for ${subport}"
fs-traverse -depth fullpath ${destroot} {
- if {[file extension $fullpath] == ".la" && [file type $fullpath] == "file"} {
+ if {[file extension $fullpath] eq ".la" && [file type $fullpath] eq "file"} {
# Make sure it is from glibtool ... "a libtool library file" will appear in the first line
if {![catch {set fp [open $fullpath]}]} {
if {[gets $fp line] > 0 && [string first "a libtool library file" $line] != -1} {
@@ -201,7 +201,7 @@
}
}
fs-traverse -depth dir ${destroot} {
- if {[file type $dir] == "directory"} {
+ if {[file type $dir] eq "directory"} {
catch {file delete $dir}
}
}
@@ -221,18 +221,18 @@
set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
set gunzip "$gzip -d"
set bunzip2 "[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d"
- if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} {
+ if {[file isdirectory ${manpath}] && [file type ${manpath}] eq "directory"} {
ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${subport}]"
set found 0
set manlinks [list]
foreach mandir [readdir "${manpath}"] {
if {![regexp {^(cat|man)(.)$} ${mandir} match ignore manindex]} { continue }
set mandirpath [file join ${manpath} ${mandir}]
- if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] == "directory"} {
+ if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] eq "directory"} {
ui_debug "Scanning ${mandir}"
foreach manfile [readdir ${mandirpath}] {
set manfilepath [file join ${mandirpath} ${manfile}]
- if {[file isfile ${manfilepath}] && [file type ${manfilepath}] == "file"} {
+ if {[file isfile ${manfilepath}] && [file type ${manfilepath}] eq "file"} {
if {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$" ${manfile} gzfile manfile]} {
set found 1
system "cd ${manpath} && \
@@ -258,7 +258,7 @@
file attributes ${gzmanfilepath} -permissions $desired
}
}
- } elseif {[file type ${manfilepath}] == "link"} {
+ } elseif {[file type ${manfilepath}] eq "link"} {
lappend manlinks [file join ${mandir} ${manfile}]
}
}
@@ -336,14 +336,14 @@
set mtree_violation "yes"
}
}
- } elseif {[string equal -length [expr [string length $dfile] + 1] $dfile/ $prefix]} {
+ } elseif {[string equal -length [expr {[string length $dfile] + 1}] $dfile/ $prefix]} {
# we've found a subpath of our prefix
lpush pathsToCheck $dfile
} else {
set dir_allowed no
# these files are (at least potentially) outside of the prefix
foreach dir "$applications_dir $frameworks_dir /Library/LaunchAgents /Library/LaunchDaemons /Library/StartupItems" {
- if {[string equal -length [expr [string length $dfile] + 1] $dfile/ $dir]} {
+ if {[string equal -length [expr {[string length $dfile] + 1}] $dfile/ $dir]} {
# it's a prefix of one of the allowed paths
set dir_allowed yes
break
Modified: trunk/base/src/port1.0/portdistcheck.tcl
===================================================================
--- trunk/base/src/port1.0/portdistcheck.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portdistcheck.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -61,7 +61,7 @@
ui_debug "Portfile modification date is [clock format $port_moddate]"
set curl_options {}
- if [tbool fetch.ignore_sslcert] {
+ if {[tbool fetch.ignore_sslcert]} {
lappend curl_options "--ignore-ssl-cert"
}
@@ -127,13 +127,13 @@
set size $totalsize
set humansize "${size}"
} elseif {$totalsize < 1024*1024} {
- set size [expr $totalsize / 1024.0]
+ set size [expr {$totalsize / 1024.0}]
set humansize [format "%.1fK" $size]
} elseif {$totalsize < 1024*1024*1024} {
- set size [expr $totalsize / (1024.0*1024.0)]
+ set size [expr {$totalsize / (1024.0*1024.0)}]
set humansize [format "%.1fM" $size]
} else {
- set size [expr $totalsize / (1024.0*1024.0*1024.0)]
+ set size [expr {$totalsize / (1024.0*1024.0*1024.0)}]
set humansize [format "%.1fG" $size]
}
ui_msg "$subport: $humansize"
Modified: trunk/base/src/port1.0/portdistfiles.tcl
===================================================================
--- trunk/base/src/port1.0/portdistfiles.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portdistfiles.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -57,8 +57,8 @@
portdbpath dist_subdir all_dist_files
# give up on ports that do not provide URLs
- if {(![info exists master_sites] || $master_sites == "{}")
- && (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites == "{}")} {
+ if {(![info exists master_sites] || $master_sites eq "{}")
+ && (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites eq "{}")} {
return 0
}
@@ -81,7 +81,7 @@
ui_msg "\[$distfile\] [file join $portdbpath distfiles $dist_subdir $distfile]"
# print checksums if available
- if {$result == "yes" && [array get checksums_array $distfile] != ""} {
+ if {$result eq "yes" && [array get checksums_array $distfile] ne ""} {
foreach {type sum} $checksums_array($distfile) {
ui_msg " $type: $sum"
}
Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portfetch.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -170,7 +170,7 @@
proc portfetch::set_fetch_type {option action args} {
global os.platform os.major
if {[string equal ${action} "set"]} {
- if {$args != "standard"} {
+ if {$args ne "standard"} {
distfiles
}
switch $args {
@@ -230,7 +230,7 @@
set distsite [getdisttag $file]
set file [getdistname $file]
lappend all_dist_files $file
- if {$distsite != ""} {
+ if {$distsite ne ""} {
lappend fetch_urls $distsite $file
} elseif {[info exists patch_sites]} {
lappend fetch_urls patch_sites $file
@@ -253,7 +253,7 @@
set distsite [getdisttag $file]
set file [getdistname $file]
lappend all_dist_files $file
- if {$distsite != ""} {
+ if {$distsite ne ""} {
lappend fetch_urls $distsite $file
} else {
lappend fetch_urls master_sites $file
@@ -390,7 +390,7 @@
}
regexp {(.*://)?([[:alnum:].-]+)(:(\d+))?} $proxy_str - - proxy_host - proxy_port
set ret "--config-option servers:global:http-proxy-host=${proxy_host}"
- if {$proxy_port != ""} {
+ if {$proxy_port ne ""} {
append ret " --config-option servers:global:http-proxy-port=${proxy_port}"
}
return $ret
@@ -501,7 +501,7 @@
if {${fetch.remote_time} != "no"} {
lappend fetch_options "--remote-time"
}
- if {$portverbose == "yes"} {
+ if {$portverbose eq "yes"} {
lappend fetch_options "-v"
}
set sorted no
Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portinstall.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -238,7 +238,7 @@
array set ourvariations $PortInfo(active_variants)
set vlist [lsort -ascii [array names ourvariations]]
foreach v $vlist {
- if {$ourvariations($v) == "+"} {
+ if {$ourvariations($v) eq "+"} {
puts $fd "@portvariant +${v}"
}
}
@@ -263,7 +263,7 @@
# also save the contents for our own use later
set installPlist {}
fs-traverse -depth fullpath $destpath {
- if {[file type $fullpath] == "directory"} {
+ if {[file type $fullpath] eq "directory"} {
continue
}
set relpath [strsed $fullpath "s|^$destpath/||"]
@@ -310,13 +310,13 @@
os.platform os.major portarchivetype installPlist
set oldpwd [pwd]
- if {$oldpwd == ""} {
+ if {$oldpwd eq ""} {
set oldpwd $portpath
}
set location [get_portimage_path]
set archive_path [find_portarchive_path]
- if {$archive_path != ""} {
+ if {$archive_path ne ""} {
set install_dir [file dirname $location]
file mkdir $install_dir
file rename -force $archive_path $install_dir
@@ -336,7 +336,7 @@
if {[info exists $deplist]} {
foreach dep [set $deplist] {
set dep_portname [_get_dep_port $dep]
- if {$dep_portname != ""} {
+ if {$dep_portname ne ""} {
lappend dep_portnames $dep_portname
}
}
@@ -356,7 +356,7 @@
$regref os_major ${os.major}
$regref archs [get_canonical_archs]
# Trick to have a portable GMT-POSIX epoch-based time.
- $regref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]]
+ $regref date [expr {[clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]}]
if {[info exists negated_variants]} {
$regref negated_variants $negated_variants
}
Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portlint.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -138,7 +138,7 @@
if {$nitpick} {
seek $f -1 end
set last [read $f 1]
- if {![string match "\n" $last]} {
+ if {"\n" ne $last} {
ui_warn "Line $lineno has missing newline (at end of file)"
incr warnings
}
@@ -153,12 +153,12 @@
incr errors
}
- if {($require_after == "PortSystem" || $require_after == "PortGroup") && \
+ if {($require_after eq "PortSystem" || $require_after eq "PortGroup") && \
[string match "PortGroup*" $line]} {
set require_blank false
}
- if {$nitpick && $require_blank && ($line != "")} {
+ if {$nitpick && $require_blank && ($line ne "")} {
ui_warn "Line $lineno should be a newline (after $require_after)"
incr warnings
}
@@ -228,7 +228,7 @@
if {[string match "long_description*" $line]} {
set in_description true
}
- if {$in_description && ([string range $line end end] != "\\")} {
+ if {$in_description && ([string range $line end end] ne "\\")} {
set in_description false
#set require_blank true
#set require_after "long_description"
@@ -245,7 +245,7 @@
if {[string match "platform\[ \t\]*" $line]} {
regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -> platform_arch
- if {$platform_arch == "ppc"} {
+ if {$platform_arch eq "ppc"} {
ui_error "Arch 'ppc' in platform on line $lineno should be 'powerpc'"
incr errors
}
@@ -334,7 +334,7 @@
foreach req_var $lint_required {
- if {$req_var == "master_sites"} {
+ if {$req_var eq "master_sites"} {
if {${fetch.type} != "standard"} {
ui_info "OK: $req_var not required for fetch.type ${fetch.type}"
continue
@@ -401,7 +401,7 @@
foreach variant $all_variants {
set variantname [ditem_key $variant name]
set variantdesc [lindex [ditem_key $variant description] 0]
- if {![info exists variantname] || $variantname == ""} {
+ if {![info exists variantname] || $variantname eq ""} {
ui_error "Variant number $variantnumber does not have a name"
incr errors
} else {
@@ -414,18 +414,18 @@
set name_ok false
}
- if {![info exists variantdesc] || $variantdesc == ""} {
+ if {![info exists variantdesc] || $variantdesc eq ""} {
# don't warn about missing descriptions for global variants
if {[lsearch -exact $local_variants $variantname] != -1 &&
- [variant_desc $porturl $variantname] == ""} {
+ [variant_desc $porturl $variantname] eq ""} {
ui_warn "Variant $variantname does not have a description"
incr warnings
set desc_ok false
- } elseif {$variantdesc == ""} {
+ } elseif {$variantdesc eq ""} {
set variantdesc "(pre-defined variant)"
}
} else {
- if {[variant_desc $porturl $variantname] != ""} {
+ if {[variant_desc $porturl $variantname] ne ""} {
ui_warn "Variant $variantname overrides global description"
incr warnings
}
@@ -470,7 +470,7 @@
ui_debug "$errorInfo"
continue
}
- if {$res == ""} {
+ if {$res eq ""} {
ui_error "Unknown dependency: $dep"
incr errors
} else {
@@ -509,19 +509,19 @@
$addr == "openmaintainer at macports.org"} {
ui_warn "Using full email address for no/open maintainer"
incr warnings
- } elseif [regexp "^(.+)@macports.org$" $addr -> localpart] {
+ } elseif {[regexp "^(.+)@macports.org$" $addr -> localpart]} {
ui_warn "Maintainer email address for $localpart includes @macports.org"
incr warnings
} elseif {$addr == "darwinports at opendarwin.org"} {
ui_warn "Using legacy email address for no/open maintainer"
incr warnings
- } elseif [regexp "^(.+)@(.+)$" $addr -> localpart domain] {
+ } elseif {[regexp "^(.+)@(.+)$" $addr -> localpart domain]} {
ui_warn "Maintainer email address should be obfuscated as $domain:$localpart"
incr warnings
}
}
- if {$license == "unknown"} {
+ if {$license eq "unknown"} {
ui_warn "no license set"
incr warnings
} else {
@@ -547,7 +547,7 @@
# if the last character of license name is a number or plus sign
# then a hyphen is missing
set license_end [string index $subtest end]
- if {[string equal "+" $license_end] || [string is integer -strict $license_end]} {
+ if {"+" eq $license_end || [string is integer -strict $license_end]} {
ui_error "invalid license '${test}': missing hyphen before version"
}
}
@@ -601,7 +601,7 @@
set refcount [lindex [set ${deprecated_options_name}($option)] 1]
if {$refcount > 0} {
- if {$newoption != ""} {
+ if {$newoption ne ""} {
ui_warn "Using deprecated option '$option', superseded by '$newoption'"
} else {
ui_warn "Using deprecated option '$option'"
@@ -622,22 +622,22 @@
set svn_cmd ""
catch {set svn_cmd [findBinary svn]}
- if {$svn_cmd != "" && ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath > /dev/null 2>@1}])} {
+ if {$svn_cmd ne "" && ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath > /dev/null 2>@1}])} {
ui_debug "Checking svn properties"
- if [catch {exec $svn_cmd propget svn:keywords $portfile 2>@1} output] {
+ if {[catch {exec $svn_cmd propget svn:keywords $portfile 2>@1} output]} {
ui_warn "Unable to check for svn:keywords property: $output"
} else {
ui_debug "Property svn:keywords is \"$output\", should be \"Id\""
- if {$output != "Id"} {
+ if {$output ne "Id"} {
ui_error "Missing subversion property on Portfile, please execute: svn ps svn:keywords Id Portfile"
incr errors
}
}
- if [catch {exec $svn_cmd propget svn:eol-style $portfile 2>@1} output] {
+ if {[catch {exec $svn_cmd propget svn:eol-style $portfile 2>@1} output]} {
ui_warn "Unable to check for svn:eol-style property: $output"
} else {
ui_debug "Property svn:eol-style is \"$output\", should be \"native\""
- if {$output != "native"} {
+ if {$output ne "native"} {
ui_error "Missing subversion property on Portfile, please execute: svn ps svn:eol-style native Portfile"
incr errors
}
Modified: trunk/base/src/port1.0/portlivecheck.tcl
===================================================================
--- trunk/base/src/port1.0/portlivecheck.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portlivecheck.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -77,7 +77,7 @@
ui_debug "Port (livecheck) version is ${livecheck.version}"
set curl_options {}
- if [tbool livecheck.ignore_sslcert] {
+ if {[tbool livecheck.ignore_sslcert]} {
lappend curl_options "--ignore-ssl-cert"
}
@@ -99,7 +99,7 @@
if {[regexp "^($available_types)(?::(\[^:\]+))?" ${master_site} _ site subdir]} {
set subdirs [split $subdir /]
if {[llength $subdirs] > 1} {
- if {[lindex $subdirs 0] == "project"} {
+ if {[lindex $subdirs 0] eq "project"} {
set subdir [lindex $subdirs 1]
} else {
set subdir ""
Modified: trunk/base/src/port1.0/portload.tcl
===================================================================
--- trunk/base/src/port1.0/portload.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portload.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -53,7 +53,7 @@
set launchctl_path ${portutil::autoconf::launchctl_path}
foreach { path } "/Library/${startupitem.location}/${startupitem.plist}" {
- if {[string length $launchctl_path] == 0} {
+ if {$launchctl_path eq ""} {
return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
} elseif {![file exists $path]} {
return -code error [format [msgcat::mc "Launchd plist %s was not found"] $path]
Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portmain.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -80,7 +80,7 @@
default subbuildpath {[portmain::get_subbuildpath]}
proc portmain::get_subbuildpath {} {
global portpath portbuildpath subport
- if {$subport != ""} {
+ if {$subport ne ""} {
set subdir $subport
} else {
set subdir [file tail $portpath]
@@ -120,7 +120,7 @@
default os.endian {$os_endian}
set macosx_version_text {}
-if {[option os.platform] == "darwin"} {
+if {[option os.platform] eq "darwin"} {
set macosx_version_text "(Mac OS X ${macosx_version}) "
}
ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
@@ -128,7 +128,7 @@
default universal_variant {${use_configure}}
# sub-platforms of darwin
-if {[option os.platform] == "darwin"} {
+if {[option os.platform] eq "darwin"} {
if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
default os.subplatform macosx
# we're on Mac OS X and can therefore build universal
Modified: trunk/base/src/port1.0/portmirror.tcl
===================================================================
--- trunk/base/src/port1.0/portmirror.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portmirror.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -58,7 +58,7 @@
set mirror_filemap_path [file join $portdbpath distfiles_mirror.db]
if {![info exists mirror_filemap]
&& [info exists ports_mirror_new]
- && $ports_mirror_new == "yes"
+ && $ports_mirror_new eq "yes"
&& [file exists $mirror_filemap_path]} {
# Trash the map file if it existed.
file delete -force $mirror_filemap_path
Modified: trunk/base/src/port1.0/portpatch.tcl
===================================================================
--- trunk/base/src/port1.0/portpatch.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portpatch.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -72,7 +72,7 @@
global UI_PREFIX usealtworkpath altprefix
# First make sure that patchfiles exists and isn't stubbed out.
- if {![exists patchfiles] || [option patchfiles] == ""} {
+ if {![exists patchfiles] || [option patchfiles] eq ""} {
return 0
}
Modified: trunk/base/src/port1.0/portsandbox.tcl
===================================================================
--- trunk/base/src/port1.0/portsandbox.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portsandbox.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -35,7 +35,7 @@
options portsandbox_supported portsandbox_active portsandbox_profile
default portsandbox_supported {[file executable $portutil::autoconf::sandbox_exec_path]}
-default portsandbox_active {[expr $portsandbox_supported && $sandbox_enable]}
+default portsandbox_active {[expr {$portsandbox_supported && $sandbox_enable}]}
default portsandbox_profile {}
# set up a suitable profile to pass to sandbox-exec, based on the target
Modified: trunk/base/src/port1.0/portstartupitem.tcl
===================================================================
--- trunk/base/src/port1.0/portstartupitem.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portstartupitem.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -231,12 +231,12 @@
puts ${item} "LOGFILE=\"${startupitem.logfile}\""
puts ${item} "EXECUTABLE=\"${startupitem.executable}\""
puts ${item} ""
- puts ${item} "HAVE_STARTCMDS=[expr [llength ${startupitem.start}] ? "true" : "false"]"
- puts ${item} "HAVE_STOPCMDS=[expr [llength ${startupitem.stop}] ? "true" : "false"]"
- puts ${item} "HAVE_RESTARTCMDS=[expr [llength ${startupitem.restart}] ? "true" : "false"]"
+ puts ${item} "HAVE_STARTCMDS=[expr {[llength ${startupitem.start}] ? "true" : "false"}]"
+ puts ${item} "HAVE_STOPCMDS=[expr {[llength ${startupitem.stop}] ? "true" : "false"}]"
+ puts ${item} "HAVE_RESTARTCMDS=[expr {[llength ${startupitem.restart}] ? "true" : "false"}]"
puts ${item} "DELETE_PIDFILE=${createPidFile}"
puts ${item} "CREATE_PIDFILE=${deletePidFile}"
- puts ${item} "LOG_EVENTS=[expr [tbool ${startupitem.logevents}] ? "true" : "false"]"
+ puts ${item} "LOG_EVENTS=[expr {[tbool ${startupitem.logevents}] ? "true" : "false"}]"
puts ${item} ""
# Emit the init lines
Modified: trunk/base/src/port1.0/porttrace.tcl
===================================================================
--- trunk/base/src/port1.0/porttrace.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/porttrace.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -272,12 +272,12 @@
# Skip empty lines.
if {$line_length > 0} {
- set path_start [expr [string first "\t" $theline] + 1]
- set op [string range $theline 0 [expr $path_start - 2]]
- set path [string range $theline $path_start [expr $line_length - 1]]
+ set path_start [expr {[string first "\t" $theline] + 1}]
+ set op [string range $theline 0 $path_start-2]
+ set path [string range $theline $path_start $line_length-1]
# open/execve
- if {$op == "open" || $op == "execve"} {
+ if {$op eq "open" || $op eq "execve"} {
# Only work on files.
if {[file isfile $path]} {
# Did we process the file yet?
@@ -301,7 +301,7 @@
catch {filemap set trace_filemap $path $port}
}
}
- } elseif {$op == "sandbox_violation"} {
+ } elseif {$op eq "sandbox_violation"} {
lappend sandbox_violation_list $path
}
}
Modified: trunk/base/src/port1.0/portunload.tcl
===================================================================
--- trunk/base/src/port1.0/portunload.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portunload.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -53,7 +53,7 @@
set launchctl_path ${portutil::autoconf::launchctl_path}
foreach { path } "/Library/${startupitem.location}/${startupitem.plist}" {
- if {[string length $launchctl_path] == 0} {
+ if {$launchctl_path eq ""} {
return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
} elseif {![file exists $path]} {
return -code error [format [msgcat::mc "Launchd plist %s was not found"] $path]
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/portutil.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -179,7 +179,7 @@
set deprecated_options(${option}-replace) [list ${option}-strsed 0]
}
set refcount [lindex $deprecated_options(${option}-replace) 1]
- lset deprecated_options(${option}-replace) 1 [expr $refcount + 1]
+ lset deprecated_options(${option}-replace) 1 [expr {$refcount + 1}]
return [eval handle_option-strsed $option $args]
}
@@ -252,15 +252,15 @@
set refcount [lindex $deprecated_options($option) 1]
global $newoption
- if {$newoption == ""} {
+ if {$newoption eq ""} {
ui_warn "Port $subport using deprecated option \"$option\"."
return
}
# Increment reference counter
- lset deprecated_options($option) 1 [expr $refcount + 1]
+ lset deprecated_options($option) 1 [expr {$refcount + 1}]
- if {$action != "read"} {
+ if {$action ne "read"} {
$newoption [set $option]
} else {
$option [set $newoption]
@@ -384,12 +384,12 @@
set command_suffix ""
if {[llength $args] > 0} {
- if {[lindex $args 0] == "-notty"} {
+ if {[lindex $args 0] eq "-notty"} {
set notty "-notty"
set args [lrange $args 1 end]
}
- if {[lindex $args 0] == "-varprefix"} {
+ if {[lindex $args 0] eq "-varprefix"} {
set varprefix [lindex $args 1]
set args [lrange $args 2 end]
}
@@ -435,7 +435,7 @@
# Prepare nice value change
set nice ""
- if {[info exists ${varprefix}.nice] && [set ${varprefix}.nice] != ""} {
+ if {[info exists ${varprefix}.nice] && [set ${varprefix}.nice] ne ""} {
set nice "-nice [set ${varprefix}.nice]"
}
@@ -529,10 +529,10 @@
# args is a list of strings/list
foreach arg $args {
# Strip trailing empty lines
- if {[string index $arg 0] == "\n"} {
+ if {[string index $arg 0] eq "\n"} {
set arg [string range $arg 1 end]
}
- if {[string index $arg end] == "\n"} {
+ if {[string index $arg end] eq "\n"} {
set arg [string range $arg 0 end-1]
}
@@ -540,13 +540,13 @@
set indent ""
for {set i 0} {$i < [string length $arg]} {incr i} {
set c [string index $arg $i]
- if {$c != " " && $c != "\t"} {
+ if {$c ne " " && $c ne "\t"} {
break
}
append indent $c
}
# Remove indent on first line
- set arg [string replace $arg 0 [expr $i - 1]]
+ set arg [string replace $arg 0 [expr {$i - 1}]]
# Remove indent on each other line
set arg [string map "\"\n$indent\" \"\n\"" $arg]
@@ -581,7 +581,7 @@
return -code error "Malformed variant specification"
}
set code [lindex $args end]
- set args [lrange $args 0 [expr $len - 2]]
+ set args [lrange $args 0 $len-2]
set ditem [variant_new "temp-variant"]
@@ -629,7 +629,7 @@
set vdesc [join [ditem_key $ditem description]]
# read global variant description, if none given
- if {$vdesc == ""} {
+ if {$vdesc eq ""} {
set vdesc [variant_desc $porturl $variant_provides]
}
@@ -668,7 +668,7 @@
proc variant_isset {name} {
global variations
- if {[info exists variations($name)] && $variations($name) == "+"} {
+ if {[info exists variations($name)] && $variations($name) eq "+"} {
return 1
}
return 0
@@ -731,7 +731,7 @@
incr lineno
set name [lindex $line 0]
set desc [lindex $line 1]
- if {$name != "" && $desc != ""} {
+ if {$name ne "" && $desc ne ""} {
set variant_descs_global(${descfile}_$name) $desc
} else {
ui_warn "Invalid variant description in $descfile at line $lineno"
@@ -781,7 +781,7 @@
}
set code [lindex $args end]
set os [lindex $args 0]
- set args [lrange $args 1 [expr $len - 2]]
+ set args [lrange $args 1 $len-2]
foreach arg $args {
if {[regexp {(^[0-9]+$)} $arg match result]} {
@@ -990,7 +990,7 @@
set cmdline $portutil::autoconf::sed_command
if {$extended} {
- if {$portutil::autoconf::sed_ext_flag == "N/A"} {
+ if {$portutil::autoconf::sed_ext_flag eq "N/A"} {
ui_debug "sed extended regexp not available"
return -code error "reinplace sed(1) too old"
}
@@ -1010,7 +1010,7 @@
ui_debug "$errorInfo"
ui_error "reinplace: $error"
file delete "$tmpfile"
- if {$locale != ""} {
+ if {$locale ne ""} {
if {$oldlocale_exists} {
set env(LC_CTYPE) $oldlocale
} else {
@@ -1024,7 +1024,7 @@
return -code error "reinplace sed(1) failed"
}
- if {$locale != ""} {
+ if {$locale ne ""} {
if {$oldlocale_exists} {
set env(LC_CTYPE) $oldlocale
} else {
@@ -1074,7 +1074,7 @@
# touch
# mimics the BSD touch command
proc touch {args} {
- while {[string match -* [lindex $args 0]]} {
+ while {[string match "-*" [lindex $args 0]]} {
set arg [string range [lindex $args 0] 1 end]
set args [lrange $args 1 end]
switch -- $arg {
@@ -1085,7 +1085,7 @@
t {
set narg [lindex $args 0]
set args [lrange $args 1 end]
- if {[string length $narg] == 0} {
+ if {$narg eq ""} {
return -code error "touch: option requires an argument -- $arg"
}
set options($arg) $narg
@@ -1098,7 +1098,7 @@
# parse the r/t options
if {[info exists options(rt)]} {
- if {[string equal $options(rt) r]} {
+ if {$options(rt) eq "r"} {
# -r
# get atime/mtime from the file
if {[file exists $options(r)]} {
@@ -1113,9 +1113,9 @@
# turn it into a CCyymmdd hhmmss
set timespec {^(?:(\d\d)?(\d\d))?(\d\d)(\d\d)(\d\d)(\d\d)(?:\.(\d\d))?$}
if {[regexp $timespec $options(t) {} CC YY MM DD hh mm SS]} {
- if {[string length $YY] == 0} {
+ if {$YY eq ""} {
set year [clock format [clock seconds] -format %Y]
- } elseif {[string length $CC] == 0} {
+ } elseif {$CC eq ""} {
if {$YY >= 69 && $YY <= 99} {
set year 19$YY
} else {
@@ -1124,7 +1124,7 @@
} else {
set year $CC$YY
}
- if {[string length $SS] == 0} {
+ if {$SS eq ""} {
set SS 00
}
set atime [clock scan "$year$MM$DD $hh$mm$SS"]
@@ -1204,7 +1204,7 @@
# ln [-f] [-h] [-s] [-v] source_file [target_file]
# ln [-f] [-h] [-s] [-v] source_file ... target_dir
proc ln {args} {
- while {[string match -* [lindex $args 0]]} {
+ while {[string match "-*" [lindex $args 0]]} {
set arg [string range [lindex $args 0] 1 end]
if {[string length $arg] > 1} {
set remainder -[string range $arg 1 end]
@@ -1230,7 +1230,7 @@
set files $args
set target ./
} else {
- set files [lrange $args 0 [expr [llength $args] - 2]]
+ set files [lrange $args 0 [llength $args]-2]
set target [lindex $args end]
}
@@ -1357,11 +1357,11 @@
set env(HOME) "${workpath}/.home"
set env(TMPDIR) "${workpath}/.tmp"
- if {[ditem_key $ditem state] != "no"} {
+ if {[ditem_key $ditem state] ne "no"} {
set target_state_fd [open_statefile]
}
- if {$procedure != ""} {
+ if {$procedure ne ""} {
set targetname [ditem_key $ditem name]
set target [ditem_key $ditem provides]
portsandbox::set_profile $target
@@ -1380,14 +1380,14 @@
if {$result == 0} {
# Skip the step if required and explain why through ui_debug.
# check if the step was already done (as mentioned in the state file)
- if {[ditem_key $ditem state] != "no"
+ if {[ditem_key $ditem state] ne "no"
&& [check_statefile target $targetname $target_state_fd]} {
ui_debug "Skipping completed $targetname ($portname)"
set skipped 1
}
# Of course, if this is a dry run, don't do the task:
- if {[info exists ports_dryrun] && $ports_dryrun == "yes"} {
+ if {[info exists ports_dryrun] && $ports_dryrun eq "yes"} {
# only one message per portname
if {$portname != $ports_dry_last_skipped} {
ui_notice "For $portname: skipping $targetname (dry run)"
@@ -1472,7 +1472,7 @@
# Gather the dependencies for deptypes
foreach deptype $deptypes {
# Add to the list of dependencies if the option exists and isn't empty.
- if {[info exists PortInfo($deptype)] && $PortInfo($deptype) != ""} {
+ if {[info exists PortInfo($deptype)] && $PortInfo($deptype) ne ""} {
set depends [concat $depends $PortInfo($deptype)]
}
}
@@ -1485,7 +1485,7 @@
# If portname is empty, the dependency is already satisfied by other means,
# for example a bin: dependency on a file not installed by MacPorts
- if {$name != ""} {
+ if {$name ne ""} {
if {[lsearch -exact $deplist $name] == -1} {
lappend deplist $name
set deplist [recursive_collect_deps $name $deplist]
@@ -1494,7 +1494,7 @@
}
# Add ccache port for access to ${prefix}/bin/ccache binary
- if [option configure.ccache] {
+ if {[option configure.ccache]} {
lappend deplist ccache
}
@@ -1580,8 +1580,8 @@
# - this step is not to always be performed
# - this step must be written to file
if {$skipped == 0
- && [ditem_key $ditem runtype] != "always"
- && [ditem_key $ditem state] != "no"} {
+ && [ditem_key $ditem runtype] ne "always"
+ && [ditem_key $ditem state] ne "no"} {
write_statefile target $targetname $target_state_fd
}
} else {
@@ -1596,7 +1596,7 @@
set result 1
}
- if {[ditem_key $ditem state] != "no"} {
+ if {[ditem_key $ditem state] ne "no"} {
close $target_state_fd
}
@@ -1639,10 +1639,10 @@
# the statefile will likely be autocleaned away after install,
# so special-case already-completed install and activate
if {[registry_exists $subport $version $revision $portvariants]} {
- if {$target == "install"} {
+ if {$target eq "install"} {
ui_debug "Skipping $target ($subport) since this port is already installed"
return 0
- } elseif {$target == "activate"} {
+ } elseif {$target eq "activate"} {
set regref [registry_open $subport $version $revision $portvariants ""]
if {[registry_prop_retr $regref active] != 0} {
# Something to close the registry entry may be called here, if it existed.
@@ -1660,13 +1660,13 @@
}
# Select the subset of targets under $target
- if {$target != ""} {
+ if {$target ne ""} {
set matches [dlist_search $dlist provides $target]
if {[llength $matches] > 0} {
set dlist [dlist_append_dependents $dlist [lindex $matches 0] [list]]
# Special-case 'all'
- } elseif {$target != "all"} {
+ } elseif {$target ne "all"} {
ui_error "unknown target: $target"
return 1
}
@@ -1961,9 +1961,9 @@
set ignored 0
foreach flavor [ditem_key $ditem provides] {
if {[info exists upvariations($flavor)]} {
- if {$upvariations($flavor) == "+"} {
+ if {$upvariations($flavor) eq "+"} {
incr pros
- } elseif {$upvariations($flavor) == "-"} {
+ } elseif {$upvariations($flavor) eq "-"} {
incr cons
}
} else {
@@ -2119,14 +2119,14 @@
set ditems [dlist_append_dependents $targets [lindex $ditems 0] [list]]
}
foreach d $ditems {
- if {[ditem_key $d state] != "no"} {
+ if {[ditem_key $d state] ne "no"} {
# At least one matching target requires the state file
set statereq 1
break
}
}
if { $statereq &&
- !([info exists ports_force] && $ports_force == "yes")} {
+ !([info exists ports_force] && $ports_force eq "yes")} {
set state_fd [open_statefile]
@@ -2134,7 +2134,7 @@
if {[check_statefile_variants variations oldvariations $state_fd]} {
ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
set result 1
- } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
+ } elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
# Write variations out to the statefile
foreach key [array names variations *] {
write_statefile variant $variations($key)$key $state_fd
@@ -2189,7 +2189,7 @@
foreach target $args {
set origproc [ditem_key $ditem procedure]
set ident [ditem_key $ditem name]
- if {[info commands $target] == ""} {
+ if {[info commands $target] eq ""} {
proc $target {args} "
variable proc_index
set proc_index \[llength \[ditem_key $ditem proc\]\]
@@ -2314,9 +2314,9 @@
proc handle_add_users {} {
set cur ""
foreach val [option add_users] {
- if {[string match *=* $val] && $cur != ""} {
+ if {[string match "*=*" $val] && $cur ne ""} {
set split_arg [split $val =]
- if {[lindex $split_arg 0] == "group"} {
+ if {[lindex $split_arg 0] eq "group"} {
set groupname [lindex $split_arg 1]
addgroup $groupname
lappend args($cur) gid=[existsgroup $groupname]
@@ -2657,7 +2657,7 @@
close $fd
file delete -force $tempdir
}
- if {$metadata_type == "contents"} {
+ if {$metadata_type eq "contents"} {
set contents {}
set ignore 0
set sep [file separator]
@@ -2673,7 +2673,7 @@
}
}
return $contents
- } elseif {$metadata_type == "portname"} {
+ } elseif {$metadata_type eq "portname"} {
foreach line [split $raw_contents \n] {
if {[lindex $line 0] == "@portname"} {
return [lindex $line 1]
@@ -2738,7 +2738,7 @@
set archs ""
set base_arch ""
foreach arch ${configure.universal_archs} {
- if [file exists "${base}/${arch}"] {
+ if {[file exists "${base}/${arch}"]} {
set archs [concat ${archs} ${arch}]
set base_arch ${arch}
}
@@ -2862,7 +2862,7 @@
}
} else {
# not root, so can't set owner/group
- set permissions [lindex $attributes [expr [lsearch $attributes "-permissions"] + 1]]
+ set permissions [lindex $attributes [lsearch $attributes "-permissions"]+1]
file attributes $file -permissions $permissions
}
}
@@ -2915,7 +2915,7 @@
proc validate_macportsuser {} {
global macportsuser
- if {[getuid] == 0 && $macportsuser != "root" &&
+ if {[getuid] == 0 && $macportsuser ne "root" &&
([existsuser $macportsuser] == 0 || [existsgroup $macportsuser] == 0 )} {
ui_warn "configured user/group $macportsuser does not exist, will build as root"
set macportsuser "root"
@@ -2956,7 +2956,7 @@
set i [string first . $depline]
if {$i < 0} {set i [string length $depline]}
- set depname [string range $depline 0 [expr $i - 1]]
+ set depname [string range $depline 0 $i-1]
set depversion [string range $depline $i end]
regsub {\.} $depversion {\.} depversion
if {${os.platform} == "darwin"} {
@@ -2992,7 +2992,7 @@
regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
- if {[string index $search_path 0] != "/"} {
+ if {[string index $search_path 0] ne "/"} {
# Prepend prefix if not an absolute path
set search_path "${prefix}/${search_path}"
}
@@ -3023,7 +3023,7 @@
set depfile [_pathtest $depspec 1]
}
}
- if {$depfile == ""} {
+ if {$depfile eq ""} {
return $portname
} else {
set theport [registry_file_registered $depfile]
@@ -3038,7 +3038,7 @@
# returns the list of archs that the port is targeting
proc get_canonical_archs {} {
global supported_archs os.arch configure.build_arch configure.universal_archs
- if {$supported_archs == "noarch"} {
+ if {$supported_archs eq "noarch"} {
return "noarch"
} elseif {[variant_exists universal] && [variant_isset universal]} {
return [lsort -ascii ${configure.universal_archs}]
@@ -3056,7 +3056,7 @@
return -code error "archflags do not exist for tool '$tool'"
}
} else {
- if {$tool == "cc"} {
+ if {$tool eq "cc"} {
set tool c
}
if {[catch {option configure.universal_${tool}flags} flags]} {
@@ -3069,7 +3069,7 @@
# check that the selected archs are supported
proc check_supported_archs {} {
global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs subport
- if {$supported_archs == "noarch"} {
+ if {$supported_archs eq "noarch"} {
return 0
} elseif {[variant_exists universal] && [variant_isset universal]} {
if {[llength ${configure.universal_archs}] > 1 || $universal_archs == ${configure.universal_archs}} {
@@ -3078,7 +3078,7 @@
ui_error "$subport cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
return 1
}
- } elseif {$build_arch == "" || ${configure.build_arch} != ""} {
+ } elseif {$build_arch eq "" || ${configure.build_arch} != ""} {
return 0
}
ui_error "$subport cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
@@ -3122,7 +3122,7 @@
set rec 5.0.1
}
}
- if {$xcodeversion == "none"} {
+ if {$xcodeversion eq "none"} {
ui_warn "Xcode does not appear to be installed; most ports will likely fail to build."
if {[file exists "/Applications/Install Xcode.app"]} {
ui_warn "You downloaded Xcode from the Mac App Store but didn't install it. Run \"Install Xcode\" in the /Applications folder."
@@ -3183,13 +3183,13 @@
return 0
}
- if {[find_portarchive_path] != ""} {
+ if {[find_portarchive_path] ne ""} {
set archive_available_result 1
return 1
}
set archiverootname [file rootname [get_portimage_name]]
- if {[file rootname [file tail $porturl]] == $archiverootname && [file extension $porturl] != ""} {
+ if {[file rootname [file tail $porturl]] eq $archiverootname && [file extension $porturl] ne ""} {
set archive_available_result 1
return 1
}
@@ -3211,7 +3211,7 @@
# look for and strip off any tag, which will start with the first colon after the
# first slash after the ://
set lastcolon [string last : $sites_entry]
- set aftersep [expr [string first : $sites_entry] + 3]
+ set aftersep [expr {[string first : $sites_entry] + 3}]
set firstslash [string first / $sites_entry $aftersep]
if {$firstslash != -1 && $firstslash < $lastcolon} {
incr lastcolon -1
@@ -3219,7 +3219,7 @@
} else {
set site $sites_entry
}
- if {[string index $site end] != "/"} {
+ if {[string index $site end] ne "/"} {
append site "/[option archive.subdir]"
} else {
append site [option archive.subdir]
Modified: trunk/base/src/port1.0/tests/test.tcl
===================================================================
--- trunk/base/src/port1.0/tests/test.tcl 2014-01-25 16:52:01 UTC (rev 116448)
+++ trunk/base/src/port1.0/tests/test.tcl 2014-01-25 16:57:17 UTC (rev 116449)
@@ -15,7 +15,7 @@
}
proc print_help {arg} {
- if { $arg == "tests" } {
+ if { $arg eq "tests" } {
puts "The list of available tests is:"
cd tests
set test_suite [glob *.test]
@@ -34,11 +34,11 @@
# Process args
foreach arg $argv {
- if { $arg == "-h" || $arg == "-help" } {
+ if { $arg eq "-h" || $arg eq "-help" } {
print_help ""
exit 0
- } elseif { $arg == "-debug" } {
- set index [expr [lsearch $argv $arg] + 1]
+ } elseif { $arg eq "-debug" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
set level [lindex $argv $index]
if { $level >= 0 && $level <= 3 } {
append arguments "-debug " $level
@@ -46,32 +46,32 @@
puts "Invalid debug level."
exit 1
}
- } elseif { $arg == "-t" } {
- set index [expr [lsearch $argv $arg] + 1]
+ } elseif { $arg eq "-t" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
set test_name [lindex $argv $index]
set no 0
cd tests
set test_suite [glob *.test]
foreach test $test_suite {
if { $test_name != $test } {
- set no [expr $no + 1]
+ set no [expr {$no + 1}]
}
}
if { $no == [llength $test_suite] } {
print_help tests
exit 1
}
- } elseif { $arg == "-l" } {
+ } elseif { $arg eq "-l" } {
print_help tests
exit 0
- } elseif { $arg == "-nocolor" } {
+ } elseif { $arg eq "-nocolor" } {
set color_out "no"
}
}
# Run tests
-if { $test_name != ""} {
+if { $test_name ne ""} {
set result [eval exec $tcl $test_name $arguments 2>@stderr]
puts $result
@@ -104,7 +104,7 @@
if { $fail != 0 } { set err "yes" }
set out ""
- if { ($fail != 0 || $skip != 0) && $color_out == "" } {
+ if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
# Color failed tests.
append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " \x1b\[0m" $test
} else {
@@ -119,13 +119,13 @@
puts $out
}
if { $fail != 0 } {
- set end [expr [string first $test $result 0] - 1]
+ set end [expr {[string first $test $result 0] - 1}]
puts [string range $result 0 $end]
}
}
}
# Return 1 if errors were found.
-if {$err != ""} { exit 1 }
+if {$err ne ""} { exit 1 }
return 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140125/67d9590c/attachment-0001.html>
More information about the macports-changes
mailing list