diff options
author | 2012-04-18 13:32:57 +1200 | |
---|---|---|
committer | 2012-04-18 13:32:57 +1200 | |
commit | c2ff7063d813e5307db436ee38cb48035aa541f3 (patch) | |
tree | 41fa329024d70c74bda6d4e29728de69d4c3592f /scripts | |
parent | [scripts/aggregate_tree.pl] Reorganise the data structure emitted, and emit g... (diff) | |
download | perl-overlay-c2ff7063d813e5307db436ee38cb48035aa541f3.tar.gz perl-overlay-c2ff7063d813e5307db436ee38cb48035aa541f3.tar.bz2 perl-overlay-c2ff7063d813e5307db436ee38cb48035aa541f3.zip |
[scripts/package_map_all.pl] Update to handle the modified data format
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/package_map_all.pl | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/scripts/package_map_all.pl b/scripts/package_map_all.pl index b0bf81456..351cd6344 100755 --- a/scripts/package_map_all.pl +++ b/scripts/package_map_all.pl @@ -40,16 +40,26 @@ my $decoder = JSON->new()->utf8->relaxed; my $encoder = JSON->new()->pretty->utf8->canonical; my %lookup; +my %g_repos; { for my $file (@json_files) { + my %repos; say "* Reading " . $file->relative; - my $hash = $decoder->decode( scalar $file->slurp ); - say " Found " . ( scalar keys %{$hash} ) . " repositories indexed in " . $file->relative; - for my $repo ( keys %{$hash} ) { - my $nodes = $hash->{$repo}; - say " ${repo}: " . ( scalar keys %{$nodes} ) . " distributions"; - $lookup{$_}++ for keys %{$nodes}; + my $nodes = $decoder->decode( scalar $file->slurp ); + + say " Found " . ( scalar keys %{$nodes} ) . " distributions"; + for ( keys %{$nodes} ) { + my $records = $nodes->{$_}; + $lookup{$_}++; + for my $rec ( @{ $records }) { + my $repo = $rec->{repository}; + $repos{$repo}++; + } + } + say " $_ : " . $repos{$_} for keys %repos; + for ( keys %repos ) { + $g_repos{$_} += $repos{$_}; } } say "* Found: " . ( scalar keys %lookup ) . " unique distributions"; |