From 7822d78ec86722fe4b043e4642ff72da554d6b74 Mon Sep 17 00:00:00 2001 From: Timo Paulssen Date: Sat, 2 Apr 2016 14:01:23 +0200 Subject: add a little tool for analyzing modules/ for missing stuff --- tools/star/analyze_module_dependencies.p6 | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/star/analyze_module_dependencies.p6 (limited to 'tools') diff --git a/tools/star/analyze_module_dependencies.p6 b/tools/star/analyze_module_dependencies.p6 new file mode 100644 index 0000000..dae5090 --- /dev/null +++ b/tools/star/analyze_module_dependencies.p6 @@ -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); + + # these three can contain dependencies + for -> $_ { + # 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 (-) ; + +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."; +} -- cgit v1.1