1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

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.
This commit is contained in:
Eelco Dolstra 2014-07-24 17:11:54 +02:00
parent 7f7d4ab686
commit 1a44f1cb65
5 changed files with 23 additions and 92 deletions

View file

@ -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;
}