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

Kevin Ballard eridius at macports.org
Tue Feb 13 23:19:20 PST 2007


On Feb 14, 2007, at 2:00 AM, Mark Duling wrote:

>> Like I said, file copy (or just copy, after my commit) will in  
>> fact copy
>> directories.
>
> I'm sorry to be so dull.  You seem to be saying this:
>
> copy ${sourcedir}  ${destdir}
>
> is equivalent to this:
>
> system "cp -R ${sourcedir}  ${destdir}"
>
> But doesn't 'eval xinstall [glob ${source}/* ${dest}' fail if there  
> are
> nested directories?  So I thought perhaps your new copy command  
> would have
> the same problem.  I'm sorry we're talking by each other, but I  
> have some
> preconceptions that I'm having trouble getting beyond at the moment.

xinstall and file copy are different - xinstall is implemented in  
pextlib, and apparently doesn't recursively copy directories. It's a  
shame.

So yeah, while xinstall won't handle directories, copy will do it  
just fine. The difference is that copy won't handle file permissions,  
but xinstall does.

>> find basedir {filter_expression} {do stuff with $filename}
>
> Because if filter_expression = "*", then is there a tcl command I  
> can use
> in {do stuff with ..} that doesn't care if something is a file or
> directory?  Because I thought that the TCL extensions I've learned  
> so far
> require me to know in advance whether I'm copying files or  
> directories, so
> I wonder if it is possible for {filter_expression} to be "*".

Actually, filter_expression isn't a glob, it's a tcl expression. In  
the current incarnation of find, you want to use something like {expr  
1}. That will make it work on everything. That said, it will recurse  
into directories, so if you want the equivalent of the above xinstall  
command you'd simply do

eval file copy [list [glob -directory ${source} *]] ${dest}

Of course, this does have the problem where glob won't find dot- 
files. and if you use * .* instead of the *, it will, but it'll  
find . and .. as well. It's annoying.

-- 
Kevin Ballard
http://kevin.sb.org
eridius at macports.org
http://www.tildesoft.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-dev/attachments/20070214/90b23591/attachment.html


More information about the macports-dev mailing list