William Kenworthy:
> Is there a link that states how many packages are available in
> gentoo? Stable, ~x86 etc?

Do you speak perl? Sorry, I don't speak python any more ;-)

==== begin gentoo_packages.pl ====
#!/usr/bin/perl

use strict;
use File::Find;
use vars qw/*name/;
*name   = *File::Find::name;

# Your architecture
my $arch = 'x86';
# $uniq == 1 -> nss_ldap-207.ebuild and
# nss_ldap-215-r1.ebuild are the same package
my $uniq = 1;
# $categ == 1 -> package names like 'sys-auth/nss_ldsp'
# $categ == 0 -> package names like 'nss_ldap'
my $categ = 1;
# Output:
my $sfile = 'stable';
my $tfile = 'testing';

my %stable;
my %testing;
my @stable;
my @testing;

find(\&wanted, '/usr/portage');
@stable = sort keys %stable;
@testing = sort keys %testing;
$"="\n";
open OUT, '>'.$sfile or die "Errore opening $sfile: $!\n";
print OUT "@stable\n";
close OUT;
open OUT, '>'.$tfile or die "Errore opening $tfile: $!\n";
print OUT "@testing\n";
close OUT;
print "Done.\n";

sub wanted {
    /^.*\.ebuild\z/s
        && storename($name);
}

sub storename {
    my $fname = $_[0];
    my $shortname;
    my $line;
    my @temp = split('/', $fname);
    print "$fname\n";
    if ($uniq) {
        $temp[5] =~ /(.*)-\d.*ebuild/;
        $temp[5] = $1;
    }
    $shortname = $categ ? $temp[3] . '/' : '';
    $shortname .= $temp[5];
    open EBLD, $fname or die "Error opening $fname: $!\n";
    while ($line=<EBLD>) {
        if ($line =~ /^KEYWORDS/) {
            if ($line =~ /~$arch/) {
                ++$testing{$shortname};
            } elsif ($line =~ /$arch/) {
                ++$stable{$shortname};
            }
            last;
        }
    }
    close EBLD;
}
==== end gentoo_packages.pl ====

Then:
[root ~]# wc stable
  7702   7702 152968 stable
[root ~]# wc testing
 4929  4929 98613 testing

HTH

Sergio

-- 
gentoo-user@gentoo.org mailing list

Reply via email to