Can someone please provide a documented working example of using fs- traverse to traverse a worksrcpath and perform a reinplace operation on every Makefile? I'm a bit lost at the moment. Randall Wood rhwood@mac.com http://shyramblings.blogspot.com "The rules are simple: The ball is round. The game lasts 90 minutes. All the rest is just philosophy."
On 24 Apr, 2007, at 07:29, Randall Wood wrote:
Can someone please provide a documented working example of using fs- traverse to traverse a worksrcpath and perform a reinplace operation on every Makefile?
I believe that would be: fs-traverse file ${worksrcpath} { if [string match {/Makefile$} ${file}] { reinplace "s|/usr/local|${prefix}|g" ${file} } } Like "foreach", the first argument to fs-traverse is the name of the loop variable, and the second is the directory to traverse. It's almost like writing "foreach file [glob ${worksrcpath}/**/]", except that Tcl doesn't support zsh-style globbing. Here's another fairly simple example you might use in destroot. It's is preferable to "eval file copy [glob ...]" in that you can take control of the file permissions if you need to, by adding further processing inside of the "file" case. cd ${worksrcpath} foreach top [glob *] { fs-traverse file ${top} { switch -exact [file type ${file}] { directory { xinstall -d -m 755 ${destination}/${file} } file { xinstall -m 644 ${file} ${destination}/${file} } } } } (there's a possibility "foreach... fs-traverse..." might in the future become "fs-traverse file [glob *]") Chris
participants (2)
-
Chris Pickel
-
Randall Wood