Changeset 116449


Ignore:
Timestamp:
Jan 25, 2014, 4:57:17 PM (7 years ago)
Author:
cal@…
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
Location:
trunk/base/src/port1.0
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/fetch_common.tcl

    r114454 r116449  
    4949proc portfetch::percent_encode {str} {
    5050    set outstr ""
    51     while {[string length $str] > 0} {
     51    while {$str ne ""} {
    5252        set char [string index $str 0]
    5353        set str [string range $str 1 end]
     
    7676# return it.
    7777proc portfetch::assemble_url {site distfile} {
    78     if {[string index $site end] != "/"} {
     78    if {[string index $site end] ne "/"} {
    7979        append site /
    8080    }
     
    107107        # first slash after the ://
    108108        set lastcolon [string last : $element]
    109         set aftersep [expr [string first : $element] + 3]
     109        set aftersep [expr {[string first : $element] + 3}]
    110110        set firstslash [string first / $element $aftersep]
    111111        if {$firstslash != -1 && $firstslash < $lastcolon} {
    112             set mirror_tag [string range $element [expr $lastcolon + 1] end]
    113             set element [string range $element 0 [expr $lastcolon - 1]]
     112            set mirror_tag [string range $element $lastcolon+1 end]
     113            set element [string range $element 0 $lastcolon-1]
    114114        } else {
    115115            set mirror_tag ""
     
    123123        }
    124124
    125         if {$mirror_tag == "mirror"} {
     125        if {$mirror_tag eq "mirror"} {
    126126            set thesubdir ${dist_subdir}
    127         } elseif {$subdir == "" && $mirror_tag != "nosubdir"} {
     127        } elseif {$subdir eq "" && $mirror_tag ne "nosubdir"} {
    128128            set thesubdir ${name}
    129129        } else {
     
    193193        foreach site $site_list {
    194194            if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag] && ![info exists extras_added($tag)]} {
    195                 if {$sglobal != ""} {
     195                if {$sglobal ne ""} {
    196196                    set site_list [concat $site_list [mirror_sites $sglobal $tag "" $mirrorfile]]
    197197                }
    198                 if {$sfallback != ""} {
     198                if {$sfallback ne ""} {
    199199                    set site_list [concat $site_list [mirror_sites $sfallback $tag "" $mirrorfile]]
    200200                }
     
    248248
    249249        foreach site $urllist {
    250             if {[string range $site 0 6] == "file://"} {
     250            if {[string range $site 0 6] eq "file://"} {
    251251                set pingtimes(localhost) 0
    252252                continue
     
    300300        set pinglist {}
    301301        foreach site $urllist {
    302             if {[string range $site 0 6] == "file://"} {
     302            if {[string range $site 0 6] eq "file://"} {
    303303                set host localhost
    304304            } else {
  • trunk/base/src/port1.0/portbuild.tcl

    r110223 r116449  
    7070        return
    7171    }
    72     if {[option build.type] == "bsd" && [option os.platform] == "darwin"} {
     72    if {[option build.type] eq "bsd" && [option os.platform] eq "darwin"} {
    7373        ui_debug "build.type is BSD, adding bin:bsdmake:bsdmake build dependency"
    7474        depends_build-delete bin:bsdmake:bsdmake
    7575        depends_build-append bin:bsdmake:bsdmake
    7676    }
    77     if {[option build.type] == "gnu" && [option os.platform] == "freebsd"} {
     77    if {[option build.type] eq "gnu" && [option os.platform] eq "freebsd"} {
    7878        ui_debug "build.type is GNU, adding bin:gmake:gmake build dependency"
    7979        depends_build-delete bin:gmake:gmake
     
    8888
    8989proc portbuild::build_getmaketype {args} {
    90     if {[option build.type] == "default"} {
     90    if {[option build.type] eq "default"} {
    9191        return [findBinary make $portutil::autoconf::make_path]
    9292    }
    9393    switch -exact -- [option build.type] {
    9494        bsd {
    95             if {[option os.platform] == "darwin"} {
     95            if {[option os.platform] eq "darwin"} {
    9696                return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
    97             } elseif {[option os.platform] == "freebsd"} {
     97            } elseif {[option os.platform] eq "freebsd"} {
    9898                return [findBinary make $portutil::autoconf::make_path]
    9999            } else {
     
    102102        }
    103103        gnu {
    104             if {[option os.platform] == "darwin"} {
     104            if {[option os.platform] eq "darwin"} {
    105105                return [findBinary gnumake $portutil::autoconf::gnumake_path]
    106             } elseif {[option os.platform] == "linux"} {
     106            } elseif {[option os.platform] eq "linux"} {
    107107                return [findBinary make $portutil::autoconf::make_path]
    108108            } else {
     
    112112        pbx -
    113113        xcode {
    114             if {[option os.platform] != "darwin"} {
     114            if {[option os.platform] ne "darwin"} {
    115115                return -code error "[format [msgcat::mc "This port requires 'xcodebuild', which is not available on %s."] [option os.platform]]"
    116116            }
    117117
    118118            global xcodebuildcmd
    119             if {$xcodebuildcmd != "none"} {
     119            if {$xcodebuildcmd ne "none"} {
    120120                return $xcodebuildcmd
    121121            } else {
     
    141141        }
    142142        if {[info exists memsize] && $jobs > $memsize / 1000000000 + 1} {
    143             set jobs [expr $memsize / 1000000000 + 1]
     143            set jobs [expr {$memsize / 1000000000 + 1}]
    144144        }
    145145    }
     
    151151
    152152proc portbuild::build_getargs {args} {
    153     if {(([option build.type] == "default" && [option os.platform] != "freebsd") || \
    154          ([option build.type] == "gnu")) \
     153    if {(([option build.type] eq "default" && [option os.platform] ne "freebsd") || \
     154         ([option build.type] eq "gnu")) \
    155155        && [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option build.cmd]]} {
    156156        # Print "Entering directory" lines for better log debugging
  • trunk/base/src/port1.0/portchecksum.tcl

    r111325 r116449  
    8383
    8484    if {[llength $all_dist_files] == 1
    85         && [expr $nb_checksum % 2] == 0
    86         && [expr $nb_checksum / 2] <= $checksum_types_count
     85        && [expr {$nb_checksum % 2}] == 0
     86        && [expr {$nb_checksum / 2}] <= $checksum_types_count
    8787        && [lsearch -exact $checksum_types [lindex $checksums_str 0]] >= 0} {
    8888        # Convert to format #2
     
    227227    # if everything is fine with the syntax, keep on and check the checksum of
    228228    # the distfiles.
    229     if {[parse_checksums $checksums_str] == "yes"} {
     229    if {[parse_checksums $checksums_str] eq "yes"} {
    230230        set distpath [option distpath]
    231231
     
    269269                    ui_debug "[format [msgcat::mc "Calculated (%s) is %s"] $type $calculated_sum]"
    270270
    271                     if {[string equal $sum $calculated_sum]} {
     271                    if {$sum eq $calculated_sum} {
    272272                        ui_debug "[format [msgcat::mc "Correct (%s) checksum for %s"] $type $distfile]"
    273273                    } else {
  • trunk/base/src/port1.0/portclean.tcl

    r106617 r116449  
    6868    }
    6969
    70     if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
    71         [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
     70    if {[info exists ports_clean_all] && $ports_clean_all eq "yes" || \
     71        [info exists ports_clean_dist] && $ports_clean_dist eq "yes"} {
    7272        ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option subport]]"
    7373        clean_dist
    7474    }
    75     if {([info exists ports_clean_all] && $ports_clean_all == "yes" || \
    76         [info exists ports_clean_archive] && $ports_clean_archive == "yes")
     75    if {([info exists ports_clean_all] && $ports_clean_all eq "yes" || \
     76        [info exists ports_clean_archive] && $ports_clean_archive eq "yes")
    7777        && !$usealtworkpath} {
    7878        ui_info "$UI_PREFIX [format [msgcat::mc "Removing temporary archives for %s"] [option subport]]"
    7979        clean_archive
    8080    }
    81     if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
    82         [info exists ports_clean_work] && $ports_clean_work == "yes" || \
    83         [info exists ports_clean_archive] && $ports_clean_archive == "yes" || \
    84         [info exists ports_clean_dist] && $ports_clean_dist == "yes" || \
    85         !([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
     81    if {[info exists ports_clean_all] && $ports_clean_all eq "yes" || \
     82        [info exists ports_clean_work] && $ports_clean_work eq "yes" || \
     83        [info exists ports_clean_archive] && $ports_clean_archive eq "yes" || \
     84        [info exists ports_clean_dist] && $ports_clean_dist eq "yes" || \
     85        !([info exists ports_clean_logs] && $ports_clean_logs eq "yes")} {
    8686         ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
    8787         clean_work
    8888    }
    89     if {(([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no"))
     89    if {(([info exists ports_clean_logs] && $ports_clean_logs eq "yes") || ($keeplogs eq "no"))
    9090        && !$usealtworkpath} {
    9191        clean_logs
     
    166166    set dirlist [list]
    167167    if {$dist_subdir != $name} {
    168         if {!([info exists ports_force] && $ports_force == "yes")
     168        if {!([info exists ports_force] && $ports_force eq "yes")
    169169            && [file isdirectory $distpath]
    170170            && [llength [readdir $distpath]] > 0} {
     
    292292            # thus can't be checked and aren't useful anyway.
    293293            set archivetype [string range [file extension $path] 1 end]
    294             if {[file isfile $path] && ($archivetype == "TMP"
     294            if {[file isfile $path] && ($archivetype eq "TMP"
    295295                || [extract_archive_metadata $path $archivetype portname] == $subport)} {
    296296                ui_debug "Removing archive: $path"
  • trunk/base/src/port1.0/portconfigure.tcl

    r116439 r116449  
    247247        # Create ccache directory with correct permissions with root privileges
    248248        elevateToRoot "configure ccache"
    249         if [catch {
     249        if {[catch {
    250250                file mkdir ${ccache_dir}
    251251                file attributes ${ccache_dir} -owner ${macportsuser} -permissions 0755
    252             } result] {
     252            } result]} {
    253253            ui_warn "ccache_dir ${ccache_dir} could not be created; disabling ccache: $result"
    254254            set configure.ccache no
     
    258258        # Initialize ccache directory with the given maximum size
    259259        if {${configure.ccache}} {
    260             if [catch {
     260            if {[catch {
    261261                exec ccache -M ${ccache_size} >/dev/null
    262             } result] {
     262            } result]} {
    263263                ui_warn "ccache_dir ${ccache_dir} could not be initialized; disabling ccache: $result"
    264264                set configure.ccache no
     
    273273proc portconfigure::choose_supported_archs {archs} {
    274274    global supported_archs
    275     if {$supported_archs == ""} {
     275    if {$supported_archs eq ""} {
    276276        return $archs
    277277    }
     
    355355    set flags ""
    356356    foreach arch ${configure.universal_archs} {
    357         if {$flags == ""} {
     357        if {$flags eq ""} {
    358358            set flags "-arch $arch"
    359359        } else {
     
    398398
    399399proc portconfigure::compiler_is_port {compiler} {
    400     return [expr {[portconfigure::compiler_port_name ${compiler}] != ""}]
     400    return [expr {[portconfigure::compiler_port_name ${compiler}] ne ""}]
    401401}
    402402
     
    432432    if {[info exists default_compilers]} {
    433433        return $default_compilers
    434     } elseif {$xcodeversion == "none" || $xcodeversion == ""} {
     434    } elseif {$xcodeversion eq "none" || $xcodeversion eq ""} {
    435435        return {cc}
    436436    } elseif {[vercmp $xcodeversion 5.0] >= 0} {
     
    745745
    746746        # Add flags to specify C++ STL implementation
    747         if {${configure.cxx_stdlib} ne {} && [string match *clang* [option configure.cxx]]} {
     747        if {${configure.cxx_stdlib} ne {} && [string match "*clang*" [option configure.cxx]]} {
    748748            append_to_environment_value configure CXXFLAGS -stdlib=${configure.cxx_stdlib}
    749749            append_to_environment_value configure OBJCXXFLAGS -stdlib=${configure.cxx_stdlib}
  • trunk/base/src/port1.0/portdestroot.tcl

    r107465 r116449  
    9494
    9595proc portdestroot::destroot_getargs {args} {
    96     if {(([option build.type] == "default" && [option os.platform] != "freebsd") || \
    97          ([option build.type] == "gnu")) \
     96    if {(([option build.type] eq "default" && [option os.platform] ne "freebsd") || \
     97         ([option build.type] eq "gnu")) \
    9898        && [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option destroot.cmd]]} {
    9999        # Print "Entering directory" lines for better log debugging
     
    164164
    165165    foreach fileToDelete {share/info/dir lib/charset.alias} {
    166         if [file exists "${destroot}${prefix}/${fileToDelete}"] {
     166        if {[file exists "${destroot}${prefix}/${fileToDelete}"]} {
    167167            ui_debug "Deleting stray ${fileToDelete} file."
    168168            file delete "${destroot}${prefix}/${fileToDelete}"
     
    173173    ui_debug "Fixing glibtool .la files in destroot for ${subport}"
    174174    fs-traverse -depth fullpath ${destroot} {
    175         if {[file extension $fullpath] == ".la" && [file type $fullpath] == "file"} {
     175        if {[file extension $fullpath] eq ".la" && [file type $fullpath] eq "file"} {
    176176            # Make sure it is from glibtool ... "a libtool library file" will appear in the first line
    177177            if {![catch {set fp [open $fullpath]}]} {
     
    202202    }
    203203    fs-traverse -depth dir ${destroot} {
    204         if {[file type $dir] == "directory"} {
     204        if {[file type $dir] eq "directory"} {
    205205            catch {file delete $dir}
    206206        }
     
    222222    set gunzip "$gzip -d"
    223223    set bunzip2 "[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d"
    224     if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} {
     224    if {[file isdirectory ${manpath}] && [file type ${manpath}] eq "directory"} {
    225225        ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${subport}]"
    226226        set found 0
     
    229229            if {![regexp {^(cat|man)(.)$} ${mandir} match ignore manindex]} { continue }
    230230            set mandirpath [file join ${manpath} ${mandir}]
    231             if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] == "directory"} {
     231            if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] eq "directory"} {
    232232                ui_debug "Scanning ${mandir}"
    233233                foreach manfile [readdir ${mandirpath}] {
    234234                    set manfilepath [file join ${mandirpath} ${manfile}]
    235                     if {[file isfile ${manfilepath}] && [file type ${manfilepath}] == "file"} {
     235                    if {[file isfile ${manfilepath}] && [file type ${manfilepath}] eq "file"} {
    236236                        if {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$" ${manfile} gzfile manfile]} {
    237237                            set found 1
     
    259259                            }
    260260                        }
    261                     } elseif {[file type ${manfilepath}] == "link"} {
     261                    } elseif {[file type ${manfilepath}] eq "link"} {
    262262                        lappend manlinks [file join ${mandir} ${manfile}]
    263263                    }
     
    337337                        }
    338338                    }
    339                 } elseif {[string equal -length [expr [string length $dfile] + 1] $dfile/ $prefix]} {
     339                } elseif {[string equal -length [expr {[string length $dfile] + 1}] $dfile/ $prefix]} {
    340340                    # we've found a subpath of our prefix
    341341                    lpush pathsToCheck $dfile
     
    344344                    # these files are (at least potentially) outside of the prefix
    345345                    foreach dir "$applications_dir $frameworks_dir /Library/LaunchAgents /Library/LaunchDaemons /Library/StartupItems" {
    346                         if {[string equal -length [expr [string length $dfile] + 1] $dfile/ $dir]} {
     346                        if {[string equal -length [expr {[string length $dfile] + 1}] $dfile/ $dir]} {
    347347                            # it's a prefix of one of the allowed paths
    348348                            set dir_allowed yes
  • trunk/base/src/port1.0/portdistcheck.tcl

    r106614 r116449  
    6262
    6363    set curl_options {}
    64     if [tbool fetch.ignore_sslcert] {
     64    if {[tbool fetch.ignore_sslcert]} {
    6565        lappend curl_options "--ignore-ssl-cert"
    6666    }
     
    128128                set humansize "${size}"
    129129            } elseif {$totalsize < 1024*1024} {
    130                 set size [expr $totalsize / 1024.0]
     130                set size [expr {$totalsize / 1024.0}]
    131131                set humansize [format "%.1fK" $size]
    132132            } elseif {$totalsize < 1024*1024*1024} {
    133                 set size [expr $totalsize / (1024.0*1024.0)]
     133                set size [expr {$totalsize / (1024.0*1024.0)}]
    134134                set humansize [format "%.1fM" $size]
    135135            } else {
    136                 set size [expr $totalsize / (1024.0*1024.0*1024.0)]
     136                set size [expr {$totalsize / (1024.0*1024.0*1024.0)}]
    137137                set humansize [format "%.1fG" $size]
    138138            }
  • trunk/base/src/port1.0/portdistfiles.tcl

    r84172 r116449  
    5858   
    5959    # give up on ports that do not provide URLs
    60     if {(![info exists master_sites] || $master_sites == "{}")
    61         && (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites == "{}")} {
     60    if {(![info exists master_sites] || $master_sites eq "{}")
     61        && (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites eq "{}")} {
    6262        return 0
    6363    }
     
    8282
    8383        # print checksums if available
    84         if {$result == "yes" && [array get checksums_array $distfile] != ""} {
     84        if {$result eq "yes" && [array get checksums_array $distfile] ne ""} {
    8585            foreach {type sum} $checksums_array($distfile) {
    8686                ui_msg " $type: $sum"
  • trunk/base/src/port1.0/portfetch.tcl

    r114652 r116449  
    171171    global os.platform os.major
    172172    if {[string equal ${action} "set"]} {
    173         if {$args != "standard"} {
     173        if {$args ne "standard"} {
    174174            distfiles
    175175        }
     
    231231                set file [getdistname $file]
    232232                lappend all_dist_files $file
    233                 if {$distsite != ""} {
     233                if {$distsite ne ""} {
    234234                    lappend fetch_urls $distsite $file
    235235                } elseif {[info exists patch_sites]} {
     
    254254                set file [getdistname $file]
    255255                lappend all_dist_files $file
    256                 if {$distsite != ""} {
     256                if {$distsite ne ""} {
    257257                    lappend fetch_urls $distsite $file
    258258                } else {
     
    391391    regexp {(.*://)?([[:alnum:].-]+)(:(\d+))?} $proxy_str - - proxy_host - proxy_port
    392392    set ret "--config-option servers:global:http-proxy-host=${proxy_host}"
    393     if {$proxy_port != ""} {
     393    if {$proxy_port ne ""} {
    394394        append ret " --config-option servers:global:http-proxy-port=${proxy_port}"
    395395    }
     
    502502        lappend fetch_options "--remote-time"
    503503    }
    504     if {$portverbose == "yes"} {
     504    if {$portverbose eq "yes"} {
    505505        lappend fetch_options "-v"
    506506    }
  • trunk/base/src/port1.0/portinstall.tcl

    r106617 r116449  
    239239    set vlist [lsort -ascii [array names ourvariations]]
    240240    foreach v $vlist {
    241         if {$ourvariations($v) == "+"} {
     241        if {$ourvariations($v) eq "+"} {
    242242            puts $fd "@portvariant +${v}"
    243243        }
     
    264264    set installPlist {}
    265265    fs-traverse -depth fullpath $destpath {
    266         if {[file type $fullpath] == "directory"} {
     266        if {[file type $fullpath] eq "directory"} {
    267267            continue
    268268        }
     
    311311
    312312    set oldpwd [pwd]
    313     if {$oldpwd == ""} {
     313    if {$oldpwd eq ""} {
    314314        set oldpwd $portpath
    315315    }
     
    317317    set location [get_portimage_path]
    318318    set archive_path [find_portarchive_path]
    319     if {$archive_path != ""} {
     319    if {$archive_path ne ""} {
    320320        set install_dir [file dirname $location]
    321321        file mkdir $install_dir
     
    337337            foreach dep [set $deplist] {
    338338                set dep_portname [_get_dep_port $dep]
    339                 if {$dep_portname != ""} {
     339                if {$dep_portname ne ""} {
    340340                    lappend dep_portnames $dep_portname
    341341                }
     
    357357        $regref archs [get_canonical_archs]
    358358        # Trick to have a portable GMT-POSIX epoch-based time.
    359         $regref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]]
     359        $regref date [expr {[clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]}]
    360360        if {[info exists negated_variants]} {
    361361            $regref negated_variants $negated_variants
  • trunk/base/src/port1.0/portlint.tcl

    r113135 r116449  
    139139                seek $f -1 end
    140140                set last [read $f 1]
    141                 if {![string match "\n" $last]} {
     141                if {"\n" ne $last} {
    142142                    ui_warn "Line $lineno has missing newline (at end of file)"
    143143                    incr warnings
     
    154154        }
    155155
    156         if {($require_after == "PortSystem" || $require_after == "PortGroup") && \
     156        if {($require_after eq "PortSystem" || $require_after eq "PortGroup") && \
    157157            [string match "PortGroup*" $line]} {
    158158            set require_blank false
    159159        }
    160160
    161         if {$nitpick && $require_blank && ($line != "")} {
     161        if {$nitpick && $require_blank && ($line ne "")} {
    162162            ui_warn "Line $lineno should be a newline (after $require_after)"
    163163            incr warnings
     
    229229            set in_description true
    230230        }
    231         if {$in_description && ([string range $line end end] != "\\")} {
     231        if {$in_description && ([string range $line end end] ne "\\")} {
    232232            set in_description false
    233233            #set require_blank true
     
    246246        if {[string match "platform\[ \t\]*" $line]} {
    247247            regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -> platform_arch
    248             if {$platform_arch == "ppc"} {
     248            if {$platform_arch eq "ppc"} {
    249249                ui_error "Arch 'ppc' in platform on line $lineno should be 'powerpc'"
    250250                incr errors
     
    335335    foreach req_var $lint_required {
    336336
    337         if {$req_var == "master_sites"} {
     337        if {$req_var eq "master_sites"} {
    338338            if {${fetch.type} != "standard"} {
    339339                ui_info "OK: $req_var not required for fetch.type ${fetch.type}"
     
    402402        set variantname [ditem_key $variant name]
    403403        set variantdesc [lindex [ditem_key $variant description] 0]
    404         if {![info exists variantname] || $variantname == ""} {
     404        if {![info exists variantname] || $variantname eq ""} {
    405405            ui_error "Variant number $variantnumber does not have a name"
    406406            incr errors
     
    415415            }
    416416
    417             if {![info exists variantdesc] || $variantdesc == ""} {
     417            if {![info exists variantdesc] || $variantdesc eq ""} {
    418418                # don't warn about missing descriptions for global variants
    419419                if {[lsearch -exact $local_variants $variantname] != -1 &&
    420                     [variant_desc $porturl $variantname] == ""} {
     420                    [variant_desc $porturl $variantname] eq ""} {
    421421                    ui_warn "Variant $variantname does not have a description"
    422422                    incr warnings
    423423                    set desc_ok false
    424                 } elseif {$variantdesc == ""} {
     424                } elseif {$variantdesc eq ""} {
    425425                    set variantdesc "(pre-defined variant)"
    426426                }
    427427            } else {
    428                 if {[variant_desc $porturl $variantname] != ""} {
     428                if {[variant_desc $porturl $variantname] ne ""} {
    429429                    ui_warn "Variant $variantname overrides global description"
    430430                    incr warnings
     
    471471            continue
    472472        }
    473         if {$res == ""} {
     473        if {$res eq ""} {
    474474            ui_error "Unknown dependency: $dep"
    475475            incr errors
     
    510510            ui_warn "Using full email address for no/open maintainer"
    511511            incr warnings
    512         } elseif [regexp "^(.+)@macports.org$" $addr -> localpart] {
     512        } elseif {[regexp "^(.+)@macports.org$" $addr -> localpart]} {
    513513            ui_warn "Maintainer email address for $localpart includes @macports.org"
    514514            incr warnings
     
    516516            ui_warn "Using legacy email address for no/open maintainer"
    517517            incr warnings
    518         } elseif [regexp "^(.+)@(.+)$" $addr -> localpart domain] {
     518        } elseif {[regexp "^(.+)@(.+)$" $addr -> localpart domain]} {
    519519            ui_warn "Maintainer email address should be obfuscated as $domain:$localpart"
    520520            incr warnings
     
    522522    }
    523523
    524     if {$license == "unknown"} {
     524    if {$license eq "unknown"} {
    525525        ui_warn "no license set"
    526526        incr warnings
     
    548548                        # then a hyphen is missing
    549549                        set license_end [string index $subtest end]
    550                         if {[string equal "+" $license_end] || [string is integer -strict $license_end]} {
     550                        if {"+" eq $license_end || [string is integer -strict $license_end]} {
    551551                            ui_error "invalid license '${test}': missing hyphen before version"
    552552                        }
     
    602602
    603603        if {$refcount > 0} {
    604             if {$newoption != ""} {
     604            if {$newoption ne ""} {
    605605                ui_warn "Using deprecated option '$option', superseded by '$newoption'"
    606606            } else {
     
    623623    set svn_cmd ""
    624624    catch {set svn_cmd [findBinary svn]}
    625     if {$svn_cmd != "" && ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath > /dev/null 2>@1}])} {
     625    if {$svn_cmd ne "" && ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath > /dev/null 2>@1}])} {
    626626        ui_debug "Checking svn properties"
    627         if [catch {exec $svn_cmd propget svn:keywords $portfile 2>@1} output] {
     627        if {[catch {exec $svn_cmd propget svn:keywords $portfile 2>@1} output]} {
    628628            ui_warn "Unable to check for svn:keywords property: $output"
    629629        } else {
    630630            ui_debug "Property svn:keywords is \"$output\", should be \"Id\""
    631             if {$output != "Id"} {
     631            if {$output ne "Id"} {
    632632                ui_error "Missing subversion property on Portfile, please execute: svn ps svn:keywords Id Portfile"
    633633                incr errors
    634634            }
    635635        }
    636         if [catch {exec $svn_cmd propget svn:eol-style $portfile 2>@1} output] {
     636        if {[catch {exec $svn_cmd propget svn:eol-style $portfile 2>@1} output]} {
    637637            ui_warn "Unable to check for svn:eol-style property: $output"
    638638        } else {
    639639            ui_debug "Property svn:eol-style is \"$output\", should be \"native\""
    640             if {$output != "native"} {
     640            if {$output ne "native"} {
    641641                ui_error "Missing subversion property on Portfile, please execute: svn ps svn:eol-style native Portfile"
    642642                incr errors
  • trunk/base/src/port1.0/portlivecheck.tcl

    r106614 r116449  
    7878
    7979    set curl_options {}
    80     if [tbool livecheck.ignore_sslcert] {
     80    if {[tbool livecheck.ignore_sslcert]} {
    8181        lappend curl_options "--ignore-ssl-cert"
    8282    }
     
    100100                    set subdirs [split $subdir /]
    101101                    if {[llength $subdirs] > 1} {
    102                         if {[lindex $subdirs 0] == "project"} {
     102                        if {[lindex $subdirs 0] eq "project"} {
    103103                            set subdir [lindex $subdirs 1]
    104104                        } else {
  • trunk/base/src/port1.0/portload.tcl

    r103400 r116449  
    5454
    5555    foreach { path } "/Library/${startupitem.location}/${startupitem.plist}" {
    56         if {[string length $launchctl_path] == 0} {
     56        if {$launchctl_path eq ""} {
    5757            return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
    5858        } elseif {![file exists $path]} {
  • trunk/base/src/port1.0/portmain.tcl

    r113704 r116449  
    8181proc portmain::get_subbuildpath {} {
    8282    global portpath portbuildpath subport
    83     if {$subport != ""} {
     83    if {$subport ne ""} {
    8484        set subdir $subport
    8585    } else {
     
    121121
    122122set macosx_version_text {}
    123 if {[option os.platform] == "darwin"} {
     123if {[option os.platform] eq "darwin"} {
    124124    set macosx_version_text "(Mac OS X ${macosx_version}) "
    125125}
     
    129129
    130130# sub-platforms of darwin
    131 if {[option os.platform] == "darwin"} {
     131if {[option os.platform] eq "darwin"} {
    132132    if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
    133133        default os.subplatform macosx
  • trunk/base/src/port1.0/portmirror.tcl

    r79593 r116449  
    5959    if {![info exists mirror_filemap]
    6060        && [info exists ports_mirror_new]
    61         && $ports_mirror_new == "yes"
     61        && $ports_mirror_new eq "yes"
    6262        && [file exists $mirror_filemap_path]} {
    6363        # Trash the map file if it existed.
  • trunk/base/src/port1.0/portpatch.tcl

    r90211 r116449  
    7373
    7474    # First make sure that patchfiles exists and isn't stubbed out.
    75     if {![exists patchfiles] || [option patchfiles] == ""} {
     75    if {![exists patchfiles] || [option patchfiles] eq ""} {
    7676        return 0
    7777    }
  • trunk/base/src/port1.0/portsandbox.tcl

    r107674 r116449  
    3636options portsandbox_supported portsandbox_active portsandbox_profile
    3737default portsandbox_supported {[file executable $portutil::autoconf::sandbox_exec_path]}
    38 default portsandbox_active {[expr $portsandbox_supported && $sandbox_enable]}
     38default portsandbox_active {[expr {$portsandbox_supported && $sandbox_enable}]}
    3939default portsandbox_profile {}
    4040
  • trunk/base/src/port1.0/portstartupitem.tcl

    r106813 r116449  
    232232    puts ${item} "EXECUTABLE=\"${startupitem.executable}\""
    233233    puts ${item} ""
    234     puts ${item} "HAVE_STARTCMDS=[expr [llength ${startupitem.start}] ? "true" : "false"]"
    235     puts ${item} "HAVE_STOPCMDS=[expr [llength ${startupitem.stop}] ? "true" : "false"]"
    236     puts ${item} "HAVE_RESTARTCMDS=[expr [llength ${startupitem.restart}] ? "true" : "false"]"
     234    puts ${item} "HAVE_STARTCMDS=[expr {[llength ${startupitem.start}] ? "true" : "false"}]"
     235    puts ${item} "HAVE_STOPCMDS=[expr {[llength ${startupitem.stop}] ? "true" : "false"}]"
     236    puts ${item} "HAVE_RESTARTCMDS=[expr {[llength ${startupitem.restart}] ? "true" : "false"}]"
    237237    puts ${item} "DELETE_PIDFILE=${createPidFile}"
    238238    puts ${item} "CREATE_PIDFILE=${deletePidFile}"
    239     puts ${item} "LOG_EVENTS=[expr [tbool ${startupitem.logevents}] ? "true" : "false"]"
     239    puts ${item} "LOG_EVENTS=[expr {[tbool ${startupitem.logevents}] ? "true" : "false"}]"
    240240    puts ${item} ""
    241241
  • trunk/base/src/port1.0/porttrace.tcl

    r113024 r116449  
    273273        # Skip empty lines.
    274274        if {$line_length > 0} {
    275             set path_start [expr [string first "\t" $theline] + 1]
    276             set op [string range $theline 0 [expr $path_start - 2]]
    277             set path [string range $theline $path_start [expr $line_length - 1]]
     275            set path_start [expr {[string first "\t" $theline] + 1}]
     276            set op [string range $theline 0 $path_start-2]
     277            set path [string range $theline $path_start $line_length-1]
    278278
    279279            # open/execve
    280             if {$op == "open" || $op == "execve"} {
     280            if {$op eq "open" || $op eq "execve"} {
    281281                # Only work on files.
    282282                if {[file isfile $path]} {
     
    302302                    }
    303303                }
    304             } elseif {$op == "sandbox_violation"} {
     304            } elseif {$op eq "sandbox_violation"} {
    305305                lappend sandbox_violation_list $path
    306306            }
  • trunk/base/src/port1.0/portunload.tcl

    r103400 r116449  
    5454
    5555    foreach { path } "/Library/${startupitem.location}/${startupitem.plist}" {
    56         if {[string length $launchctl_path] == 0} {
     56        if {$launchctl_path eq ""} {
    5757            return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
    5858        } elseif {![file exists $path]} {
  • trunk/base/src/port1.0/portutil.tcl

    r115900 r116449  
    180180        }
    181181        set refcount [lindex $deprecated_options(${option}-replace) 1]
    182         lset deprecated_options(${option}-replace) 1 [expr $refcount + 1]
     182        lset deprecated_options(${option}-replace) 1 [expr {$refcount + 1}]
    183183        return [eval handle_option-strsed $option $args]
    184184    }
     
    253253    global $newoption
    254254
    255     if {$newoption == ""} {
     255    if {$newoption eq ""} {
    256256        ui_warn "Port $subport using deprecated option \"$option\"."
    257257        return
     
    259259
    260260    # Increment reference counter
    261     lset deprecated_options($option) 1 [expr $refcount + 1]
    262 
    263     if {$action != "read"} {
     261    lset deprecated_options($option) 1 [expr {$refcount + 1}]
     262
     263    if {$action ne "read"} {
    264264        $newoption [set $option]
    265265    } else {
     
    385385
    386386    if {[llength $args] > 0} {
    387         if {[lindex $args 0] == "-notty"} {
     387        if {[lindex $args 0] eq "-notty"} {
    388388            set notty "-notty"
    389389            set args [lrange $args 1 end]
    390390        }
    391391
    392         if {[lindex $args 0] == "-varprefix"} {
     392        if {[lindex $args 0] eq "-varprefix"} {
    393393            set varprefix [lindex $args 1]
    394394            set args [lrange $args 2 end]
     
    436436    # Prepare nice value change
    437437    set nice ""
    438     if {[info exists ${varprefix}.nice] && [set ${varprefix}.nice] != ""} {
     438    if {[info exists ${varprefix}.nice] && [set ${varprefix}.nice] ne ""} {
    439439        set nice "-nice [set ${varprefix}.nice]"
    440440    }
     
    530530            foreach arg $args {
    531531                # Strip trailing empty lines
    532                 if {[string index $arg 0] == "\n"} {
     532                if {[string index $arg 0] eq "\n"} {
    533533                    set arg [string range $arg 1 end]
    534534                }
    535                 if {[string index $arg end] == "\n"} {
     535                if {[string index $arg end] eq "\n"} {
    536536                    set arg [string range $arg 0 end-1]
    537537                }
     
    541541                for {set i 0} {$i < [string length $arg]} {incr i} {
    542542                    set c [string index $arg $i]
    543                     if {$c != " " && $c != "\t"} {
     543                    if {$c ne " " && $c ne "\t"} {
    544544                        break
    545545                    }
     
    547547                }
    548548                # Remove indent on first line
    549                 set arg [string replace $arg 0 [expr $i - 1]]
     549                set arg [string replace $arg 0 [expr {$i - 1}]]
    550550                # Remove indent on each other line
    551551                set arg [string map "\"\n$indent\" \"\n\"" $arg]
     
    582582    }
    583583    set code [lindex $args end]
    584     set args [lrange $args 0 [expr $len - 2]]
     584    set args [lrange $args 0 $len-2]
    585585
    586586    set ditem [variant_new "temp-variant"]
     
    630630
    631631        # read global variant description, if none given
    632         if {$vdesc == ""} {
     632        if {$vdesc eq ""} {
    633633            set vdesc [variant_desc $porturl $variant_provides]
    634634        }
     
    669669    global variations
    670670
    671     if {[info exists variations($name)] && $variations($name) == "+"} {
     671    if {[info exists variations($name)] && $variations($name) eq "+"} {
    672672        return 1
    673673    }
     
    732732                set name [lindex $line 0]
    733733                set desc [lindex $line 1]
    734                 if {$name != "" && $desc != ""} {
     734                if {$name ne "" && $desc ne ""} {
    735735                    set variant_descs_global(${descfile}_$name) $desc
    736736                } else {
     
    782782    set code [lindex $args end]
    783783    set os [lindex $args 0]
    784     set args [lrange $args 1 [expr $len - 2]]
     784    set args [lrange $args 1 $len-2]
    785785
    786786    foreach arg $args {
     
    991991        set cmdline $portutil::autoconf::sed_command
    992992        if {$extended} {
    993             if {$portutil::autoconf::sed_ext_flag == "N/A"} {
     993            if {$portutil::autoconf::sed_ext_flag eq "N/A"} {
    994994                ui_debug "sed extended regexp not available"
    995995                return -code error "reinplace sed(1) too old"
     
    10111011            ui_error "reinplace: $error"
    10121012            file delete "$tmpfile"
    1013             if {$locale != ""} {
     1013            if {$locale ne ""} {
    10141014                if {$oldlocale_exists} {
    10151015                    set env(LC_CTYPE) $oldlocale
     
    10251025        }
    10261026
    1027         if {$locale != ""} {
     1027        if {$locale ne ""} {
    10281028            if {$oldlocale_exists} {
    10291029                set env(LC_CTYPE) $oldlocale
     
    10751075# mimics the BSD touch command
    10761076proc touch {args} {
    1077     while {[string match -* [lindex $args 0]]} {
     1077    while {[string match "-*" [lindex $args 0]]} {
    10781078        set arg [string range [lindex $args 0] 1 end]
    10791079        set args [lrange $args 1 end]
     
    10861086                set narg [lindex $args 0]
    10871087                set args [lrange $args 1 end]
    1088                 if {[string length $narg] == 0} {
     1088                if {$narg eq ""} {
    10891089                    return -code error "touch: option requires an argument -- $arg"
    10901090                }
     
    10991099    # parse the r/t options
    11001100    if {[info exists options(rt)]} {
    1101         if {[string equal $options(rt) r]} {
     1101        if {$options(rt) eq "r"} {
    11021102            # -r
    11031103            # get atime/mtime from the file
     
    11141114            set timespec {^(?:(\d\d)?(\d\d))?(\d\d)(\d\d)(\d\d)(\d\d)(?:\.(\d\d))?$}
    11151115            if {[regexp $timespec $options(t) {} CC YY MM DD hh mm SS]} {
    1116                 if {[string length $YY] == 0} {
     1116                if {$YY eq ""} {
    11171117                    set year [clock format [clock seconds] -format %Y]
    1118                 } elseif {[string length $CC] == 0} {
     1118                } elseif {$CC eq ""} {
    11191119                    if {$YY >= 69 && $YY <= 99} {
    11201120                        set year 19$YY
     
    11251125                    set year $CC$YY
    11261126                }
    1127                 if {[string length $SS] == 0} {
     1127                if {$SS eq ""} {
    11281128                    set SS 00
    11291129                }
     
    12051205# ln [-f] [-h] [-s] [-v] source_file ... target_dir
    12061206proc ln {args} {
    1207     while {[string match -* [lindex $args 0]]} {
     1207    while {[string match "-*" [lindex $args 0]]} {
    12081208        set arg [string range [lindex $args 0] 1 end]
    12091209        if {[string length $arg] > 1} {
     
    12311231        set target ./
    12321232    } else {
    1233         set files [lrange $args 0 [expr [llength $args] - 2]]
     1233        set files [lrange $args 0 [llength $args]-2]
    12341234        set target [lindex $args end]
    12351235    }
     
    13581358    set env(TMPDIR) "${workpath}/.tmp"
    13591359
    1360     if {[ditem_key $ditem state] != "no"} {
     1360    if {[ditem_key $ditem state] ne "no"} {
    13611361        set target_state_fd [open_statefile]
    13621362    }
    13631363
    1364     if {$procedure != ""} {
     1364    if {$procedure ne ""} {
    13651365        set targetname [ditem_key $ditem name]
    13661366        set target [ditem_key $ditem provides]
     
    13811381            # Skip the step if required and explain why through ui_debug.
    13821382            # check if the step was already done (as mentioned in the state file)
    1383             if {[ditem_key $ditem state] != "no"
     1383            if {[ditem_key $ditem state] ne "no"
    13841384                    && [check_statefile target $targetname $target_state_fd]} {
    13851385                ui_debug "Skipping completed $targetname ($portname)"
     
    13881388
    13891389            # Of course, if this is a dry run, don't do the task:
    1390             if {[info exists ports_dryrun] && $ports_dryrun == "yes"} {
     1390            if {[info exists ports_dryrun] && $ports_dryrun eq "yes"} {
    13911391                # only one message per portname
    13921392                if {$portname != $ports_dry_last_skipped} {
     
    14731473                    foreach deptype $deptypes {
    14741474                        # Add to the list of dependencies if the option exists and isn't empty.
    1475                         if {[info exists PortInfo($deptype)] && $PortInfo($deptype) != ""} {
     1475                        if {[info exists PortInfo($deptype)] && $PortInfo($deptype) ne ""} {
    14761476                            set depends [concat $depends $PortInfo($deptype)]
    14771477                        }
     
    14861486                        # If portname is empty, the dependency is already satisfied by other means,
    14871487                        # for example a bin: dependency on a file not installed by MacPorts
    1488                         if {$name != ""} {
     1488                        if {$name ne ""} {
    14891489                            if {[lsearch -exact $deplist $name] == -1} {
    14901490                                lappend deplist $name
     
    14951495
    14961496                    # Add ccache port for access to ${prefix}/bin/ccache binary
    1497                     if [option configure.ccache] {
     1497                    if {[option configure.ccache]} {
    14981498                        lappend deplist ccache
    14991499                    }
     
    15811581            # - this step must be written to file
    15821582            if {$skipped == 0
    1583           && [ditem_key $ditem runtype] != "always"
    1584           && [ditem_key $ditem state] != "no"} {
     1583          && [ditem_key $ditem runtype] ne "always"
     1584          && [ditem_key $ditem state] ne "no"} {
    15851585            write_statefile target $targetname $target_state_fd
    15861586            }
     
    15971597    }
    15981598
    1599     if {[ditem_key $ditem state] != "no"} {
     1599    if {[ditem_key $ditem state] ne "no"} {
    16001600        close $target_state_fd
    16011601    }
     
    16401640    # so special-case already-completed install and activate
    16411641    if {[registry_exists $subport $version $revision $portvariants]} {
    1642         if {$target == "install"} {
     1642        if {$target eq "install"} {
    16431643            ui_debug "Skipping $target ($subport) since this port is already installed"
    16441644            return 0
    1645         } elseif {$target == "activate"} {
     1645        } elseif {$target eq "activate"} {
    16461646            set regref [registry_open $subport $version $revision $portvariants ""]
    16471647            if {[registry_prop_retr $regref active] != 0} {
     
    16611661
    16621662    # Select the subset of targets under $target
    1663     if {$target != ""} {
     1663    if {$target ne ""} {
    16641664        set matches [dlist_search $dlist provides $target]
    16651665
     
    16671667            set dlist [dlist_append_dependents $dlist [lindex $matches 0] [list]]
    16681668            # Special-case 'all'
    1669         } elseif {$target != "all"} {
     1669        } elseif {$target ne "all"} {
    16701670            ui_error "unknown target: $target"
    16711671            return 1
     
    19621962        foreach flavor [ditem_key $ditem provides] {
    19631963            if {[info exists upvariations($flavor)]} {
    1964                 if {$upvariations($flavor) == "+"} {
     1964                if {$upvariations($flavor) eq "+"} {
    19651965                    incr pros
    1966                 } elseif {$upvariations($flavor) == "-"} {
     1966                } elseif {$upvariations($flavor) eq "-"} {
    19671967                    incr cons
    19681968                }
     
    21202120    }
    21212121    foreach d $ditems {
    2122         if {[ditem_key $d state] != "no"} {
     2122        if {[ditem_key $d state] ne "no"} {
    21232123            # At least one matching target requires the state file
    21242124            set statereq 1
     
    21272127    }
    21282128    if { $statereq &&
    2129         !([info exists ports_force] && $ports_force == "yes")} {
     2129        !([info exists ports_force] && $ports_force eq "yes")} {
    21302130
    21312131        set state_fd [open_statefile]
     
    21352135            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)."
    21362136            set result 1
    2137         } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
     2137        } elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
    21382138            # Write variations out to the statefile
    21392139            foreach key [array names variations *] {
     
    21902190        set origproc [ditem_key $ditem procedure]
    21912191        set ident [ditem_key $ditem name]
    2192         if {[info commands $target] == ""} {
     2192        if {[info commands $target] eq ""} {
    21932193            proc $target {args} "
    21942194                variable proc_index
     
    23152315    set cur ""
    23162316    foreach val [option add_users] {
    2317         if {[string match *=* $val] && $cur != ""} {
     2317        if {[string match "*=*" $val] && $cur ne ""} {
    23182318            set split_arg [split $val =]
    2319             if {[lindex $split_arg 0] == "group"} {
     2319            if {[lindex $split_arg 0] eq "group"} {
    23202320                set groupname [lindex $split_arg 1]
    23212321                addgroup $groupname
     
    26582658        file delete -force $tempdir
    26592659    }
    2660     if {$metadata_type == "contents"} {
     2660    if {$metadata_type eq "contents"} {
    26612661        set contents {}
    26622662        set ignore 0
     
    26742674        }
    26752675        return $contents
    2676     } elseif {$metadata_type == "portname"} {
     2676    } elseif {$metadata_type eq "portname"} {
    26772677        foreach line [split $raw_contents \n] {
    26782678            if {[lindex $line 0] == "@portname"} {
     
    27392739    set base_arch ""
    27402740    foreach arch ${configure.universal_archs} {
    2741         if [file exists "${base}/${arch}"] {
     2741        if {[file exists "${base}/${arch}"]} {
    27422742            set archs [concat ${archs} ${arch}]
    27432743            set base_arch ${arch}
     
    28632863    } else {
    28642864        # not root, so can't set owner/group
    2865         set permissions [lindex $attributes [expr [lsearch $attributes "-permissions"] + 1]]
     2865        set permissions [lindex $attributes [lsearch $attributes "-permissions"]+1]
    28662866        file attributes $file -permissions $permissions
    28672867    }
     
    29162916proc validate_macportsuser {} {
    29172917    global macportsuser
    2918     if {[getuid] == 0 && $macportsuser != "root" &&
     2918    if {[getuid] == 0 && $macportsuser ne "root" &&
    29192919        ([existsuser $macportsuser] == 0 || [existsgroup $macportsuser] == 0 )} {
    29202920        ui_warn "configured user/group $macportsuser does not exist, will build as root"
     
    29572957    set i [string first . $depline]
    29582958    if {$i < 0} {set i [string length $depline]}
    2959     set depname [string range $depline 0 [expr $i - 1]]
     2959    set depname [string range $depline 0 $i-1]
    29602960    set depversion [string range $depline $i end]
    29612961    regsub {\.} $depversion {\.} depversion
     
    29932993    regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
    29942994
    2995     if {[string index $search_path 0] != "/"} {
     2995    if {[string index $search_path 0] ne "/"} {
    29962996        # Prepend prefix if not an absolute path
    29972997        set search_path "${prefix}/${search_path}"
     
    30243024        }
    30253025    }
    3026     if {$depfile == ""} {
     3026    if {$depfile eq ""} {
    30273027        return $portname
    30283028    } else {
     
    30393039proc get_canonical_archs {} {
    30403040    global supported_archs os.arch configure.build_arch configure.universal_archs
    3041     if {$supported_archs == "noarch"} {
     3041    if {$supported_archs eq "noarch"} {
    30423042        return "noarch"
    30433043    } elseif {[variant_exists universal] && [variant_isset universal]} {
     
    30573057        }
    30583058    } else {
    3059         if {$tool == "cc"} {
     3059        if {$tool eq "cc"} {
    30603060            set tool c
    30613061        }
     
    30703070proc check_supported_archs {} {
    30713071    global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs subport
    3072     if {$supported_archs == "noarch"} {
     3072    if {$supported_archs eq "noarch"} {
    30733073        return 0
    30743074    } elseif {[variant_exists universal] && [variant_isset universal]} {
     
    30793079            return 1
    30803080        }
    3081     } elseif {$build_arch == "" || ${configure.build_arch} != ""} {
     3081    } elseif {$build_arch eq "" || ${configure.build_arch} != ""} {
    30823082        return 0
    30833083    }
     
    31233123            }
    31243124        }
    3125         if {$xcodeversion == "none"} {
     3125        if {$xcodeversion eq "none"} {
    31263126            ui_warn "Xcode does not appear to be installed; most ports will likely fail to build."
    31273127            if {[file exists "/Applications/Install Xcode.app"]} {
     
    31843184    }
    31853185
    3186     if {[find_portarchive_path] != ""} {
     3186    if {[find_portarchive_path] ne ""} {
    31873187        set archive_available_result 1
    31883188        return 1
     
    31903190
    31913191    set archiverootname [file rootname [get_portimage_name]]
    3192     if {[file rootname [file tail $porturl]] == $archiverootname && [file extension $porturl] != ""} {
     3192    if {[file rootname [file tail $porturl]] eq $archiverootname && [file extension $porturl] ne ""} {
    31933193        set archive_available_result 1
    31943194        return 1
     
    32123212    # first slash after the ://
    32133213    set lastcolon [string last : $sites_entry]
    3214     set aftersep [expr [string first : $sites_entry] + 3]
     3214    set aftersep [expr {[string first : $sites_entry] + 3}]
    32153215    set firstslash [string first / $sites_entry $aftersep]
    32163216    if {$firstslash != -1 && $firstslash < $lastcolon} {
     
    32203220        set site $sites_entry
    32213221    }
    3222     if {[string index $site end] != "/"} {
     3222    if {[string index $site end] ne "/"} {
    32233223        append site "/[option archive.subdir]"
    32243224    } else {
  • trunk/base/src/port1.0/tests/test.tcl

    r111372 r116449  
    1616
    1717proc print_help {arg} {
    18     if { $arg == "tests" } {
     18    if { $arg eq "tests" } {
    1919        puts "The list of available tests is:"
    2020        cd tests
     
    3535# Process args
    3636foreach arg $argv {
    37     if { $arg == "-h" || $arg == "-help" } {
     37    if { $arg eq "-h" || $arg eq "-help" } {
    3838        print_help ""
    3939        exit 0
    40     } elseif { $arg == "-debug" } {
    41         set index [expr [lsearch $argv $arg] + 1]
     40    } elseif { $arg eq "-debug" } {
     41        set index [expr {[lsearch $argv $arg] + 1}]
    4242        set level [lindex $argv $index]
    4343        if { $level >= 0 && $level <= 3 } {
     
    4747            exit 1
    4848        }
    49     } elseif { $arg == "-t" } {
    50         set index [expr [lsearch $argv $arg] + 1]
     49    } elseif { $arg eq "-t" } {
     50        set index [expr {[lsearch $argv $arg] + 1}]
    5151        set test_name [lindex $argv $index]
    5252        set no 0
     
    5555        foreach test $test_suite {
    5656            if { $test_name != $test } {
    57                 set no [expr $no + 1]
     57                set no [expr {$no + 1}]
    5858            }
    5959        }
     
    6262            exit 1
    6363        }
    64     } elseif { $arg == "-l" } {
     64    } elseif { $arg eq "-l" } {
    6565        print_help tests
    6666        exit 0
    67     } elseif { $arg == "-nocolor" } {
     67    } elseif { $arg eq "-nocolor" } {
    6868        set color_out "no"
    6969    }
     
    7272
    7373# Run tests
    74 if { $test_name != ""} {
     74if { $test_name ne ""} {
    7575    set result [eval exec $tcl $test_name $arguments 2>@stderr]
    7676    puts $result
     
    105105
    106106        set out ""
    107         if { ($fail != 0 || $skip != 0) && $color_out == "" } {
     107        if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
    108108            # Color failed tests.
    109109            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
     
    120120        }
    121121        if { $fail != 0 } {
    122             set end [expr [string first $test $result 0] - 1]
     122            set end [expr {[string first $test $result 0] - 1}]
    123123            puts [string range $result 0 $end]
    124124        }
     
    127127
    128128# Return 1 if errors were found.
    129 if {$err != ""} { exit 1 }
     129if {$err ne ""} { exit 1 }
    130130
    131131return 0
Note: See TracChangeset for help on using the changeset viewer.