documentation of pextlib1.0 commands

Caspar Florian Ebeling febeling at macports.org
Wed Jun 11 04:55:03 PDT 2008


>>> Is there documentation of the mp-specific commands
>>> somewhere, that I overlooked? Things like "system"?
>>> I found the definition in macports/base/src/pextlib1.0/Pextlib.c,
>>> eventually, but it is still a bit uncomfortable. In this case e.g.
>>> I wanted to see if it returns output from stdout and
>>> exit code.
>
> I think this should be documented in this section in the guide, but it is
> not.
> <http://guide.macports.org/#reference.tcl-extensions>
>
> What is missing besides 'system'?

There is this init function in Pextlib.c:

http://trac.macports.org/browser/trunk/base/src/pextlib1.0/Pextlib.c#L1167

In that all command named get registered with the appropriate
function pointers.

I think a few are missing from the guide. flock, readdir, sedstr, mkstemp,
mktemp, fs-traverse, filemap, rpm-vercomp, compat, umask, sudo,
mkfifo, unixsocketpair, mkchannelfromfd, pipe, curl, symlink, unsetenv,
readline, rl_history, various uid and gid related ones (of which some _are_
mentioned in the guide), tracelib. Did I miss anything?

Florian

>
>> I'm not aware of documentation. I generally just look at other ports  or
>> parts of base that do what I want and copy it.
>
> Looking at other Portfiles is always possible, but it is not a replacement
> for documentation.
>
>> If you want to get output from the command, use exec. For example,  see
>> the nspr port which does:
>>
>>         set mylibs [exec ${destroot}${prefix}/bin/nspr-config --libs]
>>
>> To catch errors you can use catch, like src/port1.0/portutil.tcl does  in
>> MacPorts base:
>>
>>         if {[catch {exec cp $tmpfile $file} error]} {
>>             global errorInfo
>>             ui_debug "$errorInfo"
>>             ui_error "reinplace: $error"
>>             file delete "$tmpfile"
>>             return -code error "reinplace copy failed"
>>         }
>
> But exec and catch are usual Tcl stuff, which are documented in 'man n exec'
> and 'man n catch'.
>
> MacPorts adds its own commands for use in Portfiles with Pextlib and they
> should be documented.
>
> Rainer
>



-- 
Florian Ebeling
florian.ebeling at gmail.com


More information about the macports-dev mailing list