diff options
author | Georgi Georgiev <chutz@gg3.net> | 2022-05-15 09:07:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 09:07:34 +0300 |
commit | da97e701d5188316cc5d2cc7f4ffada47a880aba (patch) | |
tree | 38bd8e22156b26c32ee1af8864d3de0851786105 | |
parent | edb6bd4726d0e0165f2f85df79438ee36407f35b (diff) |
Refactor: Anything downloaded should be kept (#19)metadata
Refactor this skipclean logic to only do it in one place. The logic is
pretty simple - if we decided to download a file, then we *must* keep
it.
There is no need for the copy-pasta.
Not keeping the logic to keep the uncompressed version of compressed
files, because if we did not download the uncompressed files, there is
no reason why we should be trying to keep them.
-rwxr-xr-x | apt-mirror | 31 |
1 files changed, 4 insertions, 27 deletions
@@ -401,6 +401,10 @@ sub add_url_to_download { my $url = remove_double_slashes(shift); $urls_to_download{$url} = shift; + $url =~ s[^(\w+)://][]; + $url =~ s[~][%7E]g if get_variable("_tilde"); + $url =~ s[\+][%2B]g if get_variable("_plus"); + $skipclean{$url} = 1; } foreach (@config_sources) @@ -487,17 +491,6 @@ chdir get_variable("skel_path") or die("apt-mirror: can't chdir to skel"); @index_urls = sort keys %urls_to_download; download_urls( "index", @index_urls ); -foreach ( keys %urls_to_download ) -{ - s[^(\w+)://][]; - s[~][%7E]g if get_variable("_tilde"); - s[\+][%2B]g if get_variable("_plus"); - $skipclean{$_} = 1; - $skipclean{$_} = 1 if s[\.gz$][]; - $skipclean{$_} = 1 if s[\.bz2$][]; - $skipclean{$_} = 1 if s[\.xz$][]; -} - ###################################################################################### ## Translation index download @@ -648,14 +641,6 @@ print "]\n\n"; push( @index_urls, sort keys %urls_to_download ); download_urls( "translation", sort keys %urls_to_download ); -foreach ( keys %urls_to_download ) -{ - s[^(\w+)://][]; - s[~][%7E]g if get_variable("_tilde"); - s[\+][%2B]g if get_variable("_plus"); - $skipclean{$_} = 1; -} - ###################################################################################### ## DEP-11 index download @@ -740,14 +725,6 @@ print "]\n\n"; push( @index_urls, sort keys %urls_to_download ); download_urls( "dep11", sort keys %urls_to_download ); -foreach ( keys %urls_to_download ) -{ - s[^(\w+)://][]; - s[~][%7E]g if get_variable("_tilde"); - s[\+][%2B]g if get_variable("_plus"); - $skipclean{$_} = 1; -} - ###################################################################################### ## Main download preparations |