parent
a79e56de68
commit
f1adf4c998
2 changed files with 8 additions and 8 deletions
|
@ -47,12 +47,12 @@ sub copyToOpen {
|
||||||
|
|
||||||
|
|
||||||
sub copyTo {
|
sub copyTo {
|
||||||
my ($sshHost, $sshOpts, $storePaths, $includeOutputs, $dryRun, $sign, $useSubstitutes) = @_;
|
my ($sshHost, $storePaths, $includeOutputs, $dryRun, $sign, $useSubstitutes) = @_;
|
||||||
|
|
||||||
# Connect to the remote host.
|
# Connect to the remote host.
|
||||||
my ($from, $to);
|
my ($from, $to);
|
||||||
eval {
|
eval {
|
||||||
($from, $to) = connectToRemoteNix($sshHost, $sshOpts);
|
($from, $to) = connectToRemoteNix($sshHost, []);
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
chomp $@;
|
chomp $@;
|
||||||
|
@ -69,7 +69,7 @@ sub copyTo {
|
||||||
# For backwards compatibility with Nix <= 1.7. Will be removed
|
# For backwards compatibility with Nix <= 1.7. Will be removed
|
||||||
# eventually.
|
# eventually.
|
||||||
sub oldCopyTo {
|
sub oldCopyTo {
|
||||||
my ($sshHost, $sshOpts, $storePaths, $includeOutputs, $dryRun, $sign, $useSubstitutes) = @_;
|
my ($sshHost, $storePaths, $includeOutputs, $dryRun, $sign, $useSubstitutes) = @_;
|
||||||
|
|
||||||
# Get the closure of this path.
|
# Get the closure of this path.
|
||||||
my @closure = reverse(topoSortPaths(computeFSClosure(0, $includeOutputs,
|
my @closure = reverse(topoSortPaths(computeFSClosure(0, $includeOutputs,
|
||||||
|
@ -77,7 +77,7 @@ sub oldCopyTo {
|
||||||
|
|
||||||
# Optionally use substitutes on the remote host.
|
# Optionally use substitutes on the remote host.
|
||||||
if (!$dryRun && $useSubstitutes) {
|
if (!$dryRun && $useSubstitutes) {
|
||||||
system "ssh $sshHost @{$sshOpts} @globalSshOpts nix-store -r --ignore-unknown @closure";
|
system "ssh $sshHost @globalSshOpts nix-store -r --ignore-unknown @closure";
|
||||||
# Ignore exit status because this is just an optimisation.
|
# Ignore exit status because this is just an optimisation.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ sub oldCopyTo {
|
||||||
my $missingSize = 0;
|
my $missingSize = 0;
|
||||||
while (scalar(@closure) > 0) {
|
while (scalar(@closure) > 0) {
|
||||||
my @ps = splice(@closure, 0, 1500);
|
my @ps = splice(@closure, 0, 1500);
|
||||||
open(READ, "set -f; ssh $sshHost @{$sshOpts} @globalSshOpts nix-store --check-validity --print-invalid @ps|");
|
open(READ, "set -f; ssh $sshHost @globalSshOpts nix-store --check-validity --print-invalid @ps|");
|
||||||
while (<READ>) {
|
while (<READ>) {
|
||||||
chomp;
|
chomp;
|
||||||
push @missing, $_;
|
push @missing, $_;
|
||||||
|
@ -103,7 +103,7 @@ sub oldCopyTo {
|
||||||
if (scalar @missing > 0) {
|
if (scalar @missing > 0) {
|
||||||
print STDERR "copying ", scalar @missing, " missing paths to ‘$sshHost’...\n";
|
print STDERR "copying ", scalar @missing, " missing paths to ‘$sshHost’...\n";
|
||||||
unless ($dryRun) {
|
unless ($dryRun) {
|
||||||
open SSH, "| ssh $sshHost @{$sshOpts} @globalSshOpts 'nix-store --import' > /dev/null" or die;
|
open SSH, "| ssh $sshHost @globalSshOpts 'nix-store --import' > /dev/null" or die;
|
||||||
exportPaths(fileno(SSH), $sign, @missing);
|
exportPaths(fileno(SSH), $sign, @missing);
|
||||||
close SSH or die "copying store paths to remote machine ‘$sshHost’ failed: $?";
|
close SSH or die "copying store paths to remote machine ‘$sshHost’ failed: $?";
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,13 +74,13 @@ die "$0: you did not specify a host name\n" unless defined $sshHost;
|
||||||
|
|
||||||
if ($toMode) { # Copy TO the remote machine.
|
if ($toMode) { # Copy TO the remote machine.
|
||||||
Nix::CopyClosure::copyTo(
|
Nix::CopyClosure::copyTo(
|
||||||
$sshHost, [ @sshOpts ], [ @storePaths ],
|
$sshHost, [ @storePaths ],
|
||||||
$includeOutputs, $dryRun, $sign, $useSubstitutes);
|
$includeOutputs, $dryRun, $sign, $useSubstitutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
else { # Copy FROM the remote machine.
|
else { # Copy FROM the remote machine.
|
||||||
|
|
||||||
my ($from, $to) = connectToRemoteNix($sshHost, [ @sshOpts ]);
|
my ($from, $to) = connectToRemoteNix($sshHost);
|
||||||
|
|
||||||
# Query the closure of the given store paths on the remote
|
# Query the closure of the given store paths on the remote
|
||||||
# machine. Paths are assumed to be store paths; there is no
|
# machine. Paths are assumed to be store paths; there is no
|
||||||
|
|
Loading…
Reference in a new issue