diff options
author | Joerg Jaspert <joerg@debian.org> | 2016-11-08 20:08:01 +0300 |
---|---|---|
committer | Benjamin Drung <benjamin.drung@profitbricks.com> | 2016-11-08 20:24:01 +0300 |
commit | ca24918f57c53f128741398a5255d6aa6c95ca34 (patch) | |
tree | 4475b479e9cc6dd6b174355743269111b8ad25d7 | |
parent | 408721e8f04f3e250744bcfde5b5caf0e864f1e8 (diff) |
Support non-existing .gz index files
apt-mirror hardcodes .gz usage and as such is no longer able to
actually mirror Debian (experimental).
Use .xz or .bz2 index files when there are not .gz index files.
fixes #30
Closes: #819974
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
-rwxr-xr-x | apt-mirror | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -752,7 +752,7 @@ sub remove_spaces($) } } -sub process_index_gz +sub process_index { my $uri = shift; my $index = shift; @@ -762,14 +762,22 @@ sub process_index_gz local $/ = "\n\n"; $mirror = get_variable("mirror_path") . "/" . $path; - if ( $index =~ s/\.gz$// ) + if (-e "$path/$index.gz" ) { system("gunzip < $path/$index.gz > $path/$index"); } + elsif (-e "$path/$index.xz" ) + { + system("xz -d < $path/$index.xz > $path/$index"); + } + elsif (-e "$path/$index.bz2" ) + { + system("bzip2 -d < $path/$index.bz2 > $path/$index"); + } unless ( open STREAM, "<$path/$index" ) { - warn("apt-mirror: can't open index in process_index_gz"); + warn("apt-mirror: can't open index $path/$index in process_index"); return; } @@ -827,12 +835,12 @@ foreach (@config_sources) my $component; foreach $component (@components) { - process_index_gz( $uri, "/dists/$distribution/$component/source/Sources.gz" ); + process_index( $uri, "/dists/$distribution/$component/source/Sources" ); } } else { - process_index_gz( $uri, "/$distribution/Sources.gz" ); + process_index( $uri, "/$distribution/Sources" ); } } @@ -845,12 +853,12 @@ foreach (@config_binaries) my $component; foreach $component (@components) { - process_index_gz( $uri, "/dists/$distribution/$component/binary-$arch/Packages.gz" ); + process_index( $uri, "/dists/$distribution/$component/binary-$arch/Packages" ); } } else { - process_index_gz( $uri, "/$distribution/Packages.gz" ); + process_index( $uri, "/$distribution/Packages" ); } } |