Help with zef Portfile

Joshua Root jmr at macports.org
Sat Nov 25 15:07:39 UTC 2023


raf wrote:

> The destroot part looks like this:
>
>    destroot {
>        "${prefix}/bin/rakudo" -I"${worksrcpath}" bin/zef \
>            --to="inst#${destroot}${prefix}/share/perl6/site" \
>            install "${worksrcpath}"
>
>        ln -s "${prefix}/share/perl6/site/bin/zef"   "${prefix}/bin/zef"
>        ln -s "${prefix}/share/perl6/site/bin/zef-m" "${prefix}/bin/zef-m"
>    }
>
> Which results in this error:
>
>    :error:destroot Failed to destroot raku-zef: invalid command name "/opt/local/bin/rakudo"
>    :debug:destroot Error code: NONE
>    :debug:destroot Backtrace: invalid command name "/opt/local/bin/rakudo"
>    :debug:destroot     while executing
>    :debug:destroot "$procedure $targetname"
>
> As "${prefix}/bin/rakudo" is valid in test.cmd,
> why isn't it valid during destroot?
> And how do I help destroot find it?

This is really a macports-dev question, so cross-posting this there.

When you override (e.g. destroot { ... }) or augment (e.g. post-build { 
... }) a port phase, the code you provide is executed in the Tcl 
interpreter. '${prefix}/bin/rakudo' is indeed not a valid Tcl command. 
It happens that we do define an 'ln' Tcl command that takes args very 
much like ln(1). If you want to execute something in the shell, you have 
to use the 'system' command (or sometimes 'exec' if you want to capture 
the output.)

The default destroot phase builds a string to pass to 'system' by 
combining destroot.cmd, destroot.args, etc. In this case, it might be 
easiest to use those for the rakudo command, and create the symlinks in 
a post-destroot block?

- Josh



More information about the macports-users mailing list