From 7bb632b02464febd8806ef4bd3fa0ac107f52650 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 10 Jul 2014 20:43:04 +0200 Subject: nix-copy-closure -s: Do substitutions via ‘nix-store --serve’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This means we no longer need an SSH master connection, since we only execute a single command on the remote host. --- perl/lib/Nix/CopyClosure.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'perl/lib') diff --git a/perl/lib/Nix/CopyClosure.pm b/perl/lib/Nix/CopyClosure.pm index 53da72038d64..779d7439f677 100644 --- a/perl/lib/Nix/CopyClosure.pm +++ b/perl/lib/Nix/CopyClosure.pm @@ -29,16 +29,12 @@ sub copyTo { my ($sshHost, $sshOpts, $storePaths, $compressor, $decompressor, $includeOutputs, $dryRun, $sign, $progressViewer, $useSubstitutes) = @_; + $useSubstitutes = 0 if $dryRun; + # Get the closure of this path. my @closure = reverse(topoSortPaths(computeFSClosure(0, $includeOutputs, map { followLinksToStorePath $_ } @{$storePaths}))); - # Optionally use substitutes on the remote host. - if (!$dryRun && $useSubstitutes) { - system "ssh $sshHost @{$sshOpts} nix-store -r --ignore-unknown @closure"; - # Ignore exit status because this is just an optimisation. - } - # Start ‘nix-store --serve’ on the remote host. my ($from, $to); my $pid = open2($from, $to, "ssh $sshHost @{$sshOpts} nix-store --serve --write"); @@ -60,8 +56,9 @@ sub copyTo { # Send the "query valid paths" command with the "lock" option # enabled. This prevents a race where the remote host - # garbage-collect paths that are already there. - syswrite($to, pack("L