On Thu, Oct 12, 2017 at 05:50:23PM +0200, [email protected] wrote: > $ /usr/share/apt-cacher/apt-cacher-cleanup.pl -v > Invoked as root, changing to www-data:www-data and re-execing. > Get /ftp.de.debian.org/debian/dists/testing/InRelease > Get /security.debian.org/dists/testing/updates/InRelease > Reading: ftp.de.debian.org_debian_dists_testing_InRelease > Reading: security.debian.org_dists_testing_updates_InRelease > Found 926 valid file entries
Thanks, this fits with what I worked out might be wrong a few hours ago: your system only has by-hash index files which are not being parsed. Could you try this patch to /usr/share/apt-cacher/apt-cacher-cleanup.pl and see if it helps, please. Thanks Mark commit f7aaf5d443c1947a365fd9c3a8bd7a863cf8c1b1 Author: Mark Hindley <[email protected]> Date: Thu Oct 12 17:33:19 2017 +0100 Include cached by-hash index files if they are referenced by InRelease file so that current packages are preserved. diff --git a/apt-cacher-cleanup.pl b/apt-cacher-cleanup.pl index 5cd8e90..7d51750 100755 --- a/apt-cacher-cleanup.pl +++ b/apt-cacher-cleanup.pl @@ -516,6 +516,36 @@ sub db_compact { return; } +# Parse InRelease for by-hash data +# Return arrayref of by-hash filenames +sub by_hash { + my ($file) = @_; + my @ret; + + open(my $fh, '<', $file) or + die "Failed to open $file: $!"; + + while (<$fh>) { + # Loop through file and only parse it fully if Acquire-By-Hash is set + /^Acquire-By-Hash: yes$/ && do { + my %parsed; + extract_sums($file, $fh, \%parsed) || die("Error extracting by-hash data from $file\n"); + foreach my $index_file (keys %parsed) { + my $href = hashify(\$parsed{$index_file}); + while (my ($k,$v) = each %$href) { + next if $k eq 'size'; + $k = uc $k; + $k .= 'Sum' if $k eq 'MD5'; + (my $possible = $index_file) =~ s/(?:Translation-[a-z]{2}_[A-Z]{2})?[^_]+$/by-hash_${k}_$v/; # beware Translation-??_?? + push @ret, $possible; + } + } + } + } + return \@ret; +} + + ############################################################################# # Manipulate checksum database if (@db_mode || $db_recover){ @@ -700,6 +730,16 @@ foreach my $file (keys %valid) { } } + # Handle by-hash index files + if ($file =~ /InRelease$/) { + foreach my $candidate (@{by_hash($file)}) { + if (-f $candidate) { + printmsg "Cached file $candidate is current by-hash file referenced in $file. Adding to list for parsing\n"; + $valid{$candidate} = 1; + } + } + } + # Remove obsolete Release and Release.gpg if ((my $obsolete = $file) =~ s/InRelease/Release/) { next unless exists $valid{$obsolete};

