2011-08-27 16:59:32 +00:00
|
|
|
#! /var/run/current-system/sw/bin/perl -w -I. -I..
|
2005-03-14 14:03:41 +00:00
|
|
|
|
|
|
|
use strict;
|
2011-08-27 16:59:32 +00:00
|
|
|
use NixManifest;
|
2006-02-22 14:35:19 +00:00
|
|
|
use readcache;
|
2011-08-27 16:59:32 +00:00
|
|
|
use File::Basename;
|
2005-03-14 14:03:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Read the manifests.
|
|
|
|
my %narFiles;
|
|
|
|
my %patches;
|
|
|
|
|
|
|
|
foreach my $manifest (@ARGV) {
|
|
|
|
print STDERR "loading $manifest\n";
|
2011-04-06 09:16:22 +00:00
|
|
|
if (readManifest($manifest, \%narFiles, \%patches, 1) < 3) {
|
2005-03-14 14:03:41 +00:00
|
|
|
# die "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Find the live archives.
|
|
|
|
my %usedFiles;
|
|
|
|
|
|
|
|
foreach my $narFile (keys %narFiles) {
|
|
|
|
foreach my $file (@{$narFiles{$narFile}}) {
|
|
|
|
$file->{url} =~ /\/([^\/]+)$/;
|
|
|
|
my $basename = $1;
|
|
|
|
die unless defined $basename;
|
|
|
|
# print $basename, "\n";
|
|
|
|
$usedFiles{$basename} = 1;
|
2006-02-22 14:10:02 +00:00
|
|
|
print STDERR "missing archive `$basename'\n"
|
2006-02-22 14:35:19 +00:00
|
|
|
unless defined $readcache::archives{$basename};
|
2005-03-14 14:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach my $patch (keys %patches) {
|
|
|
|
foreach my $file (@{$patches{$patch}}) {
|
|
|
|
$file->{url} =~ /\/([^\/]+)$/;
|
|
|
|
my $basename = $1;
|
|
|
|
die unless defined $basename;
|
|
|
|
# print $basename, "\n";
|
|
|
|
$usedFiles{$basename} = 1;
|
|
|
|
die "missing archive `$basename'"
|
2006-02-22 14:35:19 +00:00
|
|
|
unless defined $readcache::archives{$basename};
|
2005-03-14 14:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Print out the dead archives.
|
2006-02-22 14:35:19 +00:00
|
|
|
foreach my $archive (keys %readcache::archives) {
|
2005-03-14 14:03:41 +00:00
|
|
|
next if $archive eq "." || $archive eq "..";
|
|
|
|
if (!defined $usedFiles{$archive}) {
|
2011-08-27 16:59:32 +00:00
|
|
|
my $file = $readcache::archives{$archive};
|
|
|
|
print "$file\n";
|
|
|
|
my $hashFile = dirname($file) . "/.hash." . basename($file);
|
|
|
|
print "$hashFile\n" if -e $hashFile;
|
2005-03-14 14:03:41 +00:00
|
|
|
}
|
|
|
|
}
|