From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C30CC13800E for ; Thu, 2 Aug 2012 11:47:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 92218E064E; Thu, 2 Aug 2012 11:46:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 650FDE064E for ; Thu, 2 Aug 2012 11:46:54 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B75D21B402D for ; Thu, 2 Aug 2012 11:46:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 5350EE5441 for ; Thu, 2 Aug 2012 11:46:51 +0000 (UTC) From: "Kent Fredric" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Kent Fredric" Message-ID: <1343888571.eb64b9df52d207c8c3f8803ea3d1187910199f16.kent@gentoo> Subject: [gentoo-commits] proj/perl-overlay:master commit in: scripts/ X-VCS-Repository: proj/perl-overlay X-VCS-Files: scripts/package_map_all.pl X-VCS-Directories: scripts/ X-VCS-Committer: kent X-VCS-Committer-Name: Kent Fredric X-VCS-Revision: eb64b9df52d207c8c3f8803ea3d1187910199f16 X-VCS-Branch: master Date: Thu, 2 Aug 2012 11:46:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ab25cdee-ee1a-4270-b5db-58318d749470 X-Archives-Hash: c914cebeefc73520d565d94dc29b616a commit: eb64b9df52d207c8c3f8803ea3d1187910199f16 Author: Kent Fredric gmail com> AuthorDate: Thu Aug 2 06:22:51 2012 +0000 Commit: Kent Fredric gmail com> CommitDate: Thu Aug 2 06:22:51 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=eb64b9df [scripts] package_map_all.pl / use Gentoo::Perl::Distmap --- 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 2e84ac9..2abb9f3 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 ); } }