* Remove the localPaths feature in manifests since it's no longer used

and redundant anyway.
This commit is contained in:
Eelco Dolstra 2011-04-06 09:16:22 +00:00
parent 0423d0692a
commit 1e7e4f21ba
7 changed files with 10 additions and 47 deletions

View file

@ -23,7 +23,7 @@ sub addPatch {
sub readManifest { sub readManifest {
my ($manifest, $narFiles, $localPaths, $patches) = @_; my ($manifest, $narFiles, $patches) = @_;
open MANIFEST, "<$manifest" open MANIFEST, "<$manifest"
or die "cannot open `$manifest': $!"; or die "cannot open `$manifest': $!";
@ -99,21 +99,6 @@ sub readManifest {
}; };
} }
elsif ($type eq "localPath") {
$$localPaths{$storePath} = []
unless defined $$localPaths{$storePath};
my $localPathsList = $$localPaths{$storePath};
# !!! remove duplicates
push @{$localPathsList},
{ copyFrom => $copyFrom, references => $references
, deriver => ""
};
}
} }
elsif (/^\s*StorePath:\s*(\/\S+)\s*$/) { $storePath = $1; } elsif (/^\s*StorePath:\s*(\/\S+)\s*$/) { $storePath = $1; }

View file

@ -19,11 +19,10 @@ my $fast = 1;
# Load all manifests. # Load all manifests.
my %narFiles; my %narFiles;
my %localPaths;
my %patches; my %patches;
for my $manifest (glob "$manifestDir/*.nixmanifest") { for my $manifest (glob "$manifestDir/*.nixmanifest") {
my $version = readManifest($manifest, \%narFiles, \%localPaths, \%patches); my $version = readManifest($manifest, \%narFiles, \%patches);
if ($version < 3) { if ($version < 3) {
print STDERR "you have an old-style manifest `$manifest'; please delete it\n"; print STDERR "you have an old-style manifest `$manifest'; please delete it\n";
exit 1; exit 1;
@ -189,8 +188,7 @@ if ($ARGV[0] eq "--query") {
if ($cmd eq "have") { if ($cmd eq "have") {
my $storePath = <STDIN>; chomp $storePath; my $storePath = <STDIN>; chomp $storePath;
print STDOUT ((defined $narFiles{$storePath} or defined $localPaths{$storePath}) print STDOUT (defined $narFiles{$storePath} ? "1\n" : "0\n");
? "1\n" : "0\n");
} }
elsif ($cmd eq "info") { elsif ($cmd eq "info") {
@ -200,9 +198,6 @@ if ($ARGV[0] eq "--query") {
if (defined $narFiles{$storePath}) { if (defined $narFiles{$storePath}) {
$info = @{$narFiles{$storePath}}[0]; $info = @{$narFiles{$storePath}}[0];
} }
elsif (defined $localPaths{$storePath}) {
$info = @{$localPaths{$storePath}}[0];
}
else { else {
print "0\n"; print "0\n";
next; # not an error next; # not an error
@ -267,19 +262,6 @@ print LOGFILE "$$ get $targetPath $date\n";
print "\n*** Trying to download/patch `$targetPath'\n"; print "\n*** Trying to download/patch `$targetPath'\n";
# If we can copy from a local path, do that.
my $localPathList = $localPaths{$targetPath};
foreach my $localPath (@{$localPathList}) {
my $sourcePath = $localPath->{copyFrom};
if (-e $sourcePath) {
print "\n*** Step 1/1: copying from $sourcePath\n";
system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $targetPath") == 0
or die "cannot copy `$sourcePath' to `$targetPath'";
exit 0;
}
}
# Compute the shortest path. # Compute the shortest path.
my @path = computeSmallestDownload $targetPath; my @path = computeSmallestDownload $targetPath;
die "don't know how to produce $targetPath\n" if scalar @path == 0; die "don't know how to produce $targetPath\n" if scalar @path == 0;

View file

@ -7,12 +7,11 @@ use readcache;
# Read the manifests. # Read the manifests.
my %narFiles; my %narFiles;
my %localPaths;
my %patches; my %patches;
foreach my $manifest (@ARGV) { foreach my $manifest (@ARGV) {
print STDERR "loading $manifest\n"; print STDERR "loading $manifest\n";
if (readManifest($manifest, \%narFiles, \%localPaths, \%patches, 1) < 3) { if (readManifest($manifest, \%narFiles, \%patches, 1) < 3) {
# die "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n"; # die "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
} }
} }

View file

@ -26,10 +26,10 @@ my $srcManifest = $ARGV[3];
my $dstManifest = $ARGV[4]; my $dstManifest = $ARGV[4];
my (%srcNarFiles, %srcLocalPaths, %srcPatches); my (%srcNarFiles, %srcLocalPaths, %srcPatches);
readManifest $srcManifest, \%srcNarFiles, \%srcLocalPaths, \%srcPatches; readManifest $srcManifest, \%srcNarFiles, \%srcPatches;
my (%dstNarFiles, %dstLocalPaths, %dstPatches); my (%dstNarFiles, %dstLocalPaths, %dstPatches);
readManifest $dstManifest, \%dstNarFiles, \%dstLocalPaths, \%dstPatches; readManifest $dstManifest, \%dstNarFiles, \%dstPatches;
my $tmpDir = tempdir("nix-generate-patches.XXXXXX", CLEANUP => 1, TMPDIR => 1) my $tmpDir = tempdir("nix-generate-patches.XXXXXX", CLEANUP => 1, TMPDIR => 1)
or die "cannot create a temporary directory"; or die "cannot create a temporary directory";

View file

@ -26,7 +26,6 @@ if (! -e $manifestDir) {
# Process the URLs specified on the command line. # Process the URLs specified on the command line.
my %narFiles; my %narFiles;
my %localPaths;
my %patches; my %patches;
my $skipWrongStore = 0; my $skipWrongStore = 0;
@ -70,7 +69,7 @@ sub processURL {
$manifest = downloadFile $url; $manifest = downloadFile $url;
} }
my $version = readManifest($manifest, \%narFiles, \%localPaths, \%patches); my $version = readManifest($manifest, \%narFiles, \%patches);
die "`$url' is not a manifest or it is too old (i.e., for Nix <= 0.7)\n" if $version < 3; die "`$url' is not a manifest or it is too old (i.e., for Nix <= 0.7)\n" if $version < 3;
die "manifest `$url' is too new\n" if $version >= 5; die "manifest `$url' is too new\n" if $version >= 5;
@ -129,5 +128,5 @@ while (@ARGV) {
} }
my $size = scalar (keys %narFiles) + scalar (keys %localPaths); my $size = scalar (keys %narFiles);
print "$size store paths in manifest\n"; print "$size store paths in manifest\n";

View file

@ -6,10 +6,9 @@ use readmanifest;
for my $p (@ARGV) { for my $p (@ARGV) {
my %narFiles; my %narFiles;
my %localPaths;
my %patches; my %patches;
readManifest $p, \%narFiles, \%localPaths, \%patches; readManifest $p, \%narFiles, \%patches;
%patches = (); %patches = ();

View file

@ -8,10 +8,9 @@ die unless scalar @ARGV == 2;
my $cache = $ARGV[0]; my $cache = $ARGV[0];
my $manifest = $ARGV[1]; my $manifest = $ARGV[1];
my %narFiles; my %narFiles;
my %localPaths;
my %patches; my %patches;
readManifest $manifest, \%narFiles, \%localPaths, \%patches; readManifest $manifest, \%narFiles, \%patches;
foreach my $storePath (keys %narFiles) { foreach my $storePath (keys %narFiles) {
my $narFileList = $narFiles{$storePath}; my $narFileList = $narFiles{$storePath};