<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[24720] branches/dp2mp-move/base</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/macports/changeset/24720">24720</a></dd>
<dt>Author</dt> <dd>jmpp@macports.org</dd>
<dt>Date</dt> <dd>2007-05-01 10:51:31 -0700 (Tue, 01 May 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>
Merging Eridius' r24678: Fix tracing to work *much* better. Also fix depends validation to
actually validate each depspec instead of just finding a single one within the list, and to
stop validating on unset. Include ChangeLog entry. Fixes #11868</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesdp2mpmovebaseChangeLog">branches/dp2mp-move/base/ChangeLog</a></li>
<li><a href="#branchesdp2mpmovebasesrcport10portdependstcl">branches/dp2mp-move/base/src/port1.0/portdepends.tcl</a></li>
<li><a href="#branchesdp2mpmovebasesrcport10portutiltcl">branches/dp2mp-move/base/src/port1.0/portutil.tcl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesdp2mpmovebaseChangeLog"></a>
<div class="modfile"><h4>Modified: branches/dp2mp-move/base/ChangeLog (24719 => 24720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dp2mp-move/base/ChangeLog        2007-05-01 17:09:32 UTC (rev 24719)
+++ branches/dp2mp-move/base/ChangeLog        2007-05-01 17:51:31 UTC (rev 24720)
</span><span class="lines">@@ -6,6 +6,12 @@
</span><span class="cx">
</span><span class="cx"> (unreleased):
</span><span class="cx">
</span><ins>+ - variable tracing now works in a much better way and handles unsets properly.
+ Similarly, ${option}-delete now works better. Depends validation no longer
+ attempts to validate when the variable is unset. Additionally, the validation
+ now actually validates each depspec instead of simply finding a single spec
+ within the list that works (ticket #11868, eridius r24678).
+
</ins><span class="cx"> - macports infrastructure now easier to use from scripts.
</span><span class="cx"> ui_prefix and ui_channels have default implementations, and
</span><span class="cx"> all arguments to dportinit are now optional (ticket #11837, eridius r24460).
</span></span></pre></div>
<a id="branchesdp2mpmovebasesrcport10portdependstcl"></a>
<div class="modfile"><h4>Modified: branches/dp2mp-move/base/src/port1.0/portdepends.tcl (24719 => 24720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dp2mp-move/base/src/port1.0/portdepends.tcl        2007-05-01 17:09:32 UTC (rev 24719)
+++ branches/dp2mp-move/base/src/port1.0/portdepends.tcl        2007-05-01 17:51:31 UTC (rev 24720)
</span><span class="lines">@@ -42,14 +42,14 @@
</span><span class="cx"> option_proc depends_run validate_depends_options
</span><span class="cx"> option_proc depends_lib validate_depends_options
</span><span class="cx">
</span><del>-proc validate_depends_options {option action args} {
</del><ins>+proc validate_depends_options {option action {value ""}} {
</ins><span class="cx"> global targets
</span><del>- switch -regex $action {
-                set|append|delete {
-                        foreach depspec $args {
</del><ins>+ switch $action {
+                set {
+                        foreach depspec $value {
</ins><span class="cx">                                 switch -regex $depspec {
</span><del>-                                        (lib|bin|path):([-A-Za-z0-9_/.${}^?+()|\\\\]+):([-A-Za-z./0-9_]+) {}
-                                        (port):([-A-Za-z./0-9_]+) {}
</del><ins>+                                        ^(lib|bin|path):([-A-Za-z0-9_/.${}^?+()|\\\\]+):([-A-Za-z./0-9_]+)$ {}
+                                        ^(port):([-A-Za-z./0-9_]+)$ {}
</ins><span class="cx">                                         default { return -code error [format [msgcat::mc "invalid depspec: %s"] $depspec] }
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span></span></pre></div>
<a id="branchesdp2mpmovebasesrcport10portutiltcl"></a>
<div class="modfile"><h4>Modified: branches/dp2mp-move/base/src/port1.0/portutil.tcl (24719 => 24720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dp2mp-move/base/src/port1.0/portutil.tcl        2007-05-01 17:09:32 UTC (rev 24719)
+++ branches/dp2mp-move/base/src/port1.0/portutil.tcl        2007-05-01 17:51:31 UTC (rev 24720)
</span><span class="lines">@@ -90,47 +90,53 @@
</span><span class="cx"> # Arguments: <list of options>
</span><span class="cx"> proc options {args} {
</span><span class="cx"> foreach option $args {
</span><del>- proc $option {args} "
- global ${option} user_options option_procs
- if {!\[info exists user_options(${option})\]} {
- set ${option} \$args
</del><ins>+ proc $option {args} [subst -nocommands {
+ global $option user_options option_procs
+ if {![info exists user_options($option)]} {
+ set $option \$args
</ins><span class="cx"> }
</span><del>- "
- proc ${option}-delete {args} "
- global ${option} user_options option_procs
- if {!\[info exists user_options(${option})\] && \[info exists ${option}\]} {
</del><ins>+ }]
+ proc ${option}-delete {args} [subst -nocommands {
+ global $option user_options option_procs
+ if {![info exists user_options($option)] && [info exists $option]} {
+ set temp $option
</ins><span class="cx"> foreach val \$args {
</span><del>- set ${option} \[ldelete \${$option} \$val\]
</del><ins>+ set temp [ldelete \${$option} \$val]
</ins><span class="cx"> }
</span><del>- if {\[string length \${${option}}\] == 0} {
- unset ${option}
</del><ins>+ if {\$temp eq ""} {
+ unset $option
+ } else {
+ set $option \$temp
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- "
- proc ${option}-append {args} "
- global ${option} user_options option_procs
- if {!\[info exists user_options(${option})\]} {
- if {\[info exists ${option}\]} {
- set ${option} \[concat \${$option} \$args\]
</del><ins>+ }]
+ proc ${option}-append {args} [subst -nocommands {
+ global $option user_options option_procs
+ if {![info exists user_options($option)]} {
+ if {[info exists $option]} {
+ set $option [concat \${$option} \$args]
</ins><span class="cx"> } else {
</span><del>- set ${option} \$args
</del><ins>+ set $option \$args
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- "
</del><ins>+ }]
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> proc options_export {args} {
</span><span class="cx"> foreach option $args {
</span><del>- proc options::export-${option} {args} "
- global ${option} PortInfo
- if {\[info exists ${option}\]} {
- set PortInfo(${option}) \${${option}}
- } else {
- unset PortInfo(${option})
</del><ins>+ proc options::export-${option} {option action {value ""}} [subst -nocommands {
+ global $option PortInfo
+ switch \$action {
+ set {
+ set PortInfo($option) \$value
+ }
+ delete {
+ unset PortInfo($option)
+ }
</ins><span class="cx"> }
</span><del>- "
- option_proc ${option} options::export-${option}
</del><ins>+ }]
+ option_proc $option options::export-$option
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -140,55 +146,58 @@
</span><span class="cx"> # If a new option is specified, default the option to {${newoption}}
</span><span class="cx"> # Display a warning
</span><span class="cx"> if {$newoption != ""} {
</span><del>- proc warn_deprecated_${option} {option action args} "
</del><ins>+ proc warn_deprecated_${option} {option action args} [subst -nocommands {
</ins><span class="cx"> global portname $option $newoption
</span><del>- if {\$action != \"read\"} {
</del><ins>+ if {\$action != "read"} {
</ins><span class="cx"> $newoption \$$option
</span><span class="cx"> } else {
</span><del>- ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\"
</del><ins>+ ui_warn "Port \$portname using deprecated option \\\"$option\\\"."
</ins><span class="cx"> $option \[set $newoption\]
</span><span class="cx"> }
</span><del>- "
</del><ins>+ }]
</ins><span class="cx"> } else {
</span><del>- proc warn_deprecated_$option {option action args} "
</del><ins>+ proc warn_deprecated_$option {option action args} [subst -nocommands {
</ins><span class="cx"> global portname $option $newoption
</span><del>- ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\"
- "
</del><ins>+ ui_warn "Port \$portname using deprecated option \\\"$option\\\"."
+ }]
</ins><span class="cx"> }
</span><span class="cx"> option_proc $option warn_deprecated_$option
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> proc option_proc {option args} {
</span><span class="cx"> global option_procs $option
</span><del>- eval lappend option_procs($option) $args
- # Add a read trace to the variable, as the option procedures have no access to reads
- trace variable $option rwu option_proc_trace
</del><ins>+ if {[info exists option_procs($option)]} {
+ set option_procs($option) [concat $option_procs($option) $args]
+ # we're already tracing
+ } else {
+ set option_procs($option) $args
+ trace add variable $option {read write unset} option_proc_trace
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # option_proc_trace
</span><span class="cx"> # trace handler for option reads. Calls option procedures with correct arguments.
</span><span class="cx"> proc option_proc_trace {optionName index op} {
</span><span class="cx"> global option_procs
</span><del>- upvar $optionName optionValue
</del><ins>+ upvar $optionName $optionName
</ins><span class="cx"> switch $op {
</span><del>- w {
</del><ins>+ write {
</ins><span class="cx"> foreach p $option_procs($optionName) {
</span><del>- $p $optionName set $optionValue
</del><ins>+ $p $optionName set [set $optionName]
</ins><span class="cx"> }
</span><del>- return
</del><span class="cx"> }
</span><del>- r {
</del><ins>+ read {
</ins><span class="cx"> foreach p $option_procs($optionName) {
</span><span class="cx"> $p $optionName read
</span><span class="cx"> }
</span><del>- return
</del><span class="cx"> }
</span><del>- u {
</del><ins>+ unset {
</ins><span class="cx"> foreach p $option_procs($optionName) {
</span><del>- $p $optionName delete
- trace vdelete $optionName rwu $p
</del><ins>+ if {[catch {$p $optionName delete} result]} {
+ ui_debug "error during unset trace ($p): $result\n$::errorInfo"
+ }
</ins><span class="cx"> }
</span><del>- return
</del><ins>+ trace add variable $optionName {read write unset} option_proc_trace
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>