Commit 29bd24e0 authored by Colin Watson's avatar Colin Watson

Prefer xz over gz, and cope with either being missing as long as we can get...

Prefer xz over gz, and cope with either being missing as long as we can get some version of the index file in question.
parent ced3a2b2
debmirror (1:2.21) UNRELEASED; urgency=medium debmirror (1:2.21) UNRELEASED; urgency=medium
* Generate trace file using LC_ALL=C (closes: #817721). * Generate trace file using LC_ALL=C (closes: #817721).
* Prefer xz over gz, and cope with either being missing as long as we can
get some version of the index file in question.
-- Colin Watson <cjwatson@debian.org> Wed, 09 Mar 2016 21:27:40 +0000 -- Colin Watson <cjwatson@debian.org> Wed, 09 Mar 2016 21:27:40 +0000
......
...@@ -2275,55 +2275,77 @@ sub get_index { ...@@ -2275,55 +2275,77 @@ sub get_index {
$files{"$tempdir/$subdir/$file.diff/Index"}=1; $files{"$tempdir/$subdir/$file.diff/Index"}=1;
} }
if (exists $file_lists{"$tempdir/$subdir/$file.gz"}{size}) { my $got_any_file=0;
if (!check_lists("$tempdir/$subdir/$file.gz")) { if (exists $file_lists{"$tempdir/$subdir/$file.xz"}{size}) {
if (remote_get("$subdir/$file.gz")) { if (!check_lists("$tempdir/$subdir/$file.xz")) {
system_redirect_io("gzip -d", "$tempdir/$subdir/$file.gz", "$tempdir/$subdir/$file"); if (remote_get("$subdir/$file.xz")) {
system_redirect_io("xz -d", "$tempdir/$subdir/$file.xz", "$tempdir/$subdir/$file");
if (! $slow_cpu) { if (! $slow_cpu) {
system_redirect_io("xz", "$tempdir/$subdir/$file", "$tempdir/$subdir/$file.xz"); system_redirect_io("gzip $gzip_options", "$tempdir/$subdir/$file", "$tempdir/$subdir/$file.gz");
} }
$files{"$subdir/$file.xz"}=1;
$files{"$tempdir/$subdir/$file.xz"}=1;
$got_any_file=1;
} else { } else {
push (@errlog,"$subdir/$file.gz failed checksum verification\n"); push (@errlog,"$subdir/$file.xz failed checksum verification\n");
$num_errors++; $num_errors++;
} }
} else { } else {
$bytes_gotten += $file_lists{"$tempdir/$subdir/$file.gz"}{size}; $bytes_gotten += $file_lists{"$tempdir/$subdir/$file.xz"}{size};
$files{"$subdir/$file.xz"}=1;
$files{"$tempdir/$subdir/$file.xz"}=1;
$got_any_file=1;
} }
} elsif ($ignore_missing_release) { }
say("Ignoring missing Release file for $subdir/$file.gz"); if (exists $file_lists{"$tempdir/$subdir/$file.gz"}{size}) {
push (@errlog,"Ignoring missing Release file for $subdir/$file.gz\n"); if (!check_lists("$tempdir/$subdir/$file.gz")) {
if (remote_get("$subdir/$file.gz")) { if (remote_get("$subdir/$file.gz")) {
if (! -f "$tempdir/$subdir/$file") {
system_redirect_io("gzip -d", "$tempdir/$subdir/$file.gz", "$tempdir/$subdir/$file"); system_redirect_io("gzip -d", "$tempdir/$subdir/$file.gz", "$tempdir/$subdir/$file");
} }
if (! -f "$tempdir/$subdir/$file.xz" && ! $slow_cpu) {
system_redirect_io("xz", "$tempdir/$subdir/$file", "$tempdir/$subdir/$file.xz");
}
$files{"$subdir/$file.gz"}=1;
$files{"$tempdir/$subdir/$file.gz"}=1;
$got_any_file=1;
} else { } else {
if (-f "$subdir/$file.gz") { push (@errlog,"$subdir/$file.gz failed checksum verification\n");
say("$subdir/$file.gz exists locally but not in Release"); $num_errors++;
die "Won't mirror without $subdir/$file.gz signature in Release"; }
} else { } else {
say("$subdir/$file.gz does not exist locally or in Release, skipping.") if ($debug); $bytes_gotten += $file_lists{"$tempdir/$subdir/$file.gz"}{size};
$files{"$subdir/$file.gz"}=1;
$files{"$tempdir/$subdir/$file.gz"}=1;
$got_any_file=1;
} }
} }
if (exists $file_lists{"$tempdir/$subdir/$file"}) { if (exists $file_lists{"$tempdir/$subdir/$file"}) {
if (!check_lists("$tempdir/$subdir/$file")) { if (!check_lists("$tempdir/$subdir/$file")) {
if (remote_get("$subdir/$file")) { if (remote_get("$subdir/$file")) {
if (! $slow_cpu) { $got_any_file=1;
system_redirect_io("xz", "$tempdir/$subdir/$file", "$tempdir/$subdir/$file.xz");
}
} else { } else {
push (@errlog,"$subdir/$file failed checksum verification\n"); push (@errlog,"$subdir/$file failed checksum verification\n");
$num_errors++; $num_errors++;
} }
} else { } else {
$bytes_gotten += $file_lists{"$tempdir/$subdir/$file"}{size}; $bytes_gotten += $file_lists{"$tempdir/$subdir/$file"}{size};
$got_any_file=1;
} }
} }
if (exists $file_lists{"$tempdir/$subdir/$file.xz"}) { if ($got_any_file) {
if (!check_lists("$tempdir/$subdir/$file.xz")) { } elsif ($ignore_missing_release) {
if (!remote_get("$subdir/$file.xz")) { say("Ignoring missing Release file for $subdir/$file.gz");
push (@errlog,"$subdir/$file.xz failed checksum verification, removing\n"); push (@errlog,"Ignoring missing Release file for $subdir/$file.gz\n");
if (remote_get("$subdir/$file.gz")) {
system_redirect_io("gzip -d", "$tempdir/$subdir/$file.gz", "$tempdir/$subdir/$file");
} }
} else { } else {
$bytes_gotten += $file_lists{"$tempdir/$subdir/$file.xz"}{size}; if (-f "$subdir/$file.gz") {
say("$subdir/$file.gz exists locally but not in Release");
die "Won't mirror without $subdir/$file.gz signature in Release";
} else {
say("$subdir/$file.gz does not exist locally or in Release, skipping.") if ($debug);
} }
} }
if (exists $file_lists{"$tempdir/$subdir/Release"}) { if (exists $file_lists{"$tempdir/$subdir/Release"}) {
...@@ -2342,13 +2364,9 @@ sub get_index { ...@@ -2342,13 +2364,9 @@ sub get_index {
} else { } else {
die "get_index called with unknown type $file\n"; die "get_index called with unknown type $file\n";
} }
$files{"$subdir/$file.gz"}=1;
$files{"$subdir/$file.xz"}=1;
# Uncompressed files are no longer kept on the mirrors # Uncompressed files are no longer kept on the mirrors
$files{"$subdir/$file"}=1 unless exists $file_lists{"$tempdir/$subdir/$file.gz"}; $files{"$subdir/$file"}=1 unless exists $file_lists{"$tempdir/$subdir/$file.xz"} or exists $file_lists{"$tempdir/$subdir/$file.gz"};
$files{"$subdir/Release"}=1; $files{"$subdir/Release"}=1;
$files{"$tempdir/$subdir/$file.gz"}=1;
$files{"$tempdir/$subdir/$file.xz"}=1;
$files{"$tempdir/$subdir/$file"}=1; $files{"$tempdir/$subdir/$file"}=1;
$files{"$tempdir/$subdir/Release"}=1; $files{"$tempdir/$subdir/Release"}=1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment