Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install modules in other rakudo versions using rakubrew

When upgrading rakudo version using rakubrew, is pretty easy to change versions, but I wnat to know if it is posible to import raku modules from the older version to the new version. doign zef install automatically:

to update:

rakubrew build 2020.10

but then:

❯ raku
Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10.
Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
Built on MoarVM version 2020.10.

You may want to `zef install Readline` or `zef install Linenoise` or use rlwrap for a line editor

To exit type 'exit' or '^D'

so I need to install all modules that I currently use:

rakubrew build-zef zef install Sparrow6 zef install Linenoise

so exists any file .zef or .rakubrew or something that checks to maintain this modules automatically

like image 608
anquegi Avatar asked Oct 29 '20 07:10

anquegi


1 Answers

You can get the list of installed modules using zef list --installed. Note you probably want to ignore the share/perl6 repo, as the CORE module included in it is specific to each version of rakudo.

see: https://github.com/ugexe/zef#list-from

list [*@from]

List known available distributions

$ zef --installed list

===> Found via /home/nickl/.rakubrew/moar-master/install/share/perl6/site

CSV::Parser:ver<0.1.2>:auth<github:tony-o>

Zef:auth<github:ugexe>

===> Found via /home/nickl/.rakubrew/moar-master/install/share/perl6

CORE:ver<6.c>:auth<perl>

Alternatively you can use the following one-liner to get a list:

$ raku -e 'say $*REPO.repo-chain.grep(CompUnit::Repository::Installation).map(*.installed.Slip).grep(*.defined).map({ CompUnit::Repository::Distribution.new($_).Str }).join(" ")'

Text::Table::Simple:ver<0.0.7>:auth<github:ugexe>:api<> CSV::Parser:ver<0.1.2>:auth<github:tony-o>:api<> CORE:ver<6.d>:auth<perl>:api<>

# $*REPO.repo-chain.grep(CompUnit::Repository::Installation) # Get only repos for installed raku modules
# .map(*.installed.Slip)                                     # Get a list of installed modules for this repo, and Slip it into the outer singular results list
# .grep(*.defined)                                           # Some repos will have had no modules, so remove these undefined entries
# .map({ CompUnit::Repository::Distribution.new($_).Str })   # Use CompUnit::Repository::Distribution to get at the normalized identifier
# .join(" ")                                                 # Join the results together

Once you have chosen a way to create a list of what needs to be installed you can just pass that list to zef (although your shell may require you to quote names passed in explicitly on the command line)

like image 91
ugexe Avatar answered Oct 23 '22 12:10

ugexe