From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RKhvP-0003Fn-Kb for garchives@archives.gentoo.org; Mon, 31 Oct 2011 02:48:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B821321C05E; Mon, 31 Oct 2011 02:48:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7876521C040 for ; Mon, 31 Oct 2011 02:48:08 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B83E01B4010 for ; Mon, 31 Oct 2011 02:48:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CF6DA80057 for ; Mon, 31 Oct 2011 02:48:06 +0000 (UTC) From: "Kent Fredric" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Kent Fredric" Message-ID: Subject: [gentoo-commits] proj/perl-overlay:master commit in: scripts/ X-VCS-Repository: proj/perl-overlay X-VCS-Files: scripts/gen_ebuild.pl X-VCS-Directories: scripts/ X-VCS-Committer: kent X-VCS-Committer-Name: Kent Fredric X-VCS-Revision: e7ba54d83323869a58d0951ae92ca0dd4a926b96 Date: Mon, 31 Oct 2011 02:48:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 8da18bd6-1538-4963-b269-838e110c44fe X-Archives-Hash: 233aad24126c765c6ec8b582fa7f912e commit: e7ba54d83323869a58d0951ae92ca0dd4a926b96 Author: Kent Fredric gmail com> AuthorDate: Fri Oct 28 03:57:09 2011 +0000 Commit: Kent Fredric gmail com> CommitDate: Mon Oct 31 02:45:47 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/perl-overlay.= git;a=3Dcommit;h=3De7ba54d8 Now shows the oldest version, the newest version, and the closest version. Generally speaking, when declaring a dep, you'll want the one with the "closest version" as your specifier for ">=3D" --- scripts/gen_ebuild.pl | 88 ++++++++++++++++++++++++++++++++++++++++---= ----- 1 files changed, 73 insertions(+), 15 deletions(-) diff --git a/scripts/gen_ebuild.pl b/scripts/gen_ebuild.pl index 1623bb8..867127b 100755 --- a/scripts/gen_ebuild.pl +++ b/scripts/gen_ebuild.pl @@ -52,35 +52,87 @@ my $dep_phases =3D get_dep_phases( $release ); =20 use Data::Dump qw( pp ); use JSON qw( to_json encode_json ); +use Try::Tiny; +use version (); =20 sub provider_map { - my ( $module ) =3D shift; + my ( $module , $version ) =3D @_; my @providers =3D metacpan->find_dist_simple( $module ); my %moduleprov; - =20 +=20 + + my %specialvs;=20 + + my $wanted_version =3D version->parse( $version ); + for my $provider ( @providers ) { =20 - next if $provider->{status} eq 'backpan'; - next if $provider->{maturity} eq 'developer'; + #next if $provider->{status} eq 'backpan'; + #next if $provider->{maturity} eq 'developer'; # pp $provider; =20 my $dist =3D $provider->{distribution}; my $distv =3D $provider->{version} // 'undef'; + my $gv =3D 'undef'; + if ( $distv ne 'undef' ){ + try { + $gv =3D gentooize_version( $distv , { lax =3D> 1 } ); + } catch { + $gv =3D '???'; + }; + } + + #next if $gv eq '???'; + $moduleprov{$dist} //=3D []; + my @provided_matching_mods; for my $mod ( @{ $provider->{'_source.module' } } ) { next unless $mod->{name} eq $module; my $modv =3D $mod->{version} // 'undef'; - my $dv =3D $distv; - if( $distv ne $modv ) {=20 - $dv =3D $distv . " =3D> " . '"' . $modv . '"'; + + my $got_version =3D version->parse( $mod->{version} ); + + my $dv =3D $distv; + #if( $distv ne $modv ) {=20 + $dv =3D sprintf "%s ( %s ) =3D> \"%s\"" , $distv , $gv, $modv; + #} + # specials=20 + =20 + $specialvs{newest} //=3D {}; + $specialvs{oldest} //=3D {}; + $specialvs{closest} //=3D {}; + $specialvs{closestx} //=3D {}; + + $specialvs{newest}->{$dist} =3D $dv if not exists $specialvs{newes= t}->{$dist}; + $specialvs{oldest}->{$dist} =3D $dv;=20 + + # *STDERR->printf("\e[99m%s > %s , %s\n", $got_version, $wante= d_version, $got_version > $wanted_version ); + + if ( not defined $version or $got_version >=3D $wanted_version ){ +# *STDERR->printf("\e[99m%s > %s , %s x2\n", $got_version, $versi= on , 1 ); + if ( not defined $specialvs{closestx}->{$dist} ) { +# *STDERR->printf("\e[99m%s > %s =3D> set \n", $got_version, $ve= rsion ); + $specialvs{closestx}->{$dist} =3D $got_version; + $specialvs{closest}->{$dist} =3D $dv; + } else { + if( $specialvs{closestx}->{$dist} >=3D $got_version ) { +# *STDERR->printf("\e[99m%s > %s =3D> << \n", $got_version, $v= ersion ); + + $specialvs{closestx}->{$dist} =3D $got_version; + $specialvs{closest}->{$dist} =3D $dv; + + } + } } + # +=20 push @provided_matching_mods, $dv if $mod->{name} eq $module; } push @{ $moduleprov{$dist} }, @provided_matching_mods; } - return \%moduleprov; + return \%moduleprov, \%specialvs; } for my $module ( keys %modules ) { for my $declaration ( @{ $modules{$module} } ) { @@ -93,9 +145,9 @@ for my $module ( keys %modules ) { my $want_string =3D "$release -> " . $declaration->[2] . " " . $decl= aration->[3] . " " . $depstring; =20 =20 - my %moduleprov =3D %{ provider_map( $module ) }; + my ( $moduleprov, $specialvs ) =3D provider_map( $module , $declarat= ion->[0]); =20 - my $pc =3D scalar keys %moduleprov; + my $pc =3D scalar keys %$moduleprov; =20 my $multi =3D ( $pc > 1 ); my $any =3D ( $pc > 0 ); @@ -112,17 +164,23 @@ for my $module ( keys %modules ) { *STDERR->printf("%sWARNING: MULTIPLE PROVIDERS FOUND FOR \"%s\"%s\= n", "\e[1;91m", $module, "\e[0m" ); } =20 - for my $prov ( keys %moduleprov ) { + my $indent =3D " \e[1;92m*"; + $indent =3D " \e[1;91m*" if $multi; + + for my $prov ( keys %{$moduleprov} ) { my $prefix =3D $depstring . ' in ' . $prov; - my $lines =3D xwrap( join q[, ], @{$moduleprov{ $prov } } ); + my $lines =3D xwrap( join q[, ], @{$moduleprov->{ $prov } } ); my ( @slines ) =3D split /$/m , $lines; $_ =3D~ s/[\r\n]*//m for @slines; *STDERR->printf(" %s%s -> %s%s\n", "\e[1;92m", $depstring, "\e[0m= \e[92m" ,$prov); + *STDERR->printf("%s newest: %s\e[0m\n", $indent, $specialvs->{new= est}->{$prov}); + *STDERR->printf("%s oldest: %s\e[0m\n", $indent, $specialvs->{old= est}->{$prov}); + my $v =3D $specialvs->{closest}->{$prov}; + if( not defined $v ){ $v =3D 'undef' } + *STDERR->printf("%s closest: %s\e[0m\n", $indent, $v ); for ( @slines ) { - *STDERR->print(" \e[1;91m*") if $multi; - *STDERR->print(" \e[1;92m*") if not $multi; =20 - *STDERR->printf(" %s%s -> %s%s\n", "\e[1;94m", $prov , "\e[0m\= e[94m", $_ ); + *STDERR->printf("%s %s%s -> %s%s\n", $indent, "\e[1;94m", $prov= , "\e[0m\e[94m", $_ ); } } if ( $multi ){