Raku / App-Rakubrew

Raku environment manager
https://rakubrew.org/
Other
26 stars 13 forks source link

rakubrew build zef does it all wrong #38

Closed vrurg closed 3 years ago

vrurg commented 3 years ago

What rakubrew currently does when it installs zef is it, in fact, must not do:

fatal: not a git repository (or any of the parent directories): .git
Failed running git checkout master && git pull -q at /home/vrurg/.rakubrew/bin/rakubrew line 811.
vrurg commented 3 years ago

I'd propose rakubrew to change two things:

patrickbkr commented 3 years ago

The error message is a bit misleading. rakubrew doesn't actually try to clone zef into cwd. It does the clone in the version dir where zef should be installed to. So e.g. ~/.rakubrew/versions/moar-2021.06/zef. The error was, that when that directory is already existing (happens when zef has already been installed in that version), then git checkout master && git pull was executed in ~/.rakubrew/versions/moar-2021.06/ instead of ~/.rakubrew/versions/moar-2021.06/zef resulting in the above error. That should be fixed in the just released v17. You should be able to update with rakubrew self-upgrade.

@vrurg Can you confirm that the error is fixed in v17?

vrurg commented 3 years ago

I'm afraid this is just part of the problem. It doesn't change the fact that for manually registered versions zef is cloned into the current directory. Here is what happens. I have two cloned Rakudo repos. One is my fork, where I do most of the work, and from where I produce PRs. And the original repo, which I use for clean tests and bisects. Here is what is looks like with rakubrew list:

  build -> /home/vrurg/src/Raku/rakudo/install
* master -> /home/vrurg/src/Raku/rakudo-master/install

Apparently, they're not in ~/.rakubrew/versions. And every time I nuke and rebuild from scratch when time comes to rakubrew build zef I get a fresh copy of zef directory in my cwd. So, I get a couple of zef clones spread around my home directory tree time after time. For example, this is the outcome of find ~ -name 'zef' -type d as of now:

/home/vrurg/.rakubrew/versions/moar-2021.04/zef
/home/vrurg/.rakubrew/versions/moar-2020.11/zef
/home/vrurg/.rakubrew/versions/moar-2020.02.1/zef
/home/vrurg/.rakubrew/versions/moar-2020.06/zef
/home/vrurg/.rakubrew/versions/moar-2020.09/zef
/home/vrurg/.rakubrew/versions/moar-2021.02/zef
/home/vrurg/.rakubrew/versions/moar-2021.03/zef
/home/vrurg/.rakubrew/versions/moar-2020.12/zef
/home/vrurg/.rakubrew/versions/moar-2020.10/zef
/home/vrurg/src/Raku/raku-Vikna/zef
/home/vrurg/src/Raku/zef

BTW, I would even disagree it makes sense to keep zef clones under version directories. After all, they're all the same clone. Perhaps it'd make more sense to have one copy under .rakubrew/repos or alike.

patrickbkr commented 3 years ago

Oh! I didn't have external versions on the radar. Yes, there really was more wrong. I have reproduced the problem and fixed it in v18 (v19 is just some cleanup stuff). Can you check if it now finally works in v19?

vrurg commented 3 years ago

Looks great:

Cloning into '/home/vrurg/.rakubrew/repos/zef'...

And on the second run:

HEAD is now at 602c54f Bump version 0.11.7
Already on 'master'
Your branch is up to date with 'origin/master'.

That was fast, thank you!