Help with macports port for zef

2023-11-27 Thread raf via perl6-users
Hi. I'm trying to create a macports portfile for zef so
that macports users can easily install zef using
macports. Currently, the only raku-related port on
macports is rakudo itself (and nqp). A zef port would
be a great next step. But I'm not a raku expert or a
macports expert, so I need help.

I did manage to get it to successfully test and install
and activate, but only once. When I then tried to
install using certain options (-vst) that show you
which assumptions you've made that won't be true for
others, I started getting an error. And the error never
went away even without -vst. I'm hoping someone here
might be able to explain what's happening.

In case anyone here uses macports and can test this
themselves, the broken portfile is at
https://github.com/macportsraf/raku-zef-portfile

The error is that it's failing to mkdir
/opt/local/share/perl6/site/short (Operation not
permitted). Currently, /opt/local/share/perl6/site only
contains "version". It shouldn't be placing anything
directly in /opt/local at this stage (the "destroot"
stage). It should be installing into a DESTDIR
location. The command used to install zef into the
destroot is:

  "${prefix}/bin/rakudo" -I"${worksrcpath}" bin/zef 
--to="inst#${destroot}${prefix}/share/perl6/site" install "${worksrcpath}"

which shouldn't be touching /opt/local. Nothing can
affect /opt/local (i.e. ${prefix}) until the port is
installed and activated). Installation is into a
version-specific directory, and activation of a
particular version copies files from that directory
to the official "prefix" (usually /opt/local).
the "destroot" phase happens before all of that
into a temporary directory.

Perhaps rakudo is doing some housekeeping in addition
to what zef is trying to do to install itself? Does
anyone have any idea what might be causing this mkdir,
and is there anything I can do to suppress it?
Alternatively, if rakudo is creating directories that
it sees as missing, can I preempt that by triggering
those directories to be created earlier when rakudo
itself is installed, so that it doesn't feel the need
to do it when something else is being installed later?

cheers,
raf



Re: Help with macports port for zef

2023-12-31 Thread raf via perl6-users
On Sun, Dec 31, 2023 at 07:09:07AM -0600, Tom Browder  
wrote:

> On Mon, Nov 27, 2023 at 02:17 raf via perl6-users 
> wrote:
> 
> >  Hi. I'm trying to create a macports portfile for zef so
> 
> 
> I'm not a Mac user, but I've been struggling with another Rakudo
> installation method for Linux and had similar problems. My solution has
> been to install the binary code for linux by downloading it and putting it
> in /opt.
> 
> Where are you getting the compiled code? Are you rearranging it in any way
> before it gets to the final destination?
> 
> Best regards,
> 
> -Tom

The usual way is for a macports Portfile to download
the source and compile it (if necessary) on each client
host. I have been given good advice on how to proceed
with my problem (that some directories aren't created
when rakudo is installed, so it tries to create them
when running zef's installation but not having the
permissions to do so). But I'm too busy at the moment
to work on it right now.

Macports builds a package into a destroot directory
and then installs it into an installation directory
and then activates the installation by copying or
symlinking from /opt/local/whatever to the installation
directory. That enables multiple versions of the same
package to be installed, with a single version being
active at any one time. I think the problem I'm having
is that it disregards empty directories unless you
explicitly instruct it to keep them, and I think that
that isn't happening in the rakudo port to retain
directories that it creates but that are empty initially.
If I change the rakudo port to keep those directories,
the zef port should work. At least, that's my mental
model at the moment.

cheers,
raf