1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

Merge pull request #2748 from edolstra/rust

Make nix/unpack-channel.nix a builtin builder
This commit is contained in:
Eelco Dolstra 2019-11-29 19:33:31 +01:00 committed by GitHub
commit f102d793f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 514 additions and 86 deletions

View file

@ -4,6 +4,7 @@
#include "store-api.hh"
#include "pathlocks.hh"
#include "hash.hh"
#include "tarfile.hh"
#include <sys/time.h>
@ -164,14 +165,16 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
if (e.errNo != ENOENT) throw;
}
// FIXME: should pipe this, or find some better way to extract a
// revision.
auto tar = runProgram("git", true, { "-C", cacheDir, "archive", gitInfo.rev });
auto source = sinkToSource([&](Sink & sink) {
RunOptions gitOptions("git", { "-C", cacheDir, "archive", gitInfo.rev });
gitOptions.standardOut = &sink;
runProgram2(gitOptions);
});
Path tmpDir = createTempDir();
AutoDelete delTmpDir(tmpDir, true);
runProgram("tar", true, { "x", "-C", tmpDir }, tar);
unpackTarfile(*source, tmpDir);
gitInfo.storePath = store->addToStore(name, tmpDir);