]> git.donarmstrong.com Git - wannabuild.git/commitdiff
Throw out unwanted entries in keep-latest
authorJoachim Breitner <nomeata@debian.org>
Wed, 29 Jul 2009 17:06:38 +0000 (19:06 +0200)
committerJoachim Breitner <nomeata@debian.org>
Wed, 29 Jul 2009 17:06:38 +0000 (19:06 +0200)
bin/keep-latest
trigger.often

index c66c41b1200a02a8330ff15287ef0ef871fc82e4..f1383e1dad3d2612c86452bc7c2dc53804be76bf 100755 (executable)
@@ -6,20 +6,26 @@ use warnings;
 use WannaBuild; # for version compare
 
 if (!@ARGV) {
-       print STDERR "Usage: $0 Packages1 Packages2 ..\n";
+       print STDERR "Usage: $0 arch Packages1 Packages2 ..\n";
        print STDERR "\n";
        print STDERR "This perl scripts reads the Packages files given on the command line and\n";
-       print STDERR "outputs a Packages file which contians each package/architecture pair at most\n";
+       print STDERR "outputs a Packages file which contians each package at most\n";
        print STDERR "once, using the one with the highest version number.\n";
        print STDERR "";
        print STDERR "Since it only looks at Package:, Version: and Architecture:, it works with\n";
        print STDERR "Sources files as well\n";
+       print STDERR "\n";
+       print STDERR "It throws out any package not arch \"all\" or the given architecture.\n";
+       print STDERR "Pass \"source\" to keep all entries.\n";
+
        exit 1;
 }
 
 my %version;
 my %data;
 
+my $arch = shift @ARGV;
+
 local($/) = ""; # read in paragraph mode
 while (<>) {
        my( $version, $name, $architecture );
@@ -31,7 +37,10 @@ while (<>) {
                warn "Stanza without Package or Version\n";
                next;
        }
-       my $key = $name."_".$architecture;
+       if ($arch ne "source" && defined $architecture && $architecture ne "all" && $architecture ne $arch) {
+               next;
+       }
+       my $key = $name;
 
        if ((!exists $version{$key}) or version_less($version{$key},$version)) {
                $version{$key} = $version;
index 2cbf584d7717f9b437cf8989657e05c69b8ce91e..1175bb886b8e5a809b7332bc6662ec6bd940819d 100755 (executable)
@@ -51,10 +51,10 @@ if wget $WGETOPT http://incoming.debian.org/buildd/Packages.gz; then
        rm -f Packages-unstable.accepted
        gunzip Packages-unstable.accepted.gz
 fi
-keep-latest Sources.unstable.base Sources-unstable.accepted > Sources.unstable
+keep-latest source Sources.unstable.base Sources-unstable.accepted > Sources.unstable
 for a in $ARCHS_unstable; do
        rm -f Packages.unstable.$a
-       keep-latest Packages.unstable.$a.base Packages-unstable.accepted > Packages.unstable.$a
+       keep-latest $a Packages.unstable.$a.base Packages-unstable.accepted > Packages.unstable.$a
 done
        
 umask 007