[22007] portutil.tcl mods / more portfile.7 changes needed?
Kevin Ballard
eridius at macports.org
Tue Feb 13 21:45:18 PST 2007
Like I said, file copy (or just copy, after my commit) will in fact
copy directories.
In general, if you want to be recursive, we actually have a find
command in pextlib, though the only place I know of it being used is
in my fusefs port. That can be used such as
find basedir {filter_expression} {do stuff with $filename}
or
find -depth basedir {filter_expression} {do stuff with $filename,
depth-first}
If you want to match everything, filter_expression should just be
expr 1.
To give an example from fusefs, to recursively change file attributes
(equivalent to chmod -R) I used
find ${sysfsdir}/fusefs.fs {expr 1} {
file attributes $filename -owner root -group wheel
}
That said, as long as I'm the only user of find (as I believe is the
case) I am tempted to make some changes to the API. For example, the
filter really should be an expr expression by default (as is the case
with if/while/etc.), and the $filename variable really should have
its name specified in the call, so it doesn't override an existing
$filename (i.e. find basedir {filter} filevarname {some expression
with $filevarname} ).
On Feb 14, 2007, at 12:28 AM, Mark Duling wrote:
> 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?
--
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/5d139b22/attachment.html
More information about the macports-dev
mailing list