1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Merge branch 'master' of github.com:NixOS/nix into enum-class

This commit is contained in:
Carlo Nucera 2020-05-28 10:58:22 -04:00
commit 4f597fb901
190 changed files with 7862 additions and 1487 deletions

View file

@ -1,14 +1,14 @@
#include "hash.hh"
#include "shared.hh"
#include "download.hh"
#include "filetransfer.hh"
#include "store-api.hh"
#include "eval.hh"
#include "eval-inline.hh"
#include "common-eval-args.hh"
#include "attr-path.hh"
#include "legacy.hh"
#include "finally.hh"
#include "progress-bar.hh"
#include "../nix/legacy.hh"
#include "../nix/progress-bar.hh"
#include "tarfile.hh"
#include <iostream>
@ -159,7 +159,8 @@ static int _main(int argc, char * * argv)
std::optional<StorePath> storePath;
if (args.size() == 2) {
expectedHash = Hash(args[1], ht);
storePath = store->makeFixedOutputPath(unpack, expectedHash, name);
const auto recursive = unpack ? FileIngestionMethod::Recursive : FileIngestionMethod::Flat;
storePath = store->makeFixedOutputPath(recursive, expectedHash, name);
if (store->isValidPath(*storePath))
hash = expectedHash;
else
@ -180,9 +181,9 @@ static int _main(int argc, char * * argv)
FdSink sink(fd.get());
DownloadRequest req(actualUri);
FileTransferRequest req(actualUri);
req.decompress = false;
getDownloader()->download(std::move(req), sink);
getFileTransfer()->download(std::move(req), sink);
}
/* Optionally unpack the file. */
@ -208,13 +209,15 @@ static int _main(int argc, char * * argv)
if (expectedHash != Hash(ht) && expectedHash != hash)
throw Error(format("hash mismatch for '%1%'") % uri);
const auto recursive = unpack ? FileIngestionMethod::Recursive : FileIngestionMethod::Flat;
/* Copy the file to the Nix store. FIXME: if RemoteStore
implemented addToStoreFromDump() and downloadFile()
supported a sink, we could stream the download directly
into the Nix store. */
storePath = store->addToStore(name, tmpFile, unpack, ht);
storePath = store->addToStore(name, tmpFile, recursive, ht);
assert(*storePath == store->makeFixedOutputPath(unpack, hash, name));
assert(*storePath == store->makeFixedOutputPath(recursive, hash, name));
}
stopProgressBar();