[22007] portutil.tcl mods / more portfile.7 changes needed?

Mark Duling mark.duling at biola.edu
Tue Feb 13 21:28:13 PST 2007


Kevin Ballard <eridius at macports.org> on Tuesday, February 13, 2007 at 9:17
PM -0800 wrote:
>Docs on this can be found with `man n glob`. You may simply want to put
>in a reference to glob(n) there.
>
Ah I see.  Yes.  I still think some usage examples in TCL extensions would
be beneficial.
>
>2)  Is it possible for reinplace to replace multiple strings for the same
>file with one statement?
>
>
>
>Nope. The syntax for reinplace is `reinplace pattern file1 [file2 ...]`.
>
>
>If you want to make things simple, you can do something like
>
>
>foreach pat [list pat1 pat2 pat3] { reinplace $pat file1 file2 }
>
>
>If the pattern has spaces, be sure to enclose it in quotes or braces
>(just like you do with reinplace)
>
>
>Incidentally, the pattern is a single command as understood by sed (in
>fact, it's actually interpreted by sed under the hood).
>
Got it.
>
>
>3) The answer to whether generic recursive queries can be accomplished
>with TCL extensions.
>
>
>
>What do you mean by this?
>
If I'm not supposed to do 'system "cp -R ${dir} ${dir}"', then what is the
easiest and/or recommended way to accomplish the same thing without using
system calls?
>
>
>   3a) If the answer is no but a generic TCL script can be wrapped around
>xinstall using globs, then an example be given for doing this.  If neither
>3 or 3a is possible, state that system calls for recursive copies are
>acceptible.
>
>
>
>Clarify 3 and I may be able to answer this as well.

If there isn't a way to do recursive copies (functionally equivalent to cp
-R) without system calls, is there a generic foolproof way to accomplish
gneric recursive copies in TCL extensions by wrapping them in a script as
in your example with reinplace?  
>foreach pat [list pat1 pat2 pat3] { reinplace $pat file1 file2 }

Mark




More information about the macports-dev mailing list