Package: debmirror
Version: 1:2.4.5
Severity: normal

Here is a patch that should solve the problem in squeeze and wheezy. It gets 
the name of translation files by searching through the Release files, looking 
for files ending with bz2 in the appropriate folder.
941d940
<     get_i18n_index("dists/$dist/$section/i18n") if $i18n;
994c993
<       parse_i18n_index("dists/$dist/$section/i18n");
---
>       i18n_from_release("dists/$dist/$section/i18n");
1444,1445c1443,1444
<   my ($filename, $size, $sha1)=@_;
<   my $digest = Digest::SHA1->new;
---
>   my ($filename, $size, $md5)=@_;
>   my $digest = Digest::MD5->new;
1451c1450
<     $ret = ($sha1 eq $digest->hexdigest);
---
>     $ret = ($md5 eq $digest->hexdigest);
2075,2094c2074
< sub get_i18n_index {
<   my $subdir=shift;
<   if (exists $file_lists{"$tempdir/$subdir/Index"}) {
<     make_dir($subdir);
<     make_dir("$tempdir/$subdir");
< 
<     if (!check_lists ("$tempdir/$subdir/Index")) {
<       say("$subdir/Release needs fetch");
<       if (!remote_get("$subdir/Index")) {
<       push (@errlog,"$subdir/Index failed md5sum check, removing\n");
<       }
<     } else {
<       $bytes_gotten += $file_lists{"$tempdir/$subdir/Index"}{size};
<     }
<     $files{"$subdir/Index"}=1;
<     $files{"$tempdir/$subdir/Index"}=1;
<   }
< }
< 
< sub parse_i18n_index {
---
> sub i18n_from_release {
2096c2076
<   my ($sha1, $size, $filename);
---
>   my $compdir = $tempdir."/".$subdir;
2100,2121c2080,2104
<   # Parse the Index file
<   if (open INDEX, "<$tempdir/$subdir/Index") {
<     while (<INDEX>) {
<       last if /^SHA1:/;
<     }
<     while (<INDEX>) {
<       next unless /^ /;
< 
<       my ($sha1, $size, $filename) = (/ ([a-z0-9]+) +(\d+) +(.*)$/);
<       if(!(defined($include) && ($subdir."/".$filename)=~/$include/o)) {
<       next if (defined($exclude) && ($subdir."/".$filename)=~/$exclude/o);
<       }
< 
<       $files{"$subdir/$filename"}=1;
<       $files{$tempdir."/"."$subdir/$filename"}=1;
<       if (! check_i18n("$tempdir/$subdir/$filename", $size, $sha1)) {
<       $bytes_to_get += $size;
<       $i18n_get{"$subdir/$filename"}{sha1} = $sha1;
<       $i18n_get{"$subdir/$filename"}{size} = $size;
<       }
<     }
<     close INDEX;
---
>   # Create i18n directories
>   make_dir($subdir);
>   make_dir($compdir);
>  
>   # Search for translation files in file_lists
>   foreach my $path (keys %file_lists) {
>     next if length($compdir)+1>length($path); # the +1 stands for the slash 
> after $compdir
>     next if substr($path, 0, length($compdir)) ne $compdir;
> 
>     my $filename = substr($path, length($compdir)+1, 
> length($path)-length($compdir)-1);
>     next if $filename !~ /bz2$/;
>     next if ! $i18n && $filename !~/-en/;
> 
>     my ($md5, $size) = ($file_lists{$path}{md5}, $file_lists{$path}{size});
>     if(!(defined($include) && ($subdir."/".$filename)=~/$include/o)) {
>       next if (defined($exclude) && ($subdir."/".$filename)=~/$exclude/o);
>     }
> 
>     $files{"$subdir/$filename"}=1;
>     $files{$tempdir."/"."$subdir/$filename"}=1;
>     if (! check_i18n("$tempdir/$subdir/$filename", $size, $md5)) {
>       $bytes_to_get += $size;
>       $i18n_get{"$subdir/$filename"}{md5} = $md5;
>       $i18n_get{"$subdir/$filename"}{size} = $size;
>    }
2128c2111
<     if (! check_i18n("$tempdir/$file", $i18n_get{$file}{size}, 
$i18n_get{$file}{sha1})) {
---
>     if (! check_i18n("$tempdir/$file", $i18n_get{$file}{size}, 
> $i18n_get{$file}{md5})) {
995d994
<     get_i18n_index($dist,"$section/i18n");
1047c1046
<     parse_i18n_index($dist,"$section/i18n");
---
>     i18n_from_release($dist,"$section/i18n");
2213,2234c2212
< sub get_i18n_index {
<   my ($dist,$distpath) = @_;
<   my $subdir = "dists/$dist/$distpath";
<   if (exists $file_lists{"$tempdir/$subdir/Index"}) {
<     make_dir($subdir);
<     make_dir("$tempdir/$subdir");
< 
<     if (!check_lists("$tempdir/$subdir/Index")) {
<       if (!remote_get("$subdir/Index")) {
<       push (@errlog,"$subdir/Index failed checksum verification, removing\n");
<       } elsif ($debmarshal) {
<       link_index_into_snapshot($dist,$mirrordir,$distpath,$subdir,$tempdir);
<       }
<     } else {
<       $bytes_gotten += $file_lists{"$tempdir/$subdir/Index"}{size};
<     }
<     $files{"$subdir/Index"}=1;
<     $files{"$tempdir/$subdir/Index"}=1;
<   }
< }
< 
< sub parse_i18n_index {
---
> sub i18n_from_release {
2236a2215
>   my $compdir = $tempdir."/".$subdir;
2241,2264c2220,2246
<   # Parse the Index file
<   if (open INDEX, "<$tempdir/$subdir/Index") {
<     while (<INDEX>) {
<       last if /^SHA1:/;
<     }
<     while (<INDEX>) {
<       last unless /^ /;
< 
<       my ($sha1, $size, $filename) = (/ ([a-z0-9]+) +(\d+) +(.*)$/);
<       if(!(defined($include) && ($subdir."/".$filename)=~/$include/o)) {
<       next if (defined($exclude) && ($subdir."/".$filename)=~/$exclude/o);
<       }
<       next if ! $i18n && $filename !~ /-en/;
< 
<       $files{"$subdir/$filename"}=1;
<       $files{$tempdir."/"."$subdir/$filename"}=1;
<       if (! check_i18n("$tempdir/$subdir/$filename", $size, $sha1)) {
<       $bytes_to_get += $size;
<       $i18n_get{"$subdir/$filename"}{sha1} = $sha1;
<       $i18n_get{"$subdir/$filename"}{size} = $size;
<       $i18n_get{"$subdir/$filename"}{dist} = $dist;
<       $i18n_get{"$subdir/$filename"}{distpath} = $distpath;
<       $i18n_get{"$subdir/$filename"}{filename} = $filename;
<       }
---
>   # Create i18n directories
>   make_dir($subdir);
>   make_dir($compdir);
> 
>   # Search for translation files in file_lists
>   foreach my $path (keys %file_lists) {
>     next if length($compdir)+1>length($path); # the +1 stands for the slash 
> after $compdir
>     next if substr($path, 0, length($compdir)) ne $compdir;
> 
>     my $filename = substr($path, length($compdir)+1, 
> length($path)-length($compdir)-1);
>     next if $filename !~ /bz2$/;
> 
>     my ($sha1, $size) = ($file_lists{$path}{SHA1}, $file_lists{$path}{size});
>     if(!(defined($include) && ($subdir."/".$filename)=~/$include/o)) {
>       next if (defined($exclude) && ($subdir."/".$filename)=~/$exclude/o);
>     }
>     next if ! $i18n && $filename !~ /-en/;
> 
>     $files{"$subdir/$filename"}=1;
>     $files{$tempdir."/"."$subdir/$filename"}=1;
>     if (! check_i18n("$tempdir/$subdir/$filename", $size, $sha1)) {
>       $bytes_to_get += $size;
>       $i18n_get{"$subdir/$filename"}{sha1} = $sha1;
>       $i18n_get{"$subdir/$filename"}{size} = $size;
>       $i18n_get{"$subdir/$filename"}{dist} = $dist;
>       $i18n_get{"$subdir/$filename"}{distpath} = $distpath;
>       $i18n_get{"$subdir/$filename"}{filename} = $filename;
2266d2247
<     close INDEX;

Reply via email to