@@ -3,16 +3,13 @@ package Nix::CopyClosure;
3
3
use strict;
4
4
use Nix::Config;
5
5
use Nix::Store;
6
+ use List::Util qw( sum) ;
6
7
7
8
8
9
sub copyTo {
9
10
my ($sshHost , $sshOpts , $storePaths , $compressor , $decompressor ,
10
11
$includeOutputs , $dryRun , $sign , $progressViewer , $useSubstitutes ) = @_ ;
11
12
12
- $compressor = " $compressor |" if $compressor ne " " ;
13
- $decompressor = " $decompressor |" if $decompressor ne " " ;
14
- $progressViewer = " $progressViewer |" if $progressViewer ne " " ;
15
-
16
13
# Get the closure of this path.
17
14
my @closure = reverse (topoSortPaths(computeFSClosure(0, $includeOutputs ,
18
15
map { followLinksToStorePath $_ } @{$storePaths })));
@@ -28,16 +25,23 @@ sub copyTo {
28
25
# we'll want to use ‘--from-stdin’, but we can't rely on the
29
26
# target having this option yet.
30
27
my @missing = ();
28
+ my $missingSize = 0;
31
29
while (scalar (@closure ) > 0) {
32
30
my @ps = splice (@closure , 0, 1500);
33
31
open (READ, " set -f; ssh $sshHost @{$sshOpts } nix-store --check-validity --print-invalid @ps |" );
34
32
while (<READ>) {
35
33
chomp ;
36
34
push @missing , $_ ;
35
+ my ($deriver , $narHash , $time , $narSize , $refs ) = queryPathInfo($_ , 1);
36
+ $missingSize += $narSize ;
37
37
}
38
38
close READ or die ;
39
39
}
40
40
41
+ $compressor = " $compressor |" if $compressor ne " " ;
42
+ $decompressor = " $decompressor |" if $decompressor ne " " ;
43
+ $progressViewer = " $progressViewer -s $missingSize |" if $progressViewer ne " " ;
44
+
41
45
# Export the store paths and import them on the remote machine.
42
46
if (scalar @missing > 0) {
43
47
print STDERR " copying " , scalar @missing , " missing paths to ‘$sshHost ’...\n " ;
0 commit comments