* Update the cleanup script.

This commit is contained in:
Eelco Dolstra 2011-08-27 16:59:32 +00:00
parent a95ba4cdd9
commit 5bcdc7e351
3 changed files with 12 additions and 8 deletions

View file

@ -1,2 +1,2 @@
./gc-releases.pl /data/webserver/dist/*/*/MANIFEST > dead
cat dead | xargs mv --target-directory=/data/webserver/trash/
./gc-releases.pl /data/releases/patches/all-patches $(find /data/releases -name MANIFEST) | sort > dead
cat dead | xargs -d '\n' sh -c 'find "$@" -mtime +100 -print' | xargs -d '\n' mv -v --target-directory=/data/releases/trash/

View file

@ -1,8 +1,9 @@
#! /usr/bin/perl -w -I. -I..
#! /var/run/current-system/sw/bin/perl -w -I. -I..
use strict;
use readmanifest;
use NixManifest;
use readcache;
use File::Basename;
# Read the manifests.
@ -49,6 +50,9 @@ foreach my $patch (keys %patches) {
foreach my $archive (keys %readcache::archives) {
next if $archive eq "." || $archive eq "..";
if (!defined $usedFiles{$archive}) {
print $readcache::archives{$archive}, "\n";
my $file = $readcache::archives{$archive};
print "$file\n";
my $hashFile = dirname($file) . "/.hash." . basename($file);
print "$hashFile\n" if -e $hashFile;
}
}

View file

@ -9,13 +9,13 @@ sub readDir {
opendir(DIR, "$dir") or die "cannot open `$dir': $!";
my @as = readdir DIR;
foreach my $archive (@as) {
next unless $archive =~ /^sha256_/ || $archive =~ /\.nar-bsdiff$/ || $archive =~ /\.nar\.bz2$/;
$archives{$archive} = "$dir/$archive";
}
closedir DIR;
}
readDir "/data/webserver/dist/nix-cache";
readDir "/data/webserver/dist/test-cache";
readDir "/data/webserver/dist/patches";
readDir "/data/releases/nars";
readDir "/data/releases/patches";
print STDERR scalar (keys %archives), "\n";