Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add a little tool for analyzing modules/ for missing stuff
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| my %depended-on := SetHash.new; | ||
| my @has-names; | ||
|
|
||
| use JSON::Fast; | ||
|
|
||
| for qx{ ls modules/*/META* }.lines -> $jf { | ||
|
|
||
| my $data = from-json(slurp($jf)); | ||
|
|
||
| # list module as available | ||
| @has-names.push($data<name>); | ||
|
|
||
| # these three can contain dependencies | ||
| for <depends test-depends build-depends> -> $_ { | ||
| # but some of them are optional | ||
| next unless $data{$_}:exists; | ||
| my $val = $data{$_}; | ||
| # and sometimes they are just an empty array in the json blob. | ||
| next if $val.elems == 0; | ||
|
|
||
| # record every dependency in our set | ||
| %depended-on{@$val}>>++; | ||
| } | ||
| } | ||
|
|
||
| # exclude a few modules: | ||
| # Panda doesn't have a META.info | ||
| # Test is shipped with Rakudo | ||
| # NativeCall is also shipped with rakudo | ||
| # nqp isn't really a module. | ||
| my @missing = %depended-on (-) @has-names (-) <Panda Test NativeCall nqp>; | ||
|
|
||
| with @missing { | ||
| say "There are some modules that are depended on, but not in the modules list."; | ||
| .say for @missing; | ||
| } else { | ||
| say "the modules seem to be sane."; | ||
| } |