Remove obsolete files (moved to release tree)
This commit is contained in:
parent
afa7b8a479
commit
0c4c8f7a9d
|
@ -1,2 +0,0 @@
|
|||
./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/
|
|
@ -1,58 +0,0 @@
|
|||
#! /var/run/current-system/sw/bin/perl -w -I. -I..
|
||||
|
||||
use strict;
|
||||
use NixManifest;
|
||||
use readcache;
|
||||
use File::Basename;
|
||||
|
||||
|
||||
# Read the manifests.
|
||||
my %narFiles;
|
||||
my %patches;
|
||||
|
||||
foreach my $manifest (@ARGV) {
|
||||
print STDERR "loading $manifest\n";
|
||||
if (readManifest($manifest, \%narFiles, \%patches, 1) < 3) {
|
||||
# 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;
|
||||
print STDERR "missing archive `$basename'\n"
|
||||
unless defined $readcache::archives{$basename};
|
||||
}
|
||||
}
|
||||
|
||||
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'"
|
||||
unless defined $readcache::archives{$basename};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Print out the dead archives.
|
||||
foreach my $archive (keys %readcache::archives) {
|
||||
next if $archive eq "." || $archive eq "..";
|
||||
if (!defined $usedFiles{$archive}) {
|
||||
my $file = $readcache::archives{$archive};
|
||||
print "$file\n";
|
||||
my $hashFile = dirname($file) . "/.hash." . basename($file);
|
||||
print "$hashFile\n" if -e $hashFile;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package readcache;
|
||||
use strict;
|
||||
|
||||
# Read the archive directories.
|
||||
our %archives;
|
||||
|
||||
sub readDir {
|
||||
my $dir = shift;
|
||||
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/releases/nars";
|
||||
readDir "/data/releases/patches";
|
||||
|
||||
print STDERR scalar (keys %archives), "\n";
|
|
@ -1,76 +0,0 @@
|
|||
#! /usr/bin/perl -w -I. -I..
|
||||
|
||||
use strict;
|
||||
use readmanifest;
|
||||
use readcache;
|
||||
|
||||
|
||||
my %allNarFiles;
|
||||
my %allLocalPaths;
|
||||
my %allPatches;
|
||||
|
||||
foreach my $manifest (glob "/data/webserver/dist/*/*/MANIFEST") {
|
||||
print STDERR "loading $manifest\n";
|
||||
readManifest($manifest, \%allNarFiles, \%allLocalPaths, \%allPatches, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach my $manifest (@ARGV) {
|
||||
|
||||
print STDERR "shrinking manifest $manifest...\n";
|
||||
|
||||
my %narFiles;
|
||||
my %patches;
|
||||
|
||||
if (readManifest($manifest, \%narFiles, \%patches, 1) < 3) {
|
||||
print STDERR "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my %done;
|
||||
|
||||
sub traverse {
|
||||
my $p = shift;
|
||||
my $prefix = shift;
|
||||
print "$prefix$p\n";
|
||||
|
||||
my $reachesNAR = 0;
|
||||
|
||||
foreach my $patch (@{$patches{$p}}) {
|
||||
next if defined $done{$patch->{url}};
|
||||
$done{$patch->{url}} = 1;
|
||||
$reachesNAR = 1 if traverse ($patch->{basePath}, $prefix . " ");
|
||||
}
|
||||
|
||||
$reachesNAR = 1 if defined $allNarFiles{$p};
|
||||
|
||||
print " $prefix$reachesNAR\n";
|
||||
return $reachesNAR;
|
||||
}
|
||||
|
||||
# foreach my $p (keys %narFiles) {
|
||||
# traverse ($p, "");
|
||||
# }
|
||||
|
||||
my %newPatches;
|
||||
|
||||
foreach my $p (keys %patches) {
|
||||
my $patchList = $patches{$p};
|
||||
my @newList;
|
||||
foreach my $patch (@{$patchList}) {
|
||||
if (! defined $allNarFiles{$patch->{basePath}} ||
|
||||
! defined $allNarFiles{$p} )
|
||||
{
|
||||
# print "REMOVING PATCH ", $patch->{basePath}, " -> ", $p, "\n";
|
||||
} else {
|
||||
# print "KEEPING PATCH ", $patch->{basePath}, " -> ", $p, "\n";
|
||||
push @newList, $patch;
|
||||
}
|
||||
}
|
||||
$newPatches{$p} = \@newList;
|
||||
}
|
||||
|
||||
writeManifest ($manifest, \%narFiles, \%newPatches);
|
||||
}
|
||||
|
Loading…
Reference in a new issue