ugexe / zef

Raku Module Management
Artistic License 2.0
207 stars 44 forks source link

[Discussion] - mixing zef and alpine package installations #469

Open melezhik opened 1 year ago

melezhik commented 1 year ago

Hi! This is rather a discussion, not a bug.

Sorry ahead of time if this goes to a wrong place.

I have started raku-alpine-repo as an alpine repository for community Raku modules.

An interesting case here is when one installs the same Raku module both using zef install and apk add method:

Installation with zef, goes to /usr/share/rakudo/site/ by default:

(

We need to install zef first, it's also shipped by the way as an alpine package:


/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
fetch https://alpine.sparrowhub.io/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
v3.16.2-221-ge7097e0782 [https://dl-cdn.alpinelinux.org/alpine/v3.16/main]
v3.16.2-227-g7411d9b1c4 [https://dl-cdn.alpinelinux.org/alpine/v3.16/community]
raku-packages  [https://alpine.sparrowhub.io]
v20220809-4178-gf7d8f25bac [https://dl-cdn.alpinelinux.org/alpine/edge/community]

/ # apk add raku-Zef
(1/1) Installing raku-Zef (0.14.2-r1)
OK: 63 MiB in 33 packages

)

/ # zef install --/test --verbose Data::Dump
===> Searching for: Data::Dump
===> Updating fez mirror: https://360.zef.pm/
===> Updated fez mirror: https://360.zef.pm/
===> Found: Data::Dump:ver<0.0.14>:auth<zef:tony-o> [via Zef::Repository::Ecosystems<fez>]
===> Fetching [OK]: Data::Dump:ver<0.0.14>:auth<zef:tony-o> to /tmp/.zef/1664558902.256.1679.9685339587156/4fdb60b6821124e74c9cd87dc0f0aa0ca8c54005.tar.gz
===> Extraction [OK]: Data::Dump to /tmp/.zef/4fdb60b6821124e74c9cd87dc0f0aa0ca8c54005.tar.gz
===> Installing: Data::Dump:ver<0.0.14>:auth<zef:tony-o>
===> Install [OK] for Data::Dump:ver<0.0.14>:auth<zef:tony-o>
/ # grep -RH "Data::Dump" /usr/share/rakudo/
/usr/share/rakudo/site/sources/9E5A0A913A16C31180514E03F37F4FC63A495B09:unit module Data::Dump;
/usr/share/rakudo/site/sources/9E5A0A913A16C31180514E03F37F4FC63A495B09:=head1 Data::Dump for perl6
/usr/share/rakudo/site/sources/9E5A0A913A16C31180514E03F37F4FC63A495B09:    use Data::Dump;
/usr/share/rakudo/site/sources/9E5A0A913A16C31180514E03F37F4FC63A495B09:    use Data::Dump;
/usr/share/rakudo/site/dist/E7B755F29D6C943D3C3093763DD293F98512C4F1:{"api":"","auth":"zef:tony-o","depends":[],"description":"a colorful? data dumper for perl6","files":{},"name":"Data::Dump","perl":"6","provides":{"Data::Dump":{"lib/Data/Dump.pm6":{"file":"9E5A0A913A16C31180514E03F37F4FC63A495B09","time":null}}},"source-url":"git://github.com/tony-o/perl6-data-dump.git","support":{},"test-depends":[],"ver":"0.0.14","version":"0.0.14"}

Installation with alpine goes to /usr/share/rakudo/vendor/:

/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
fetch https://alpine.sparrowhub.io/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
v3.16.2-221-ge7097e0782 [https://dl-cdn.alpinelinux.org/alpine/v3.16/main]
v3.16.2-227-g7411d9b1c4 [https://dl-cdn.alpinelinux.org/alpine/v3.16/community]
raku-packages  [https://alpine.sparrowhub.io]
v20220809-4178-gf7d8f25bac [https://dl-cdn.alpinelinux.org/alpine/edge/community]
OK: 28712 distinct packages available

/ # apk add raku-Data-Dump
(1/1) Installing raku-Data-Dump (0.0.14-r1)
OK: 62 MiB in 30 packages
/ # apk info -L raku-Data-Dump
raku-Data-Dump-0.0.14-r1 contains:
usr/share/rakudo/vendor/dist/E7B755F29D6C943D3C3093763DD293F98512C4F1
usr/share/rakudo/vendor/short/93241B901E26C9DE8481C35F64121EA44640525D/E7B755F29D6C943D3C3093763DD293F98512C4F1
usr/share/rakudo/vendor/sources/9E5A0A913A16C31180514E03F37F4FC63A495B09

Please, pay attention that files paths for installed files are identical besides prefixes (usr/share/rakudo/vendor/dist vs /usr/share/rakudo/site/dist/ )

zef uninstall removes both from vendor and sites:

/ # zef uninstall Data::Dump
===> Uninstalled from inst#/usr/share/rakudo/site
Data::Dump:ver<0.0.14>:auth<zef:tony-o>
===> Uninstalled from inst#/usr/share/rakudo/vendor
Data::Dump:ver<0.0.14>:auth<zef:tony-o>

So the idea is I could alter alpine installation packaging logic so that packages would be installed into /usr/share/rakudo/site not vendor, in that case both zef and alpine based installation methods will coexists happily and don't conflict with each other.

Does it make a sense? What do you think?

ugexe commented 1 year ago

Ideally I imagine people want their OS packages installed to vendor. Technically the uninstall scenario could be avoided with --uninstall-from=site, but that does require the user to know that... maybe if zef sees a module in module repos it should abort and suggest using that flag.

melezhik commented 1 year ago

Thank, I will think about it …