diff options
Diffstat (limited to 'scripts/nix-copy-closure.in')
-rw-r--r-- | scripts/nix-copy-closure.in | 34 |
1 files changed, 9 insertions, 25 deletions
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: $?"; |