forked from lix-project/lix
* nix-copy-closure: compute the closure in one call to nix-store,
which is much faster.
This commit is contained in:
parent
6e946c8e72
commit
47706e3924
|
@ -175,7 +175,7 @@ print "copying inputs...\n";
|
||||||
my $maybeSign = "";
|
my $maybeSign = "";
|
||||||
$maybeSign = "--sign" if -e "/nix/etc/nix/signing-key.sec";
|
$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: $?";
|
or die "cannot copy inputs to $hostName: $?";
|
||||||
|
|
||||||
print "building...\n";
|
print "building...\n";
|
||||||
|
|
|
@ -55,30 +55,18 @@ while (@ARGV) {
|
||||||
if ($toMode) { # Copy TO the remote machine.
|
if ($toMode) { # Copy TO the remote machine.
|
||||||
|
|
||||||
my @allStorePaths;
|
my @allStorePaths;
|
||||||
my %storePathsSeen;
|
|
||||||
|
|
||||||
foreach my $storePath (@storePaths) {
|
# Get the closure of this path.
|
||||||
# $arg might be a symlink to the store, so resolve it.
|
my $pid = open(READ, "$binDir/nix-store --query --requisites @storePaths|") or die;
|
||||||
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;
|
|
||||||
|
|
||||||
while (<READ>) {
|
while (<READ>) {
|
||||||
chomp;
|
chomp;
|
||||||
die "bad: $_" unless /^\//;
|
die "bad: $_" unless /^\//;
|
||||||
if (!defined $storePathsSeen{$_}) {
|
push @allStorePaths, $_;
|
||||||
push @allStorePaths, $_;
|
|
||||||
$storePathsSeen{$_} = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close READ or die "nix-store failed: $?";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close READ or die "nix-store failed: $?";
|
||||||
|
|
||||||
|
|
||||||
# Ask the remote host which paths are invalid.
|
# Ask the remote host which paths are invalid.
|
||||||
open(READ, "ssh @sshOpts $sshHost nix-store --check-validity --print-invalid @allStorePaths|");
|
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;
|
"ssh @sshOpts $sshHost nix-store --query --requisites @storePaths|") or die;
|
||||||
|
|
||||||
my @allStorePaths;
|
my @allStorePaths;
|
||||||
my %storePathsSeen;
|
|
||||||
|
|
||||||
while (<READ>) {
|
while (<READ>) {
|
||||||
chomp;
|
chomp;
|
||||||
die "bad: $_" unless /^\//;
|
die "bad: $_" unless /^\//;
|
||||||
if (!defined $storePathsSeen{$_}) {
|
push @allStorePaths, $_;
|
||||||
push @allStorePaths, $_;
|
|
||||||
$storePathsSeen{$_} = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close READ or die "nix-store on remote machine `$sshHost' failed: $?";
|
close READ or die "nix-store on remote machine `$sshHost' failed: $?";
|
||||||
|
|
Loading…
Reference in a new issue