* Bug fix in nix-push.

This commit is contained in:
Eelco Dolstra 2003-12-01 16:34:35 +00:00
parent 078e20885e
commit a3ca74a1c3
1 changed files with 19 additions and 19 deletions

View File

@ -10,15 +10,11 @@ until mkdir $tmpdir, 0777;
my $nixfile = "$tmpdir/create-nars.nix"; my $nixfile = "$tmpdir/create-nars.nix";
my $manifest = "$tmpdir/MANIFEST"; my $manifest = "$tmpdir/MANIFEST";
END { unlink $manifest; unlink $fixfile; rmdir $tmpdir; } END { unlink $manifest; unlink $nixfile; rmdir $tmpdir; }
open NIX, ">$nixfile";
print NIX "[";
my @paths; my @paths;
foreach my $id (@ARGV) { foreach my $id (@ARGV) {
die unless $id =~ /^\//; die unless $id =~ /^\//;
# Get all paths referenced by the normalisation of the given # Get all paths referenced by the normalisation of the given
@ -33,22 +29,25 @@ foreach my $id (@ARGV) {
push @paths, $_; push @paths, $_;
} }
close PATHS; close PATHS;
}
# For each path, create a Nix expression that turns the path into # For each path, create a Nix expression that turns the path into
# a Nix archive. # a Nix archive.
foreach my $path (@paths) { open NIX, ">$nixfile";
print NIX "[";
die unless ($path =~ /\/[0-9a-z]{32}.*$/); foreach my $path (@paths) {
print "$path\n";
# Construct a Nix expression that creates a Nix archive. die unless ($path =~ /\/[0-9a-z]{32}.*$/);
my $nixexpr = print "$path\n";
"((import @datadir@/nix/corepkgs/nar/nar.nix) " .
# !!! $path should be represented as a closure # Construct a Nix expression that creates a Nix archive.
"{path = \"$path\"; system = \"@system@\"}) "; my $nixexpr =
"((import @datadir@/nix/corepkgs/nar/nar.nix) " .
print NIX $nixexpr; # !!! $path should be represented as a closure
} "{path = \"$path\"; system = \"@system@\"}) ";
print NIX $nixexpr;
} }
print NIX "]"; print NIX "]";
@ -63,6 +62,7 @@ while (<NIDS>) {
chomp; chomp;
die unless /^\//; die unless /^\//;
push @nids, $_; push @nids, $_;
print "$_\n";
} }
close NIDS; close NIDS;
@ -70,7 +70,7 @@ close NIDS;
# Realise the store expression. # Realise the store expression.
print STDERR "creating archives...\n"; print STDERR "creating archives...\n";
system "nix-store --realise -v @nids > /dev/null"; system "nix-store --realise -v @nids > /dev/null";
if ($?) { die "`nix --realise' failed"; } if ($?) { die "`nix-store --realise' failed"; }
my @narpaths; my @narpaths;
open NIDS, "nix-store --query --list @nids |" or die "cannot run nix"; open NIDS, "nix-store --query --list @nids |" or die "cannot run nix";