diff options
author | Georgi Georgiev <chutz@gg3.net> | 2022-05-17 09:07:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 09:07:36 +0300 |
commit | c672c6e3eaa6a91b1eb5e5c8e3c2c417df06ae9b (patch) | |
tree | 2f93a30018745457bd538f88cf2e2a2693177b30 | |
parent | f4c9f79e8d37a89abe9a9baea6616d8ec1e0f73f (diff) |
Uncompressed index files not downloadable (#21)
https://wiki.debian.org/DebianRepository/Format#Compression_of_indices)
Servers should offer only xz compressed files, except for the
special cases listed above.
even though the Release files would have checksums for the uncompressed
versions as well.
https://wiki.debian.org/DebianRepository/Format#MD5Sum.2C_SHA1.2C_SHA256
The checksum and sizes shall match the actual existing files. If
indexes are compressed, checksum data must be provided for
uncompressed files as well, even if not present on the server.
And if Debian and Ubuntu don't serve the uncompressed ones, do we really
have to bother?
* lzma extension also supported
https://wiki.debian.org/DebianRepository/Format#Compression_of_indices
Unless a compression is indicated by the filename of the indices below, and index may be compressed in one or multiple of the following formats:
- No compression (no extension)
- XZ (.xz extension)
- Gzip (.gz extension, usually for Contents files, and diffs)
- Bzip2 (.bz2 extension, usually for Translations)
- LZMA (.lzma extension)
-rwxr-xr-x | apt-mirror | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -478,7 +478,7 @@ sub find_metadata_in_release my ( $release_uri, $release_path, $line ) = ''; my $component_regex = undef; my $arch_regex = "(?:${arch}|all)"; - my $compressed_extension_regex = '(?:\.(?:gz|bz2|xz))?$'; + my $compressed_extension_regex = '(?:\.(?:gz|bz2|xz|lzma))$'; my $dist_uri; if (@components) @@ -543,11 +543,11 @@ sub find_metadata_in_release ) or ( $filename =~ m{^${component_regex}/cnf/Commands-${arch_regex}${compressed_extension_regex}$} ) or ( - $filename =~ m{^${component_regex}/dep11/Components-${arch_regex}} + $filename =~ m{^${component_regex}/dep11/Components-${arch_regex}.*${compressed_extension_regex}} ) or ( - $filename =~ m{^${component_regex}/dep11/icons-} + $filename =~ m{^${component_regex}/dep11/icons-.*${compressed_extension_regex}} ) or ( - $filename =~ m{^${component_regex}/i18n/Translation-} + $filename =~ m{^${component_regex}/i18n/Translation-.*${compressed_extension_regex}} ) ) { @@ -738,6 +738,10 @@ sub process_index { system("xz -d < $path/$index.xz > $path/$index"); } + elsif (-e "$path/$index.lzma" ) + { + system("xz -d < $path/$index.xz > $path/$index"); + } elsif (-e "$path/$index.bz2" ) { system("bzip2 -d < $path/$index.bz2 > $path/$index"); @@ -894,9 +898,6 @@ foreach (@index_urls) { die("apt-mirror: invalid url in index_urls") unless s[^(\w+)://][]; copy_file( get_variable("skel_path") . "/" . sanitise_uri("$_"), get_variable("mirror_path") . "/" . sanitise_uri("$_") ); - copy_file( get_variable("skel_path") . "/" . sanitise_uri("$_"), get_variable("mirror_path") . "/" . sanitise_uri("$_") ) if (s/\.gz$//); - copy_file( get_variable("skel_path") . "/" . sanitise_uri("$_"), get_variable("mirror_path") . "/" . sanitise_uri("$_") ) if (s/\.bz2$//); - copy_file( get_variable("skel_path") . "/" . sanitise_uri("$_"), get_variable("mirror_path") . "/" . sanitise_uri("$_") ) if (s/\.xz$//); } ###################################################################################### |