-
-
Save ugexe/e00ade523d152af5ca1497311d07e420 to your computer and use it in GitHub Desktop.
Generate a lookup table for **CURI** installed module metadata from their sha1 id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nqp; | |
my $perl6-all-modules-repo-prefix = @*ARGS.head.IO || $*CWD; | |
my @dist-prefixes = $perl6-all-modules-repo-prefix.dir | |
.grep(*.d) | |
.map(*.dir.grep(*.d).Slip) | |
.map(*.dir.Slip); | |
my @dists = @dist-prefixes | |
.map({ try Distribution::Path.new($_) }) | |
.grep(*.defined) | |
.map({ CompUnit::Repository::Distribution.new($_) }); | |
my %sha1-lookup; | |
for @dists -> $dist { | |
for $dist.meta<provides>.keys -> $module { | |
my $module-id = nqp::sha1($module ~ $dist.id); | |
%sha1-lookup{$module-id} = %( | |
module-shortname => $module, | |
module-namepath => $dist.meta<provides>{$module}, | |
dist-longname => $dist.Str, | |
dist-id => $dist.id, | |
all-modules-repo => $dist.prefix.relative($perl6-all-modules-repo-prefix), | |
); | |
} | |
} | |
say Rakudo::Internals::JSON.to-json(%sha1-lookup, :sorted-keys); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment