[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
94/376: nix-copy-closure: Drop --bzip2, --xz, --show-progress
From: |
Ludovic Courtès |
Subject: |
94/376: nix-copy-closure: Drop --bzip2, --xz, --show-progress |
Date: |
Wed, 28 Jan 2015 22:04:16 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 1a44f1cb656557715d328818270b82c0c13d58a0
Author: Eelco Dolstra <address@hidden>
Date: Thu Jul 24 17:11:54 2014 +0200
nix-copy-closure: Drop --bzip2, --xz, --show-progress
These are too difficult to implement via nix-store --serve.
‘--show-progress’ could be re-implemented fairly easily via a
sink/source wrapper class.
---
doc/manual/nix-copy-closure.xml | 19 ++++++++---------
perl/lib/Nix/CopyClosure.pm | 41 ++++++--------------------------------
scripts/build-remote.pl.in | 2 +-
scripts/nix-copy-closure.in | 20 ++++--------------
src/nix-store/nix-store.cc | 33 +------------------------------
5 files changed, 23 insertions(+), 92 deletions(-)
diff --git a/doc/manual/nix-copy-closure.xml b/doc/manual/nix-copy-closure.xml
index 30b3aae..3f8fd80 100644
--- a/doc/manual/nix-copy-closure.xml
+++ b/doc/manual/nix-copy-closure.xml
@@ -24,9 +24,9 @@
</group>
<arg><option>--sign</option></arg>
<arg><option>--gzip</option></arg>
- <arg><option>--bzip2</option></arg>
- <arg><option>--xz</option></arg>
- <arg><option>--show-progress</option></arg>
+ <!--
+ <arg><option>- -show-progress</option></arg>
+ -->
<arg><option>--include-outputs</option></arg>
<arg><option>--use-substitutes</option></arg>
<arg><option>-s</option></arg>
@@ -103,22 +103,21 @@ those paths. If this bothers you, use
</varlistentry>
- <varlistentry><term><option>--gzip</option> / <option>--bzip2</option> /
<option>--xz</option></term>
+ <varlistentry><term><option>--gzip</option></term>
- <listitem><para>Compress the dump of each path with respectively
- <command>gzip</command>, <command>bzip2</command> or
- <command>xz</command> before sending it. The corresponding
- decompression program must be installed on the target
- machine.</para></listitem>
+ <listitem><para>Enable compression of the SSH
+ connection.</para></listitem>
</varlistentry>
- <varlistentry><term><option>--show-progress</option></term>
+ <!--
+ <varlistentry><term><option>- -show-progress</option></term>
<listitem><para>Show the progress of each path's transfer as it's made.
This requires the <command>pv</command> utility to be in
<envar>PATH</envar>.</para></listitem>
</varlistentry>
+ -->
<varlistentry><term><option>--include-outputs</option></term>
diff --git a/perl/lib/Nix/CopyClosure.pm b/perl/lib/Nix/CopyClosure.pm
index e12fef6..d707158 100644
--- a/perl/lib/Nix/CopyClosure.pm
+++ b/perl/lib/Nix/CopyClosure.pm
@@ -9,8 +9,7 @@ use IPC::Open2;
sub copyToOpen {
- my ($from, $to, $sshHost, $storePaths, $compressor, $decompressor,
- $includeOutputs, $dryRun, $sign, $progressViewer, $useSubstitutes) =
@_;
+ my ($from, $to, $sshHost, $storePaths, $includeOutputs, $dryRun, $sign,
$useSubstitutes) = @_;
$useSubstitutes = 0 if $dryRun || !defined $useSubstitutes;
@@ -41,34 +40,13 @@ sub copyToOpen {
# Send the "import paths" command.
syswrite($to, pack("L<x4", 4)) or die;
- writeString($compressor, $to);
-
- if ($compressor || $progressViewer) {
-
- # Compute the size of the closure for the progress viewer.
- $progressViewer = "$progressViewer -s $missingSize" if $progressViewer;
-
- # Start the compressor and/or progress viewer in between us
- # and the remote host.
- my $to_;
- my $pid2 = open2(">&" . fileno($to), $to_,
- $progressViewer && $compressor ? "$progressViewer | $compressor" :
$progressViewer || $compressor);
- close $to;
- exportPaths(fileno($to_), $sign, @missing);
- close $to_;
- waitpid $pid2, 0;
-
- } else {
- exportPaths(fileno($to), $sign, @missing);
- }
-
+ exportPaths(fileno($to), $sign, @missing);
readInt($from) == 1 or die "remote machine \`$sshHost' failed to import
closure\n";
}
sub copyTo {
- my ($sshHost, $sshOpts, $storePaths, $compressor, $decompressor,
- $includeOutputs, $dryRun, $sign, $progressViewer, $useSubstitutes) =
@_;
+ my ($sshHost, $sshOpts, $storePaths, $includeOutputs, $dryRun, $sign,
$useSubstitutes) = @_;
# Connect to the remote host.
my ($from, $to);
@@ -81,8 +59,7 @@ sub copyTo {
return oldCopyTo(@_);
}
- copyToOpen($from, $to, $sshHost, $storePaths, $compressor, $decompressor,
- $includeOutputs, $dryRun, $sign, $progressViewer,
$useSubstitutes);
+ copyToOpen($from, $to, $sshHost, $storePaths, $includeOutputs, $dryRun,
$sign, $useSubstitutes);
close $to;
}
@@ -91,8 +68,7 @@ sub copyTo {
# For backwards compatibility with Nix <= 1.7. Will be removed
# eventually.
sub oldCopyTo {
- my ($sshHost, $sshOpts, $storePaths, $compressor, $decompressor,
- $includeOutputs, $dryRun, $sign, $progressViewer, $useSubstitutes) =
@_;
+ my ($sshHost, $sshOpts, $storePaths, $includeOutputs, $dryRun, $sign,
$useSubstitutes) = @_;
# Get the closure of this path.
my @closure = reverse(topoSortPaths(computeFSClosure(0, $includeOutputs,
@@ -122,15 +98,12 @@ sub oldCopyTo {
close READ or die;
}
- $compressor = "$compressor |" if $compressor ne "";
- $decompressor = "$decompressor |" if $decompressor ne "";
- $progressViewer = "$progressViewer -s $missingSize |" if $progressViewer
ne "";
-
# Export the store paths and import them on the remote machine.
if (scalar @missing > 0) {
print STDERR "copying ", scalar @missing, " missing paths to
‘$sshHost’...\n";
+ print STDERR "@missing\n";
unless ($dryRun) {
- open SSH, "| $progressViewer $compressor ssh $sshHost @{$sshOpts}
@globalSshOpts '$decompressor nix-store --import' > /dev/null" or die;
+ open SSH, "| ssh $sshHost @{$sshOpts} @globalSshOpts 'nix-store
--import' > /dev/null" or die;
exportPaths(fileno(SSH), $sign, @missing);
close SSH or die "copying store paths to remote machine `$sshHost'
failed: $?";
}
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index 73d7abe..ab9392b 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -246,7 +246,7 @@ if ($@) {
print STDERR "somebody is hogging $uploadLock, continuing...\n";
unlink $uploadLock;
}
-Nix::CopyClosure::copyToOpen($from, $to, $hostName, [ $drvPath, @inputs ], "",
"", 0, 0, $maybeSign ne "", "");
+Nix::CopyClosure::copyToOpen($from, $to, $hostName, [ $drvPath, @inputs ], 0,
0, $maybeSign ne "");
close UPLOADLOCK;
diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in
index 6964f2d..bd20148 100755
--- a/scripts/nix-copy-closure.in
+++ b/scripts/nix-copy-closure.in
@@ -19,9 +19,6 @@ EOF
# Get the target host.
my $sshHost;
my $sign = 0;
-my $compressor = "";
-my $decompressor = "";
-my $progressViewer = "";
my $toMode = 1;
my $includeOutputs = 0;
my $dryRun = 0;
@@ -40,17 +37,10 @@ while (@ARGV) {
elsif ($arg eq "--sign") {
$sign = 1;
}
- elsif ($arg eq "--gzip") {
+ elsif ($arg eq "--gzip" || $arg eq "--bzip2" || $arg eq "--xz") {
+ warn "$0: `$arg' is not implemented\n" if $arg ne "--gzip";
push @globalSshOpts, "-C";
}
- elsif ($arg eq "--bzip2") {
- $compressor = "bzip2";
- $decompressor = "bzip2 -d";
- }
- elsif ($arg eq "--xz") {
- $compressor = "xz";
- $decompressor = "xz -d";
- }
elsif ($arg eq "--from") {
$toMode = 0;
}
@@ -61,7 +51,7 @@ while (@ARGV) {
$includeOutputs = 1;
}
elsif ($arg eq "--show-progress") {
- $progressViewer = "@pv@";
+ warn "$0: `$arg' is not implemented\n";
}
elsif ($arg eq "--dry-run") {
$dryRun = 1;
@@ -82,8 +72,8 @@ die "$0: you did not specify a host name\n" unless defined
$sshHost;
if ($toMode) { # Copy TO the remote machine.
Nix::CopyClosure::copyTo(
- $sshHost, [ @sshOpts ], [ @storePaths ], $compressor, $decompressor,
- $includeOutputs, $dryRun, $sign, $progressViewer, $useSubstitutes);
+ $sshHost, [ @sshOpts ], [ @storePaths ],
+ $includeOutputs, $dryRun, $sign, $useSubstitutes);
}
else { # Copy FROM the remote machine.
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index f2621a9..932789f 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -956,39 +956,8 @@ static void opServe(Strings opFlags, Strings opArgs)
case cmdImportPaths: {
if (!writeAllowed) throw Error("importing paths is not
allowed");
- string compression = readString(in);
-
- if (compression != "") {
- if (compression != "gzip" && compression != "bzip2" &&
compression != "xz")
- throw Error(format("unsupported compression method
`%1%'") % compression);
-
- Pipe fromDecompressor;
- fromDecompressor.create();
-
- Pid pid = startProcess([&]() {
- fromDecompressor.readSide.close();
- if (dup2(fromDecompressor.writeSide, STDOUT_FILENO) ==
-1)
- throw SysError("dupping stdout");
- // FIXME: use absolute path.
- execlp(compression.c_str(), compression.c_str(), "-d",
NULL);
- throw SysError(format("executing `%1%'") %
compression);
- });
-
- fromDecompressor.writeSide.close();
-
- FdSource fromDecompressor_(fromDecompressor.readSide);
- store->importPaths(false, fromDecompressor_);
-
- pid.wait(true);
- } else
- store->importPaths(false, in);
-
+ store->importPaths(false, in);
writeInt(1, out); // indicate success
-
- /* The decompressor will have left stdin in an
- undefined state, so we can't continue. */
- if (compression != "") return;
-
break;
}
- 74/376: nix-daemon: Use a thread instead of SIGPOLL to catch client disconnects, (continued)
- 74/376: nix-daemon: Use a thread instead of SIGPOLL to catch client disconnects, Ludovic Courtès, 2015/01/28
- 99/376: install-nix-from-closure.sh: Install cacert, Ludovic Courtès, 2015/01/28
- 93/376: nix-copy-closure: Implement --gzip via ssh's -C flag, Ludovic Courtès, 2015/01/28
- 91/376: Remove obsolete SSH master connection code, Ludovic Courtès, 2015/01/28
- 100/376: Rename nixPath to __nixPath, Ludovic Courtès, 2015/01/28
- 95/376: Change the default for use-ssh-substituter to ‘true’, Ludovic Courtès, 2015/01/28
- 90/376: Implement nix-copy-closure --from via nix-store --serve, Ludovic Courtès, 2015/01/28
- 97/376: Remove outdated AUTHORS file, Ludovic Courtès, 2015/01/28
- 92/376: Fix NIX_SSHOPTS, Ludovic Courtès, 2015/01/28
- 103/376: Allow regular files as GC roots, Ludovic Courtès, 2015/01/28
- 94/376: nix-copy-closure: Drop --bzip2, --xz, --show-progress,
Ludovic Courtès <=
- 84/376: Use pthread_cancel instead of a signal, Ludovic Courtès, 2015/01/28
- 102/376: Restore default SIGPIPE handler before invoking ‘man’, Ludovic Courtès, 2015/01/28
- 98/376: nix-profile.sh: Set $SSL_CERT_FILE, Ludovic Courtès, 2015/01/28
- 96/376: nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substituter, Ludovic Courtès, 2015/01/28
- 101/376: make clean: Remove Makefile.config, Ludovic Courtès, 2015/01/28
- 105/376: findRoots(): Prevent a call to lstat(), Ludovic Courtès, 2015/01/28
- 108/376: Remove ugly hack for detecting build environment setup errors, Ludovic Courtès, 2015/01/28
- 107/376: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/01/28
- 104/376: Make readDirectory() return inode / file type, Ludovic Courtès, 2015/01/28
- 106/376: Eliminate redundant copy, Ludovic Courtès, 2015/01/28