mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 17:29:36 +01:00
Misc Windows fixes
1. Fix build by making the legacy SSH Storey's secret `logFD` setting not a setting on Windows. (It doesn't make sense to specify `void *` handles by integer cross-proccess, I don't think.) 2. Move some files that don't need to be Unix-only anymore back to their original locations.
This commit is contained in:
parent
802b4e403b
commit
e0b159549b
11 changed files with 36 additions and 17 deletions
33
src/libstore/builtins/unpack-channel.cc
Normal file
33
src/libstore/builtins/unpack-channel.cc
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "builtins.hh"
|
||||
#include "tarfile.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
void builtinUnpackChannel(
|
||||
const BasicDerivation & drv,
|
||||
const std::map<std::string, Path> & outputs)
|
||||
{
|
||||
auto getAttr = [&](const std::string & name) {
|
||||
auto i = drv.env.find(name);
|
||||
if (i == drv.env.end()) throw Error("attribute '%s' missing", name);
|
||||
return i->second;
|
||||
};
|
||||
|
||||
auto out = outputs.at("out");
|
||||
auto channelName = getAttr("channelName");
|
||||
auto src = getAttr("src");
|
||||
|
||||
createDirs(out);
|
||||
|
||||
unpackTarfile(src, out);
|
||||
|
||||
auto entries = std::filesystem::directory_iterator{out};
|
||||
auto fileName = entries->path().string();
|
||||
auto fileCount = std::distance(std::filesystem::begin(entries), std::filesystem::end(entries));
|
||||
|
||||
if (fileCount != 1)
|
||||
throw Error("channel tarball '%s' contains more than one file", src);
|
||||
std::filesystem::rename(fileName, (out + "/" + channelName));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue