[134833] trunk/base/src/port1.0/portutil.tcl
Joshua Root
jmr at macports.org
Wed Apr 8 22:02:53 PDT 2015
On 2015-4-9 06:51 , Ryan Schmidt wrote:
>
>> On Apr 8, 2015, at 9:30 AM, jmr at macports.org wrote:
>>
>> Revision
>> 134833
>> Author
>> jmr at macports.org
>> Date
>> 2015-04-08 07:30:14 -0700 (Wed, 08 Apr 2015)
>> Log Message
>>
>> simplify makeuserproc and get rid of weird overquoting requirement (which probably only existed because someone called their argument 'args' in the calling procs without realising what that does)
>
>> --- trunk/base/src/port1.0/portutil.tcl 2015-04-08 13:33:26 UTC (rev 134832)
>> +++ trunk/base/src/port1.0/portutil.tcl 2015-04-08 14:30:14 UTC (rev 134833)
>> @@ -601,7 +601,7 @@
>>
>> # make a user procedure named variant-blah-blah
>> # we will call this procedure during variant-run
>> - makeuserproc "variant-[ditem_key $ditem name]" \{$code\}
>> + makeuserproc variant-[ditem_key $ditem name] $code
>>
>> # Export provided variant to PortInfo
>> # (don't list it twice if the variant was already defined, which can happen
>> @@ -1281,8 +1281,8 @@
>> # all the globals in its scope. This is undeniably ugly, but I haven't
>> # thought of any other way to do this.
>> proc makeuserproc {name body} {
>> - regsub -- "^\{(.*?)" $body "\{ \n foreach g \[info globals\] \{ \n global \$g \n \} \n \\1" body
>> - eval "proc $name {} $body"
>> + append modified_body {global {*}[info globals]\n} $body
>> + proc $name {} $modified_body
>> }
>>
>> # backup
>> @@ -2199,7 +2199,7 @@
>> set origproc [ditem_key $ditem procedure]
>> set ident [ditem_key $ditem name]
>> if {[info commands $target] eq ""} {
>> - proc $target {args} "
>> + proc $target {code} "
>> variable proc_index
>> set proc_index \[llength \[ditem_key $ditem proc\]\]
>> ditem_key $ditem procedure proc-${ident}-${target}-\${proc_index}
>> @@ -2211,10 +2211,10 @@
>> }
>> \"
>> proc do-$target {} { $origproc $target }
>> - makeuserproc userproc-${ident}-${target}-\${proc_index} \$args
>> + makeuserproc userproc-${ident}-${target}-\${proc_index} \$code
>> "
>> }
>> - proc pre-$target {args} "
>> + proc pre-$target {code} "
>> variable proc_index
>> set proc_index \[llength \[ditem_key $ditem pre\]\]
>> ditem_append $ditem pre proc-pre-${ident}-${target}-\${proc_index}
>> @@ -2225,9 +2225,9 @@
>> return 0
>> }
>> \"
>> - makeuserproc userproc-pre-${ident}-${target}-\${proc_index} \$args
>> + makeuserproc userproc-pre-${ident}-${target}-\${proc_index} \$code
>> "
>> - proc post-$target {args} "
>> + proc post-$target {code} "
>> variable proc_index
>> set proc_index \[llength \[ditem_key $ditem post\]\]
>> ditem_append $ditem post proc-post-${ident}-${target}-\${proc_index}
>> @@ -2238,7 +2238,7 @@
>> return 0
>> }
>> \"
>> - makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$args
>> + makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$code
>> "
>> }
>> ditem_append $ditem provides {*}$args
>
> Is this occurrence of $args here still correct or should this be $code as well?
This line is outside the definitions of the procs that now take a 'code'
argument. The 'args' here is the same one iterated over by the preceding
foreach loop.
- Josh
More information about the macports-dev
mailing list