nix-channel: error out if direct tarball unpack fails.

It's very unlikely a path ending in .tar.gz is a directory

Fixes #1318
This commit is contained in:
Shea Levy 2017-04-10 18:16:36 -04:00
parent 915f62fa19
commit 503cc4431b

View file

@ -103,12 +103,9 @@ static void update(const StringSet & channelNames)
auto unpacked = false;
if (std::regex_search(filename, std::regex("\\.tar\\.(gz|bz2|xz)$"))) {
try {
runProgram(settings.nixBinDir + "/nix-build", false, { "--no-out-link", "--expr", "import <nix/unpack-channel.nix> "
"{ name = \"" + cname + "\"; channelName = \"" + name + "\"; src = builtins.storePath \"" + filename + "\"; }" });
unpacked = true;
} catch (ExecError & e) {
}
runProgram(settings.nixBinDir + "/nix-build", false, { "--no-out-link", "--expr", "import <nix/unpack-channel.nix> "
"{ name = \"" + cname + "\"; channelName = \"" + name + "\"; src = builtins.storePath \"" + filename + "\"; }" });
unpacked = true;
}
if (!unpacked) {