Update sources suite
authorAlexander Wirt <formorer@grml.org>
Thu, 22 Oct 2009 07:40:22 +0000 (09:40 +0200)
committerAlexander Wirt <formorer@grml.org>
Thu, 22 Oct 2009 07:40:22 +0000 (09:40 +0200)
source-report/gen_index
source-report/get_sources

index 230ca93..9a516ee 100755 (executable)
@@ -45,7 +45,7 @@ foreach my $releasefile (@status_files) {
                if (/^Packages: (.*)$/) { $packages = $1; next; }
                if (/^Baseurl: (.*)$/) { $baseurl = $1; next; }
        }
-       $t->addRow(     "<a href='$baseurl'>$release</a>", 
+       $t->addRow(     "<a href='$baseurl'>".lc($release)."</a>", 
                        "$packages", 
                        "$sources",
                        "$errors", 
index c63ac0c..c9a867b 100755 (executable)
@@ -140,6 +140,34 @@ foreach my $package (keys %{$package_tree}) {
                        next; 
        }
        $package_tree->{$package}->{'errors'} = (); 
+       my $fn; 
+       my $fversion = $version;; 
+       if ($version =~ /^\d+:(.*)/) {
+               $fn = $config->{sourcedir}."/$source/${source}_$1.dsc";
+               $fversion = $1; 
+       } else {
+               $fn = $config->{sourcedir}."/$source/${source}_$version.dsc"; 
+       }
+
+       if (-e  $fn) {
+               print "$fn found - skipping\n" if $debug;
+               $package_tree->{$package}->{'status'} = 'OK';
+               if (! -d $config->{reportdir}."/$source") {
+                       mkdir ($config->{reportdir}."/$source")
+                               or die "Could not create package dir '".$config->{reportdir}."/$source':$!";
+               }
+
+               if ($version =~ /^([^-]+)-/) {
+                       link $config->{sourcedir}."/$source/${source}_${fversion}.dsc",$config->{reportdir}."/$source/${source}_${fversion}.dsc";
+                       link $config->{sourcedir}."/$source/${source}_${fversion}.diff.gz",$config->{reportdir}."/$source/${source}_${fversion}.diff.gz";
+                       link $config->{sourcedir}."/$source/${source}_$1.orig.tar.gz",$config->{reportdir}."/$source/${source}_$1.orig.tar.gz"; 
+               } else {
+                       link $config->{sourcedir}."/$source/${source}_${fversion}.dsc",$config->{reportdir}."/$source/${source}_${fversion}.dsc";
+                       link $config->{sourcedir}."/$source/${source}_${fversion}.tar.gz",$config->{reportdir}."/$source/${source}_${fversion}.tar.gz";
+               }
+               next; 
+       }
+       
        open (my $fh, '-|', "apt-get -c=apt-config --print-uris -d source $source=$version 2>&1 ") 
                or warn "Could not launch apt-get command:$!"; 
        while (my $line = <$fh>) {
@@ -163,6 +191,11 @@ foreach my $package (keys %{$package_tree}) {
                        if ( -e $config->{sourcedir}."/$source/$filename" ) {
                                if ($md5sum eq md5_from_file($config->{sourcedir}."/$source/$filename")) {
                                        print $config->{sourcedir}."/$source/$filename already downloaded\n" if $debug;
+                                       open (my $urifh, '>', $config->{sourcedir}."/$source/$filename.md5")
+                                                or die "Could not open " . $config->{sourcedir}."/$source/$filename.md5 for writing: $!";
+                                        print $urifh $md5sum;
+                                        close $urifh;
+
                                        $status = 1; 
                                } else { 
                                        print $config->{sourcedir}."/$source/$filename corrupt - download again\n" if $debug; 
@@ -190,7 +223,8 @@ foreach my $package (keys %{$package_tree}) {
                                } else {
                                        print STDERR "md5sum mismatch of $uri\n";
                                        push @{$package_tree->{$package}->{'errors'}}, "$uri failed: md5sum mismatch";
-                                       $error =1; 
+                                       unlink $config->{sourcedir}."/$source/$filename.md5";
+                                       $error =1;
                                }
                        }
                        if (! $error) {