<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[116450] trunk/base/src/registry2.0</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/116450">116450</a></dd>
<dt>Author</dt> <dd>cal@macports.org</dd>
<dt>Date</dt> <dd>2014-01-25 08:59:12 -0800 (Sat, 25 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>registry2.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</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbasesrcregistry20portimagetcl">trunk/base/src/registry2.0/portimage.tcl</a></li>
<li><a href="#trunkbasesrcregistry20portuninstalltcl">trunk/base/src/registry2.0/portuninstall.tcl</a></li>
<li><a href="#trunkbasesrcregistry20receipt_flattcl">trunk/base/src/registry2.0/receipt_flat.tcl</a></li>
<li><a href="#trunkbasesrcregistry20receipt_sqlitetcl">trunk/base/src/registry2.0/receipt_sqlite.tcl</a></li>
<li><a href="#trunkbasesrcregistry20registrytcl">trunk/base/src/registry2.0/registry.tcl</a></li>
<li><a href="#trunkbasesrcregistry20registry_utiltcl">trunk/base/src/registry2.0/registry_util.tcl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbasesrcregistry20portimagetcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/registry2.0/portimage.tcl (116449 => 116450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/registry2.0/portimage.tcl        2014-01-25 16:57:17 UTC (rev 116449)
+++ trunk/base/src/registry2.0/portimage.tcl        2014-01-25 16:59:12 UTC (rev 116450)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">
</span><span class="cx"> # takes a composite version spec rather than separate version,revision,variants
</span><span class="cx"> proc activate_composite {name {v ""} {optionslist ""}} {
</span><del>- if {$v == ""} {
</del><ins>+ if {$v eq ""} {
</ins><span class="cx"> return [activate $name "" "" 0 $optionslist]
</span><span class="cx"> } elseif {[registry::decode_spec $v version revision variants]} {
</span><span class="cx"> return [activate $name $version $revision $variants $optionslist]
</span><span class="lines">@@ -107,19 +107,19 @@
</span><span class="cx"> # if another version of this port is active, deactivate it first
</span><span class="cx"> set current [registry::entry installed $name]
</span><span class="cx"> foreach i $current {
</span><del>- if { ![string equal $specifier "[$i version]_[$i revision][$i variants]"] } {
</del><ins>+ if { $specifier ne "[$i version]_[$i revision][$i variants]" } {
</ins><span class="cx"> lappend todeactivate $i
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # this shouldn't be possible
</span><del>- if { ![string equal [$requested installtype] "image"] } {
</del><ins>+ if { [$requested installtype] ne "image" } {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} not installed as an image."
</span><span class="cx"> }
</span><span class="cx"> if {![::file isfile $location]} {
</span><span class="cx"> return -code error "Image error: Can't find image file $location"
</span><span class="cx"> }
</span><del>- if { [string equal [$requested state] "installed"] } {
</del><ins>+ if {[$requested state] eq "installed"} {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} is already active."
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx">
</span><span class="cx"> # takes a composite version spec rather than separate version,revision,variants
</span><span class="cx"> proc deactivate_composite {name {v ""} {optionslist ""}} {
</span><del>- if {$v == ""} {
</del><ins>+ if {$v eq ""} {
</ins><span class="cx"> return [deactivate $name "" "" 0 $optionslist]
</span><span class="cx"> } elseif {[registry::decode_spec $v version revision variants]} {
</span><span class="cx"> return [deactivate $name $version $revision $variants $optionslist]
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx"> set registry_open yes
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if { [string equal $name ""] } {
</del><ins>+ if {$name eq ""} {
</ins><span class="cx"> throw registry::image-error "Registry error: Please specify the name of the port."
</span><span class="cx"> }
</span><span class="cx"> set ilist [registry::entry installed $name]
</span><span class="lines">@@ -175,10 +175,10 @@
</span><span class="cx"> set name [$requested name]
</span><span class="cx"> set specifier "[$requested version]_[$requested revision][$requested variants]"
</span><span class="cx">
</span><del>- if {$version != "" && ($version != [$requested version] ||
- ($revision != "" && ($revision != [$requested revision] || $variants != [$requested variants])))} {
</del><ins>+ if {$version ne "" && ($version != [$requested version] ||
+ ($revision ne "" && ($revision != [$requested revision] || $variants != [$requested variants])))} {
</ins><span class="cx"> set v $version
</span><del>- if {$revision != ""} {
</del><ins>+ if {$revision ne ""} {
</ins><span class="cx"> append v _${revision}${variants}
</span><span class="cx"> }
</span><span class="cx"> return -code error "Active version of $name is not $v but ${specifier}."
</span><span class="lines">@@ -186,11 +186,11 @@
</span><span class="cx">
</span><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $specifier]"
</span><span class="cx">
</span><del>- if { ![string equal [$requested installtype] "image"] } {
</del><ins>+ if { [$requested installtype] ne "image" } {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} not installed as an image."
</span><span class="cx"> }
</span><span class="cx"> # this shouldn't be possible
</span><del>- if { [$requested state] != "installed" } {
</del><ins>+ if { [$requested state] ne "installed" } {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} is not active."
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -207,12 +207,12 @@
</span><span class="cx">
</span><span class="cx"> set searchkeys $name
</span><span class="cx"> set composite_spec ""
</span><del>- if {$version != ""} {
</del><ins>+ if {$version ne ""} {
</ins><span class="cx"> lappend searchkeys $version
</span><span class="cx"> set composite_spec $version
</span><span class="cx"> # restriction imposed by underlying registry API (see entry.c):
</span><span class="cx"> # if a revision is specified, so must variants be
</span><del>- if {$revision != ""} {
</del><ins>+ if {$revision ne ""} {
</ins><span class="cx"> lappend searchkeys $revision $variants
</span><span class="cx"> append composite_spec _${revision}${variants}
</span><span class="cx"> }
</span><span class="lines">@@ -226,7 +226,7 @@
</span><span class="cx"> set iversion [$i version]
</span><span class="cx"> set irevision [$i revision]
</span><span class="cx"> set ivariants [$i variants]
</span><del>- if { [$i state] == "installed" } {
</del><ins>+ if { [$i state] eq "installed" } {
</ins><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
</span><span class="cx"> } else {
</span><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx"> } elseif { [llength $ilist] == 1 } {
</span><span class="cx"> return [lindex $ilist 0]
</span><span class="cx"> }
</span><del>- if {$composite_spec != ""} {
</del><ins>+ if {$composite_spec ne ""} {
</ins><span class="cx"> set composite_spec " @${composite_spec}"
</span><span class="cx"> }
</span><span class="cx"> throw registry::invalid "Registry error: ${name}${composite_spec} is not installed."
</span><span class="lines">@@ -469,7 +469,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$owner != "replaced"} {
</del><ins>+ if {$owner ne "replaced"} {
</ins><span class="cx"> if { [string is true -strict $force] } {
</span><span class="cx"> # if we're forcing the activation, then we move any existing
</span><span class="cx"> # files to a backup file, both in the filesystem and in the
</span><span class="lines">@@ -559,7 +559,7 @@
</span><span class="cx"> }
</span><span class="cx"> # reactivate deactivated ports
</span><span class="cx"> foreach entry [array names todeactivate] {
</span><del>- if {[$entry state] == "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
</del><ins>+ if {[$entry state] eq "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
</ins><span class="cx"> activate [$entry name] [$entry version] [$entry revision] [$entry variants] [list ports_activate_no-exec $noexec]
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -580,10 +580,10 @@
</span><span class="cx"> ui_debug "$dstfile does not exist"
</span><span class="cx"> return
</span><span class="cx"> }
</span><del>- if { $filetype == "link" } {
</del><ins>+ if { $filetype eq "link" } {
</ins><span class="cx"> ui_debug "deactivating link: $dstfile"
</span><span class="cx"> file delete -- $dstfile
</span><del>- } elseif { $filetype == "directory" } {
</del><ins>+ } elseif { $filetype eq "directory" } {
</ins><span class="cx"> # 0 item means empty.
</span><span class="cx"> if { [llength [readdir $dstfile]] == 0 } {
</span><span class="cx"> variable precious_dirs
</span><span class="lines">@@ -606,7 +606,7 @@
</span><span class="cx"> set files [list]
</span><span class="cx">
</span><span class="cx"> foreach file $imagefiles {
</span><del>- if { [::file exists $file] || (![catch {::file type $file}] && [::file type $file] == "link") } {
</del><ins>+ if { [::file exists $file] || (![catch {::file type $file}] && [::file type $file] eq "link") } {
</ins><span class="cx"> # Normalize the file path to avoid removing the intermediate
</span><span class="cx"> # symlinks (remove the empty directories instead)
</span><span class="cx"> # Remark: paths in the registry may be not normalized.
</span></span></pre></div>
<a id="trunkbasesrcregistry20portuninstalltcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/registry2.0/portuninstall.tcl (116449 => 116450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/registry2.0/portuninstall.tcl        2014-01-25 16:57:17 UTC (rev 116449)
+++ trunk/base/src/registry2.0/portuninstall.tcl        2014-01-25 16:59:12 UTC (rev 116450)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">
</span><span class="cx"> # takes a composite version spec rather than separate version,revision,variants
</span><span class="cx"> proc uninstall_composite {portname {v ""} {optionslist ""}} {
</span><del>- if {$v == ""} {
</del><ins>+ if {$v eq ""} {
</ins><span class="cx"> return [uninstall $portname "" "" 0 $optionslist]
</span><span class="cx"> } elseif {[registry::decode_spec $v version revision variants]} {
</span><span class="cx"> return [uninstall $portname $version $revision $variants $optionslist]
</span><span class="lines">@@ -75,12 +75,12 @@
</span><span class="cx">
</span><span class="cx"> set searchkeys $portname
</span><span class="cx"> set composite_spec ""
</span><del>- if {$version != ""} {
</del><ins>+ if {$version ne ""} {
</ins><span class="cx"> lappend searchkeys $version
</span><span class="cx"> set composite_spec $version
</span><span class="cx"> # restriction imposed by underlying registry API (see entry.c):
</span><span class="cx"> # if a revision is specified, so must variants be
</span><del>- if {$revision != ""} {
</del><ins>+ if {$revision ne ""} {
</ins><span class="cx"> lappend searchkeys $revision $variants
</span><span class="cx"> append composite_spec _${revision}${variants}
</span><span class="cx"> }
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $portname are currently installed:"]"
</span><span class="cx"> foreach i [portlist_sortint $ilist] {
</span><span class="cx"> set ispec "[$i version]_[$i revision][$i variants]"
</span><del>- if { [string equal [$i state] installed] } {
</del><ins>+ if {[$i state] eq "installed"} {
</ins><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]"
</span><span class="cx"> } else {
</span><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]"
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> set variants [$port variants]
</span><span class="cx"> set composite_spec "${version}_${revision}${variants}"
</span><span class="cx"> } else {
</span><del>- if {$composite_spec != ""} {
</del><ins>+ if {$composite_spec ne ""} {
</ins><span class="cx"> set composite_spec " @${composite_spec}"
</span><span class="cx"> }
</span><span class="cx"> throw registry::invalid "Registry error: ${portname}${composite_spec} not registered as installed"
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> }
</span><span class="cx"> foreach depport [$port dependents] {
</span><span class="cx"> # make sure it's still installed, since a previous dep uninstall may have removed it
</span><del>- if {[registry::entry exists $depport] && ([$depport state] == "imaged" || [$depport state] == "installed")} {
</del><ins>+ if {[registry::entry exists $depport] && ([$depport state] eq "imaged" || [$depport state] eq "installed")} {
</ins><span class="cx"> if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $depport uninstall $optionslist]} {
</span><span class="cx"> registry_uninstall::uninstall [$depport name] [$depport version] [$depport revision] [$depport variants] $optionslist
</span><span class="cx"> }
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx"> registry::check_dependents $port ${uninstall.force} "uninstall"
</span><span class="cx"> }
</span><span class="cx"> # if it's active, deactivate it
</span><del>- if { [string equal [$port state] installed] } {
</del><ins>+ if {[$port state] eq "installed"} {
</ins><span class="cx"> if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
</span><span class="cx"> ui_msg "For $portname @${composite_spec}: skipping deactivate (dry run)"
</span><span class="cx"> } else {
</span></span></pre></div>
<a id="trunkbasesrcregistry20receipt_flattcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/registry2.0/receipt_flat.tcl (116449 => 116450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/registry2.0/receipt_flat.tcl        2014-01-25 16:57:17 UTC (rev 116449)
+++ trunk/base/src/registry2.0/receipt_flat.tcl        2014-01-25 16:59:12 UTC (rev 116450)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Might as well bail out early if no file to match
</span><del>- if {![string length $matchfile]} {
</del><ins>+ if {$matchfile eq ""} {
</ins><span class="cx">                 return ""
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -117,8 +117,8 @@
</span><span class="cx">         if { ![::file isdirectory $receipt_path] } {
</span><span class="cx">                 set receipt_file [get_head_entry_receipt_path $name $version]
</span><span class="cx">                 
</span><del>-                if {![string length $receipt_file]} {
-                        if { $version != "" } {
</del><ins>+                if {$receipt_file eq ""} {
+                        if { $version ne "" } {
</ins><span class="cx">                                 return -code error "Registry error: ${name} @${version}_${revision}${variants} not registered as installed."
</span><span class="cx">                         } else {
</span><span class="cx">                                 return -code error "Registry error: ${name} not registered as installed."
</span><span class="lines">@@ -126,13 +126,13 @@
</span><span class="cx">                 }
</span><span class="cx">                 
</span><span class="cx">                 # Extract the version from the path.
</span><del>-                if { $version == "" } {
</del><ins>+                if { $version eq "" } {
</ins><span class="cx">                         set theFileName [::file tail $receipt_file]
</span><span class="cx">                         regexp "^$name-(.*)\$" $theFileName match version
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 # If version wasn't specified, find out the version number.
</span><del>-                if { $version == "" } {
</del><ins>+                if { $version eq "" } {
</ins><span class="cx">                         # xxx: We really should have had the
</span><span class="cx">                         # version given to us. How should we handle this?
</span><span class="cx">                         set x [glob -nocomplain -directory ${receipt_path} *]
</span><span class="lines">@@ -451,9 +451,9 @@
</span><span class="cx">
</span><span class="cx">         set query_path [::file join ${macports::registry.path} receipts]
</span><span class="cx">         
</span><del>-        if { $name == "" } {
</del><ins>+        if { $name eq "" } {
</ins><span class="cx">                 set query_path [::file join ${query_path} *]
</span><del>-                if { $version == "" } {
</del><ins>+                if { $version eq "" } {
</ins><span class="cx">                         set query_path [::file join ${query_path} *]
</span><span class="cx">                 }
</span><span class="cx">                 # [PG] Huh?
</span><span class="lines">@@ -472,7 +472,7 @@
</span><span class="cx">          }
</span><span class="cx">          }
</span><span class="cx">                 set query_path [::file join ${query_path} ${name}]
</span><del>-                if { $version != "" } {
</del><ins>+                if { $version ne "" } {
</ins><span class="cx">                         set query_path [::file join ${query_path} ${version}]
</span><span class="cx">                 } else {
</span><span class="cx">                         set query_path [::file join ${query_path} *]
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         # append the ports in old HEAD format.
</span><del>-        if { $name == "" } {
</del><ins>+        if { $name eq "" } {
</ins><span class="cx">                 set query_path [::file join ${macports::registry.path} receipts *]
</span><span class="cx">         } else {
</span><span class="cx">                 set query_path [::file join ${macports::registry.path} receipts ${name}-*]
</span><span class="lines">@@ -506,7 +506,7 @@
</span><span class="cx">
</span><span class="cx">         # Remark: these regexes do not always work.
</span><span class="cx">                 set theName ""
</span><del>-         if { $name == "" } {
</del><ins>+         if { $name eq "" } {
</ins><span class="cx">                         regexp {^(.*)-(.*)$} $theFileName match theName version
</span><span class="cx">         } else {
</span><span class="cx">                         regexp "^($name)-(.*)\$" $theFileName match theName version
</span><span class="lines">@@ -662,7 +662,7 @@
</span><span class="cx">
</span><span class="cx">         open_file_map
</span><span class="cx">
</span><del>-        if { [::file type $file] == "link" } {
</del><ins>+        if { [::file type $file] eq "link" } {
</ins><span class="cx">                 ui_debug "Adding link to file_map: $file for: $port"
</span><span class="cx">         } else {
</span><span class="cx">                 ui_debug "Adding file to file_map: $file for: $port"
</span><span class="lines">@@ -684,7 +684,7 @@
</span><span class="cx">
</span><span class="cx">         foreach f $files {
</span><span class="cx">                 set file [lindex $f 0]
</span><del>-                if { [::file type $file] == "link" } {
</del><ins>+                if { [::file type $file] eq "link" } {
</ins><span class="cx">                         ui_debug "Adding link to file_map: $file for: $port"
</span><span class="cx">                 } else {
</span><span class="cx">                         ui_debug "Adding file to file_map: $file for: $port"
</span><span class="lines">@@ -828,7 +828,7 @@
</span><span class="cx"> set dep_map $new_map
</span><span class="cx">
</span><span class="cx"> set newlen [llength $dep_map]
</span><del>- set diff [expr $oldlen - $newlen]
</del><ins>+ set diff [expr {$oldlen - $newlen}]
</ins><span class="cx"> ui_debug "New dep_map has $newlen entries"
</span><span class="cx"> ui_info "Removed $diff duplicate entries from the dependency map"
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbasesrcregistry20receipt_sqlitetcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/registry2.0/receipt_sqlite.tcl (116449 => 116450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/registry2.0/receipt_sqlite.tcl        2014-01-25 16:57:17 UTC (rev 116449)
+++ trunk/base/src/registry2.0/receipt_sqlite.tcl        2014-01-25 16:59:12 UTC (rev 116450)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">
</span><span class="cx"> # return list of active ports, or active version of port 'name' if specified
</span><span class="cx"> proc active {name} {
</span><del>- if {$name != ""} {
</del><ins>+ if {$name ne ""} {
</ins><span class="cx"> set ports [registry::entry installed $name]
</span><span class="cx"> } else {
</span><span class="cx"> set ports [registry::entry installed]
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx"> #
</span><span class="cx"> proc file_registered {file} {
</span><span class="cx"> set port [registry::entry owner $file]
</span><del>-        if {$port != ""} {
</del><ins>+        if {$port ne ""} {
</ins><span class="cx">                 return [$port name]
</span><span class="cx">         } else {
</span><span class="cx">                 return 0
</span><span class="lines">@@ -164,9 +164,9 @@
</span><span class="cx"> # version for example, so we don't attempt to split up the composite version
</span><span class="cx"> # into its components, we just compare the whole thing.
</span><span class="cx"> proc installed {{name ""} {version ""}} {
</span><del>-        if { $name == "" && $version == "" } {
</del><ins>+        if { $name eq "" && $version eq "" } {
</ins><span class="cx">          set ports [registry::entry imaged]
</span><del>-        } elseif { $name != "" && $version == ""} {
</del><ins>+        } elseif { $name ne "" && $version eq ""} {
</ins><span class="cx">          set ports [registry::entry imaged $name]
</span><span class="cx">         } else {
</span><span class="cx">          set ports {}
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx">         set rlist [list]
</span><span class="cx">         set searchcmd "registry::entry search"
</span><span class="cx"> foreach key {name version revision} {
</span><del>- if {[set $key] != ""} {
</del><ins>+ if {[set $key] ne ""} {
</ins><span class="cx"> append searchcmd " $key [set $key]"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -221,7 +221,7 @@
</span><span class="cx">         set rlist [list]
</span><span class="cx">         set searchcmd "registry::entry search"
</span><span class="cx"> foreach key {name version revision} {
</span><del>- if {[set $key] != ""} {
</del><ins>+ if {[set $key] ne ""} {
</ins><span class="cx"> append searchcmd " $key [set $key]"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -251,9 +251,9 @@
</span><span class="cx"> $regref location $props(location)
</span><span class="cx"> $regref state $props(state)
</span><span class="cx"> $regref installtype $props(installtype)
</span><del>- if {$props(installtype) == "image"} {
</del><ins>+ if {$props(installtype) eq "image"} {
</ins><span class="cx"> $regref map $props(imagefiles)
</span><del>- if {$props(state) == "installed"} {
</del><ins>+ if {$props(state) eq "installed"} {
</ins><span class="cx"> if {[llength $props(imagefiles)] != [llength $props(files)]} {
</span><span class="cx"> # deal with this mess, just drop the extras...
</span><span class="cx"> set i 0
</span></span></pre></div>
<a id="trunkbasesrcregistry20registrytcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/registry2.0/registry.tcl (116449 => 116450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/registry2.0/registry.tcl        2014-01-25 16:57:17 UTC (rev 116449)
+++ trunk/base/src/registry2.0/registry.tcl        2014-01-25 16:59:12 UTC (rev 116450)
</span><span class="lines">@@ -156,10 +156,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if { [llength $rlist] < 1 } {
</span><del>- if { $name == "" } {
</del><ins>+ if { $name eq "" } {
</ins><span class="cx"> return -code error "Registry error: No ports registered as installed."
</span><span class="cx"> } else {
</span><del>- if { $version == "" } {
</del><ins>+ if { $version eq "" } {
</ins><span class="cx"> return -code error "Registry error: $name not registered as installed."
</span><span class="cx"> } else {
</span><span class="cx"> return -code error "Registry error: $name $version not registered as installed."
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> }
</span><span class="cx">         
</span><span class="cx">         if { [llength $rlist] < 1 } {
</span><del>-                if { $name == "" } {
</del><ins>+                if { $name eq "" } {
</ins><span class="cx">                         return -code error "Registry error: No ports registered as active."
</span><span class="cx">                 } else {
</span><span class="cx">                         return -code error "Registry error: $name not registered as installed & active."
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx"> # (we won't store the md5 of the target of links since it's meaningless
</span><span class="cx"> # and $statvar(mode) tells us that links are links).
</span><span class="cx"> if {![catch {file lstat $fname statvar}]} {
</span><del>-        if {[::file isfile $fname] && [::file type $fname] != "link"} {
</del><ins>+        if {[::file isfile $fname] && [::file type $fname] ne "link"} {
</ins><span class="cx">          if {[catch {md5 file $fname} md5sum] == 0} {
</span><span class="cx">                 # Create a line that matches md5(1)'s output
</span><span class="cx">                 # for backwards compatibility
</span><span class="lines">@@ -346,7 +346,7 @@
</span><span class="cx">
</span><span class="cx">         set rval [list]
</span><span class="cx">         foreach file $flist {
</span><del>-                if {[string index $file 0] != "/"} {
</del><ins>+                if {[string index $file 0] ne "/"} {
</ins><span class="cx">                         set file [::file join $prefix $file]
</span><span class="cx">                 }
</span><span class="cx">                 lappend rval [fileinfo_for_file $file]
</span><span class="lines">@@ -405,10 +405,10 @@
</span><span class="cx"> set lockfd [::open $lockpath w]
</span><span class="cx"> }
</span><span class="cx"> if {[catch {flock $lockfd -exclusive -noblock} result]} {
</span><del>- if {$result == "EAGAIN"} {
</del><ins>+ if {$result eq "EAGAIN"} {
</ins><span class="cx"> ui_msg "Waiting for lock on $lockpath"
</span><span class="cx"> flock $lockfd -exclusive
</span><del>- } elseif {$result == "EOPNOTSUPP"} {
</del><ins>+ } elseif {$result eq "EOPNOTSUPP"} {
</ins><span class="cx"> # Locking not supported, just return
</span><span class="cx"> ui_debug "flock not supported, not locking registry"
</span><span class="cx"> } else {
</span><span class="lines">@@ -466,7 +466,7 @@
</span><span class="cx"> foreach f $contents {
</span><span class="cx"> set fullpath [lindex $f 0]
</span><span class="cx"> # strip image dir from start
</span><del>- if {[string range $fullpath 0 [expr $idlen - 1]] == $location} {
</del><ins>+ if {[string range $fullpath 0 $idlen-1] == $location} {
</ins><span class="cx"> set path [string range $fullpath $idlen [string length $fullpath]]
</span><span class="cx"> } else {
</span><span class="cx"> set path $fullpath
</span></span></pre></div>
<a id="trunkbasesrcregistry20registry_utiltcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/registry2.0/registry_util.tcl (116449 => 116450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/registry2.0/registry_util.tcl        2014-01-25 16:57:17 UTC (rev 116449)
+++ trunk/base/src/registry2.0/registry_util.tcl        2014-01-25 16:59:12 UTC (rev 116450)
</span><span class="lines">@@ -63,14 +63,14 @@
</span><span class="cx"> ## @param [in] force if true, continue even if there are dependents
</span><span class="cx"> proc check_dependents {port force {action "uninstall/deactivate"}} {
</span><span class="cx"> global UI_PREFIX
</span><del>- if {[$port state] == "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
</del><ins>+ if {[$port state] eq "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
</ins><span class="cx"> # Check if any installed ports depend on this one
</span><span class="cx"> set deplist [$port dependents]
</span><del>- if {$action == "deactivate"} {
</del><ins>+ if {$action eq "deactivate"} {
</ins><span class="cx"> set active_deplist {}
</span><span class="cx"> # Check if any active ports depend on this one
</span><span class="cx"> foreach p $deplist {
</span><del>- if {[$p state] == "installed"} {
</del><ins>+ if {[$p state] eq "installed"} {
</ins><span class="cx"> lappend active_deplist $p
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> ## @return true if successful, false otherwise
</span><span class="cx"> proc run_target {port target options} {
</span><span class="cx"> set portspec "[$port name] @[$port version]_[$port revision][$port variants]"
</span><del>- if {[$port portfile] == ""} {
</del><ins>+ if {[$port portfile] eq ""} {
</ins><span class="cx"> ui_debug "no portfile in registry for $portspec"
</span><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="lines">@@ -107,12 +107,12 @@
</span><span class="cx"> ui_warn "Failed to execute portfile from registry for $portspec"
</span><span class="cx"> switch $target {
</span><span class="cx"> activate {
</span><del>- if {[$port state] == "installed"} {
</del><ins>+ if {[$port state] eq "installed"} {
</ins><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> deactivate {
</span><del>- if {[$port state] == "imaged"} {
</del><ins>+ if {[$port state] eq "imaged"} {
</ins><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> global macports::keeplogs
</span><del>- if {(![info exists keeplogs] || !$keeplogs) && $target != "activate"} {
</del><ins>+ if {(![info exists keeplogs] || !$keeplogs) && $target ne "activate"} {
</ins><span class="cx"> catch {mportexec $mport clean}
</span><span class="cx"> }
</span><span class="cx"> mportclose_installed $mport
</span></span></pre>
</div>
</div>
</body>
</html>