diff options
author | Kent Fredric <kentfredric@gmail.com> | 2012-08-02 18:22:51 +1200 |
---|---|---|
committer | Kent Fredric <kentfredric@gmail.com> | 2012-08-02 18:22:51 +1200 |
commit | eb64b9df52d207c8c3f8803ea3d1187910199f16 (patch) | |
tree | e7fb6f21fc60f15ec1b775937c3594aa9497bd42 /scripts | |
parent | [scripts] aggregate_tree.pl / use Gentoo::Perl::Distmap (diff) | |
download | perl-overlay-eb64b9df52d207c8c3f8803ea3d1187910199f16.tar.gz perl-overlay-eb64b9df52d207c8c3f8803ea3d1187910199f16.tar.bz2 perl-overlay-eb64b9df52d207c8c3f8803ea3d1187910199f16.zip |
[scripts] package_map_all.pl / use Gentoo::Perl::Distmap
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/package_map_all.pl | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/scripts/package_map_all.pl b/scripts/package_map_all.pl index 2e84ac948..2abb9f3ff 100755 --- a/scripts/package_map_all.pl +++ b/scripts/package_map_all.pl @@ -16,6 +16,8 @@ use Try::Tiny; use utf8; use optparse; use Path::Class::Dir; +use Gentoo::Perl::Distmap; +use Gentoo::Perl::Distmap::RecordSet; my $optparse = optparse->new( argv => \@ARGV, help => sub { print help(); }, @@ -42,33 +44,15 @@ my $decoder = JSON->new()->utf8->relaxed; my $encoder = JSON->new()->pretty->utf8->canonical; my %lookup; -my %g_repos; + say "Init-ed"; { for my $file (@json_files) { - my %repos; say "* Reading " . $file->relative; - 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"; - my (@dup) = grep { $lookup{$_} > 1 } keys %lookup; - if ( @dup > 0 ) { - say " " . ( scalar @dup ) . " items listed more than once"; - say " > $_" for @dup; + my $dm = Gentoo::Perl::Distmap->load( file => $file ); + + say " Found " . ( scalar $dm->mapped_dists ) . " distributions"; + %lookup = ( %lookup, map { $_ => 1 } $dm->mapped_dists ); } } |