diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-28T21·10+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-28T21·10+0000 |
commit | 47706e3924cf592a4e0085eb2e45f0e84b67f933 (patch) | |
tree | a8774f45ed36fa8798f81470ed8ce07736e91253 /scripts | |
parent | 6e946c8e72e0fd2baa58cab484a34debd2ae906d (diff) |
* nix-copy-closure: compute the closure in one call to nix-store,
which is much faster.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build-remote.pl.in | 2 | ||||
-rw-r--r-- | scripts/nix-copy-closure.in | 34 |
2 files changed, 10 insertions, 26 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in index 91b57d5f24f6..ef8d3bbea02c 100755 --- a/scripts/build-remote.pl.in +++ b/scripts/build-remote.pl.in @@ -175,7 +175,7 @@ print "copying inputs...\n"; my $maybeSign = ""; $maybeSign = "--sign" if -e "/nix/etc/nix/signing-key.sec"; -system("NIX_SSHOPTS=\"$sshOpts\" nix-copy-closure --gzip $hostName $maybeSign $drvPath $inputs") == 0 +system("NIX_SSHOPTS=\"$sshOpts\" @bindir@/nix-copy-closure --gzip $hostName $maybeSign $drvPath $inputs") == 0 or die "cannot copy inputs to $hostName: $?"; print "building...\n"; diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in index 688bec72824d..4f31953b922a 100644 --- a/scripts/nix-copy-closure.in +++ b/scripts/nix-copy-closure.in @@ -55,30 +55,18 @@ while (@ARGV) { if ($toMode) { # Copy TO the remote machine. my @allStorePaths; - my %storePathsSeen; - foreach my $storePath (@storePaths) { - # $arg might be a symlink to the store, so resolve it. - my $storePath2 = (`$binDir/nix-store --query --resolve '$storePath'` - or die "cannot resolve `$storePath'"); - chomp $storePath2; - - # Get the closure of this path. - my $pid = open(READ, - "$binDir/nix-store --query --requisites '$storePath2'|") or die; + # Get the closure of this path. + my $pid = open(READ, "$binDir/nix-store --query --requisites @storePaths|") or die; - while (<READ>) { - chomp; - die "bad: $_" unless /^\//; - if (!defined $storePathsSeen{$_}) { - push @allStorePaths, $_; - $storePathsSeen{$_} = 1; - } - } - - close READ or die "nix-store failed: $?"; + while (<READ>) { + chomp; + die "bad: $_" unless /^\//; + push @allStorePaths, $_; } + close READ or die "nix-store failed: $?"; + # Ask the remote host which paths are invalid. open(READ, "ssh @sshOpts $sshHost nix-store --check-validity --print-invalid @allStorePaths|"); @@ -111,15 +99,11 @@ else { # Copy FROM the remote machine. "ssh @sshOpts $sshHost nix-store --query --requisites @storePaths|") or die; my @allStorePaths; - my %storePathsSeen; while (<READ>) { chomp; die "bad: $_" unless /^\//; - if (!defined $storePathsSeen{$_}) { - push @allStorePaths, $_; - $storePathsSeen{$_} = 1; - } + push @allStorePaths, $_; } close READ or die "nix-store on remote machine `$sshHost' failed: $?"; |