summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfiles/reprepro/snapshots/time_based/tails-delete-expired-apt-snapshots16
1 files changed, 10 insertions, 6 deletions
diff --git a/files/reprepro/snapshots/time_based/tails-delete-expired-apt-snapshots b/files/reprepro/snapshots/time_based/tails-delete-expired-apt-snapshots
index 99be045..4d88a70 100755
--- a/files/reprepro/snapshots/time_based/tails-delete-expired-apt-snapshots
+++ b/files/reprepro/snapshots/time_based/tails-delete-expired-apt-snapshots
@@ -14,12 +14,13 @@ use warnings;
use DateTime;
use DateTime::Format::Mail;
+use English qw{-no_match_vars};
use File::Basename;
use File::Find::Rule;
use File::Path qw(remove_tree);
use File::Slurp;
use Getopt::Long;
-use IPC::System::Simple qw(capturex runx);
+use IPC::System::Simple qw(runx);
use List::MoreUtils qw(uniq);
@@ -68,12 +69,15 @@ my @snapshots_dirs = File::Find::Rule->directory()
verbose_print("found snapshots directories: @snapshots_dirs\n");
# Let's load once and for all references known by reprepro to see
-# which suites/snapshots are present there to see what needs removing:
+# which suites/snapshots are present there to see what needs removing
+# (use a shell pipeline to avoid loading the entire output of
+# dumpreferences into memory; we've seen it take no less than 7.5 GiB):
my @reprepro_references =
- uniq
- map { (split / /, $_)[0] }
- grep { $_ =~ /^s=/ }
- capturex('reprepro', '-b', $archive_dir, 'dumpreferences');
+ `reprepro -b '$archive_dir' dumpreferences \\
+ | awk '/^s=/ {print \$1}' \\
+ | sort -u`;
+${^CHILD_ERROR_NATIVE} == 0
+ or die "E: Failed to load references: ${^CHILD_ERROR_NATIVE}";
verbose_print("reprepro-known snapshot references:", (join "\n - ", '', @reprepro_references), "\n");
my $now = DateTime->now();