On Sun, Nov 26, 2023 at 02:07:39AM +1100, Joshua Root <j...@macports.org> wrote:
> 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 Thanks! That's super helpful. I tried just putting "system" before the command but it didn't work. I couldn't find the documentation for tcl's system, so I tried using destroot.cmd "${prefix}/bin/rakudo" ... instead, but it added extra arguments: install DESTROOT=... which break the command. But erasing destroot's args, pre_args, and post_args fixed the build. Then the problem was activating it. It said: Error: Failed to activate raku-zef: Image error: /opt/local/share/perl6/site/version is being used by the active rakudo port. Please deactivate this port first, or use 'port -f activate raku-zef' to force the activation. So I added the removal of that file to post-destroot and now it works! It installs and avtivates... However, when I now test with "sudo port install -vst raku-zef", and add the missing dependencies (curl, git, wget), I get this error: :info:destroot Failed to create directory '/opt/local/share/perl6/site/short' with mode '0o777': Failed to mkdir: Operation not permitted :info:destroot Command failed: cd "/opt/local/var/macports/build/_Users_raf_macports_ports_lang_raku-zef/raku-zef/work/zef-0.21.1" && /opt/local/bin/rakudo -I"/opt/local/var/macports/build/_Users_raf_macports_ports_lang_raku-zef/raku-zef/work/zef-0.21.1" bin/zef --to="inst#/opt/local/var/macports/build/_Users_raf_macports_ports_lang_raku-zef/raku-zef/work/destroot/opt/local/share/perl6/site" install /opt/local/var/macports/build/_Users_raf_macports_ports_lang_raku-zef/raku-zef/work/zef-0.21.1 :info:destroot Exit code: 1 And now, I get the same error without -vst. Wierd, that did work before trying -vst. And port test isn't working anymore either with teh same error. $ ls -lasp /opt/local/share/perl6/site 0 drwxr-xr-x 3 root wheel 96 26 Nov 11:58 ./ 0 drwxr-xr-x 7 root admin 224 26 Nov 11:58 ../ 0 -rw-r--r-- 1 root wheel 1 26 Nov 11:57 version Any idea what's happening? Or what to try next? I tried uninstalling and reinstalling rakudo just in case it might help, but it didn't. My current attempt is https://github.com/macportsraf/raku-zef-portfile cheers, raf