[87310] trunk/dports/_resources/port1.0/group/php5pear-1.0.tcl
Ryan Schmidt
ryandesign at macports.org
Wed Nov 16 16:42:54 PST 2011
On Nov 16, 2011, at 16:54, pixilla at macports.org wrote:
> Revision: 87310
> http://trac.macports.org/changeset/87310
> Author: pixilla at macports.org
> Date: 2011-11-16 14:54:37 -0800 (Wed, 16 Nov 2011)
> Log Message:
> -----------
> group/php5pear-1.0.tcl:
> - Install a temporary pear installer into worksrcpath for each port.
> - This leaves a resident pear command for a later accomplishment.
>
> Modified Paths:
> --------------
> trunk/dports/_resources/port1.0/group/php5pear-1.0.tcl
With this commit it looks like you've gone to a 2-space-per-indent style from our usual 4-space-per-indent. Ok, but you should add our standard modeline, with the instances of 4 changed to 2. This will help some editors understand that this is the style you want to use.
> + depends_lib path:bin/phpize:php5 port:php5-pear
Heads-up: once there are separate php54 php53 php52 ports as I'm planing, something different will have to happen here, since there will no longer be any port providing "phpize" (or "php").
> + if { "${php5pear.channel}" != "pear.php.net" } {
> + system "curl -s http://${php5pear.channel}/channel.xml -o ${worksrcpath}/channel.xml"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} channel-add ${worksrcpath}/channel.xml"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set default_channel ${php5pear.channel}"
> }
I wonder if there's a way you could use pextlib's Tcl curl interface instead of calling the curl command line program.
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set php_dir ${php5pear.pearpath}"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set bin_dir ${php5pear.pearpath}/bin"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set doc_dir ${php5pear.pearpath}/docs"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set data_dir ${php5pear.pearpath}/data"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set www_dir ${php5pear.pearpath}/www"
> + system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set test_dir ${php5pear.pearpath}/tests"
> + 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).
> + # Remove all invisible "dot" files.
> + fs-traverse -ignoreErrors item "${destroot}${php5pear.instpath}" {
> + if {[string first . [file tail ${item}] 0] == 0} {
> + # Using system rm because I could not find a way to delete dot files with [file delete].
> + system "rm -R ${item}"
> + }
> }
Curious: what problems did you run into with [file delete]?
Note that traversing and looking for items starting with "." will of course find the directory entries "." and "..", which you cannot remove, and which I'd suspect [file delete] would complain about. "rm" should complain too, but it might just be a warning that you never see. Note also that you can shorten [file delete] to just [delete].
More information about the macports-dev
mailing list