guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

44/118: nix-copy-closure: Fix --dry-run


From: Ludovic Courtès
Subject: 44/118: nix-copy-closure: Fix --dry-run
Date: Tue, 19 May 2015 14:45:33 +0000

civodul pushed a commit to branch nix
in repository guix.

commit 7c3a5090bff4e9cfe70f1d89619563b55af13d89
Author: Eelco Dolstra <address@hidden>
Date:   Thu Jul 10 17:44:18 2014 +0200

    nix-copy-closure: Fix --dry-run
---
 perl/lib/Nix/CopyClosure.pm |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/perl/lib/Nix/CopyClosure.pm b/perl/lib/Nix/CopyClosure.pm
index 5085ec0..53da720 100644
--- a/perl/lib/Nix/CopyClosure.pm
+++ b/perl/lib/Nix/CopyClosure.pm
@@ -78,6 +78,13 @@ sub copyTo {
     my @missing = grep { !$present{$_} } @closure;
     return if address@hidden;
 
+    my $missingSize = 0;
+    $missingSize += (queryPathInfo($_, 1))[3] foreach @missing;
+
+    printf STDERR "copying %d missing paths (%.2f MiB) to ‘$sshHost’...\n",
+        scalar(@missing), $missingSize / (1024.0^2);
+    return if $dryRun;
+
     # Send the "import paths" command.
     syswrite($to, pack("L<x4", 4)) or die;
     writeString($compressor, $to);
@@ -85,11 +92,7 @@ sub copyTo {
     if ($compressor || $progressViewer) {
 
         # Compute the size of the closure for the progress viewer.
-        if ($progressViewer) {
-            my $missingSize = 0;
-            $missingSize += (queryPathInfo($_, 1))[3] foreach @missing;
-            $progressViewer = "$progressViewer -s $missingSize";
-        }
+        $progressViewer = "$progressViewer -s $missingSize" if $progressViewer;
 
         # Start the compressor and/or progress viewer in between us
         # and the remote host.
@@ -107,9 +110,6 @@ sub copyTo {
     }
 
     readInt($from) == 1 or die "remote machine \`$sshHost' failed to import 
closure\n";
-
-    # Shut down the server process.
-    waitpid $pid, 0;
 }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]