about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-08-27T16·59+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-08-27T16·59+0000
commit5bcdc7e3517e6d679cad1aaba41e4deb76d5a6e7 (patch)
treef572f2cb2cfc366dbaa957a70f96a63b7c8120ef /scripts
parenta95ba4cdd9aa9f9c98928732dd26fba2757ade26 (diff)
* Update the cleanup script.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/maintenance/gc-commands4
-rwxr-xr-xscripts/maintenance/gc-releases.pl10
-rw-r--r--scripts/maintenance/readcache.pm6
3 files changed, 12 insertions, 8 deletions
diff --git a/scripts/maintenance/gc-commands b/scripts/maintenance/gc-commands
index 26459c738e8c..3d548da19a2d 100644
--- a/scripts/maintenance/gc-commands
+++ b/scripts/maintenance/gc-commands
@@ -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/
diff --git a/scripts/maintenance/gc-releases.pl b/scripts/maintenance/gc-releases.pl
index 80b2726c5a04..b1e41a97c04f 100755
--- a/scripts/maintenance/gc-releases.pl
+++ b/scripts/maintenance/gc-releases.pl
@@ -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;
     }
 }
diff --git a/scripts/maintenance/readcache.pm b/scripts/maintenance/readcache.pm
index f6beeeeb46d0..9addf02aa900 100644
--- a/scripts/maintenance/readcache.pm
+++ b/scripts/maintenance/readcache.pm
@@ -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";