public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Kent Fredric" <kentfredric@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/perl-overlay:master commit in: scripts/
Date: Wed,  1 May 2013 23:03:29 +0000 (UTC)	[thread overview]
Message-ID: <1367448962.8b13e9caaaf76afbf835140cabadcdd66bde4077.kent@gentoo> (raw)

commit:     8b13e9caaaf76afbf835140cabadcdd66bde4077
Author:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
AuthorDate: Wed May  1 22:56:02 2013 +0000
Commit:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
CommitDate: Wed May  1 22:56:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=8b13e9ca

[scripts] rework aggregate_tree.pl to use Gentoo::Perl::Distmap::FromOverlay

---
 scripts/aggregate_tree.pl |   85 +++++++++++----------------------------------
 1 files changed, 21 insertions(+), 64 deletions(-)

diff --git a/scripts/aggregate_tree.pl b/scripts/aggregate_tree.pl
index 16afe79..52b18f9 100755
--- a/scripts/aggregate_tree.pl
+++ b/scripts/aggregate_tree.pl
@@ -16,14 +16,15 @@ use Data::Dump qw( pp );
 use Gentoo::Overlay;
 use Gentoo::Perl::Distmap;
 use Gentoo::Perl::Distmap::RecordSet;
+use Gentoo::Perl::Distmap::FromOverlay;
+
 # FILENAME: aggregate_tree.pl
 # CREATED: 29/02/12 07:37:54 by Kent Fredric (kentnl) <kentfredric@gmail.com>
 # ABSTRACT: Connect all the cpan id's from the metadata.xml
 
 use XML::Smart;
 
-my ( $env, $cat );
-my $dm = Gentoo::Perl::Distmap->new();
+my ( $env, $cat , $dm );
 
 main();
 
@@ -46,11 +47,26 @@ sub main {
   }
 
   my $dest = open_output( $opts->long_opts->{output} );
+  my $mapper = Gentoo::Perl::Distmap::FromOverlay->new( overlay => $tree );
 
   $|++;
-  $tree->iterate(
-    'packages' => \&handle_package
-  );
+  local *Gentoo::Perl::Distmap::FromOverlay::_on_enter_category = sub {
+    print "\r" . $_[1] . '     ';
+    print "\r" . $_[1] . ' ';
+  };
+  my @symbols = ( '/' , '-', '\\', '|' );
+  local *Gentoo::Perl::Distmap::FromOverlay::_on_enter_package = sub {
+    my $next_symbol = shift @symbols;
+    push @symbols, $next_symbol;
+    print $next_symbol . "\b";
+  };
+
+  local *Gentoo::Perl::Distmap::FromOverlay::_on_enter_ebuild = sub {
+    print ".> \b\b" ;
+  };
+
+
+  $dm = $mapper->distmap;
 
   $dest->print( make_format( $opts->long_opts->{format} ) );
 
@@ -92,65 +108,6 @@ sub make_format_distlist {
   return join qq{\n}, $dm->mapped_dists;
 }
 
-sub handle_package {
-  my ( $self, $c ) = @_;
-  my $CP      = $c->{category_name} . '/' . $c->{package_name};
-  my $xmlfile = $c->{package}->path->file('metadata.xml');
-  if ( not -e $xmlfile ) {
-    warn "\e[31mNo metadata.xml for $CP\e[0m\n";
-    return;
-  }
-  if ( not $cat or $c->{category_name} ne $cat ) {
-    *STDERR->print( "\nProcessing " . $c->{category_name} . " :" );
-    $cat = $c->{category_name};
-  }
-  *STDERR->print(".");
-  my $XML = XML::Smart->new( $xmlfile->absolute()->stringify() );
-  if ( not exists $XML->{pkgmetadata} ) {
-    warn "\e[31m<pkgmetadata> missing in $xmlfile\e[0m\n";
-    return;
-  }
-  if ( not exists $XML->{pkgmetadata}->{upstream} ) {
-
-    # warn "<pkgmetadata>/<upstream> missing in $xmlfile\n";
-    return;
-  }
-  if ( not exists $XML->{pkgmetadata}->{upstream}->{'remote-id'} ) {
-
-    # warn "<pkgmetadata>/<upstream>/<remote-id> missing in $xmlfile\n";
-    return;
-  }
-  for my $remote ( @{ $XML->{pkgmetadata}->{upstream}->{'remote-id'} } ) {
-
-    next if not exists $remote->{type};
-    next unless $remote->{type} eq 'cpan';
-
-    my $upstream = $remote->content();
-
-    my $record   = {
-      category        => $c->{category_name},
-      package         => $c->{package_name},
-      repository      => $c->{overlay_name},
-      distribution    => $upstream,
-    };
-    $c->{package}->iterate(
-      ebuilds => sub {
-        my ( $self, $d ) = @_;
-        my $version = $d->{ebuild_name};
-        my $p       = $c->{package_name};
-        $version =~ s/\.ebuild$//;
-        $version =~ s/^\Q${p}\E-//;
-        $dm->add_version(
-            %{$record},
-            version => $version,
-        );
-      }
-    );
-
-    *STDERR->print("\e[32m $CP -> $upstream\e[0m ");
-  }
-
-}
 0;
 
 __DATA__


             reply	other threads:[~2013-05-01 23:03 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 23:03 Kent Fredric [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-16 22:36 [gentoo-commits] proj/perl-overlay:master commit in: scripts/ Kent Fredric
2015-02-28 23:17 Kent Fredric
2015-02-28 23:17 Kent Fredric
2013-12-23 15:28 Kent Fredric
2013-05-01 23:03 Kent Fredric
2012-10-24 15:49 Kent Fredric
2012-09-15 23:19 Kent Fredric
2012-08-02 11:46 Kent Fredric
2012-08-02 11:46 Kent Fredric
2012-07-31  3:04 Kent Fredric
2012-07-12 19:23 Torsten Veller
2012-06-22  7:34 Kent Fredric
2012-06-08 17:14 Kent Fredric
2012-05-27  2:30 Kent Fredric
2012-04-28 10:40 Kent Fredric
2012-04-18  3:32 Kent Fredric
2012-04-18  3:32 Kent Fredric
2012-04-18  3:32 Kent Fredric
2012-04-12 19:46 Kent Fredric
2012-04-09 16:05 Kent Fredric
2012-04-08 13:20 Kent Fredric
2012-04-08 13:20 Kent Fredric
2012-04-05 10:02 Kent Fredric
2012-03-27  1:26 Kent Fredric
2012-03-27  1:26 Kent Fredric
2012-03-27  1:26 Kent Fredric
2012-03-01 11:38 Kent Fredric
2012-02-29 12:22 Kent Fredric
2012-02-29 12:22 Kent Fredric
2012-02-29 12:06 Kent Fredric
2012-02-28 21:55 Kent Fredric
2012-02-28 21:55 Kent Fredric
2012-02-28 21:55 Kent Fredric
2012-02-24  7:13 Kent Fredric
2012-02-24  7:13 Kent Fredric
2012-02-12  7:22 Kent Fredric
2012-02-12  7:22 Kent Fredric
2011-12-05 21:45 Kent Fredric
2011-11-14  2:57 Kent Fredric
2011-11-14  2:57 Kent Fredric
2011-11-11 14:38 Kent Fredric
2011-10-31 18:05 Kent Fredric
2011-10-31 18:05 Kent Fredric
2011-10-31  8:46 Kent Fredric
2011-10-31  7:10 Kent Fredric
2011-10-31  4:52 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-31  2:48 Kent Fredric
2011-10-25 19:46 Kent Fredric
2011-10-25 19:46 Kent Fredric
2011-10-25 19:46 Kent Fredric
2011-10-24 21:17 Kent Fredric
2011-10-24 18:26 Kent Fredric
2011-10-24  9:09 Kent Fredric
2011-09-23  6:17 Kent Fredric
2011-08-29  5:44 Kent Fredric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367448962.8b13e9caaaf76afbf835140cabadcdd66bde4077.kent@gentoo \
    --to=kentfredric@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox