On Nov 16, 2011, at 5:20 PM, Ryan Schmidt wrote:

> 
> On Nov 16, 2011, at 19:06, Bradley Giesbrecht wrote:
> 
>> On Nov 16, 2011, at 4:42 PM, Ryan Schmidt wrote:
>> 
>>> On Nov 16, 2011, at 16:54, [email protected] wrote:
>>> 
>>>> +    system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} 
>>>> config-show"
>>> 
>>> This kind of stuff looks like you *may* want to investigate the MacPorts 
>>> base "command" system. configure, build, destroot, etc. are all "commands" 
>>> in MacPorts, each of which has pre_args, args, post_args, env, as you know. 
>>> You can probably create your own commands and run them with "command_exec". 
>>> That *might* clean up some of this code, at least reduce some of the 
>>> redundancy. (Or it might introduce its own complications. :)) An example of 
>>> running commands with command_exec (though not creating entire new 
>>> commands) is in the current php5 port (though it will go away in the New 
>>> PHP Order, coming soon to a MacPorts near you).
>> 
>> Sounds interesting. It would be nice to make the PortGroup file easier to 
>> read. I suspect there are some unused vars and I am not really clear on tcl 
>> variable scope.
>> For instance, does a dot in a name have special meaning?
> 
> Right, you asked me that privately and I forgot to respond. I don't actually 
> know. Conceptually, it creates a namespace; we think of e.g. 
> "php5pear.channel" as belonging to the php5pear namespace. This is to avoid 
> collisions with variables that might be defined in ports or in other 
> portgroups. We have an informal agreement that only the php5pear portgroup 
> would define variables or procedures beginning with "php5pear." But whether 
> the "." in the name has any special significance to the Tcl language I don't 
> know.

Ok, so inside a proc "php5pear.name" and "name" would have no effect on each 
other?

What I have struggled with is the declared "options" before the proc block, 
"option php5pear.channel", vars declared or passed into the:
proc php5pear.setup {php5pear.package version {php5pear.channel "pear.php.net"} 
{php5pear.packagexml "package.xml"}} {

Seems like some but not all vars need to be declared "global" inside a proc to 
be used:
global worksrcpath distname extract.suffix master_sites prefix destroot distpath
global php5pear.cmd-pre php5pear.cmd-pear php5pear.cmd-phar php5pear.cmd-php 
php5pear.cmd-post

> I would think glob would work fine, though, as in the shell, expanding "*" 
> will not include dot files. If you want them, you have no explicitly say so, 
> by using ".*"
> 
> It should just be (untested):
> 
>    fs-traverse -ignoreErrors item "${destroot}${php5pear.instpath}" {
>      if {[string first . [file tail ${item}] 0] == 0} {
>        if {[file tail ${item}] != "." && [file tail ${item}] != ".."} {
>          delete ${item}
>        }
>      }
> 
> Though [delete] and [file delete] probably only delete files, not 
> directories. If there are dot directories you're trying to delete, 
> then....... I don't know if we have a recursive delete proc somewhere in base 
> already.


In this case many of the dot files are directories.


Regards,
Bradley Giesbrecht (pixilla)




_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev

Reply via email to