aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/builtins
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-06-17 13:18:47 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2020-06-17 13:32:29 -0400
commit7bd88cc1dc746ed2883e1eaebb3230ec2c2bb035 (patch)
tree804e3731a5f6b4a370ac7f79c03c6fa0233ccc79 /src/libstore/builtins
parent6438ba1e990ddf76602a70d5c1143b73ed31855c (diff)
parent2f51cd8dc95231b2e2f5b3bd75ac6d8d2dece361 (diff)
Merge remote-tracking branch 'origin/master' into substitute-other-storedir
Diffstat (limited to 'src/libstore/builtins')
-rw-r--r--src/libstore/builtins/buildenv.cc20
-rw-r--r--src/libstore/builtins/fetchurl.cc4
2 files changed, 15 insertions, 9 deletions
diff --git a/src/libstore/builtins/buildenv.cc b/src/libstore/builtins/buildenv.cc
index 1b802d908..802fb87bc 100644
--- a/src/libstore/builtins/buildenv.cc
+++ b/src/libstore/builtins/buildenv.cc
@@ -22,7 +22,10 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
srcFiles = readDirectory(srcDir);
} catch (SysError & e) {
if (e.errNo == ENOTDIR) {
- printError("warning: not including '%s' in the user environment because it's not a directory", srcDir);
+ logWarning({
+ .name = "Create links - directory",
+ .hint = hintfmt("not including '%s' in the user environment because it's not a directory", srcDir)
+ });
return;
}
throw;
@@ -41,7 +44,10 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
throw SysError("getting status of '%1%'", srcFile);
} catch (SysError & e) {
if (e.errNo == ENOENT || e.errNo == ENOTDIR) {
- printError("warning: skipping dangling symlink '%s'", dstFile);
+ logWarning({
+ .name = "Create links - skipping symlink",
+ .hint = hintfmt("skipping dangling symlink '%s'", dstFile)
+ });
continue;
}
throw;
@@ -72,15 +78,15 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
if (!S_ISDIR(lstat(target).st_mode))
throw Error("collision between '%1%' and non-directory '%2%'", srcFile, target);
if (unlink(dstFile.c_str()) == -1)
- throw SysError(format("unlinking '%1%'") % dstFile);
+ throw SysError("unlinking '%1%'", dstFile);
if (mkdir(dstFile.c_str(), 0755) == -1)
- throw SysError(format("creating directory '%1%'"));
+ throw SysError("creating directory '%1%'", dstFile);
createLinks(state, target, dstFile, state.priorities[dstFile]);
createLinks(state, srcFile, dstFile, priority);
continue;
}
} else if (errno != ENOENT)
- throw SysError(format("getting status of '%1%'") % dstFile);
+ throw SysError("getting status of '%1%'", dstFile);
}
else {
@@ -99,11 +105,11 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
if (prevPriority < priority)
continue;
if (unlink(dstFile.c_str()) == -1)
- throw SysError(format("unlinking '%1%'") % dstFile);
+ throw SysError("unlinking '%1%'", dstFile);
} else if (S_ISDIR(dstSt.st_mode))
throw Error("collision between non-directory '%1%' and directory '%2%'", srcFile, dstFile);
} else if (errno != ENOENT)
- throw SysError(format("getting status of '%1%'") % dstFile);
+ throw SysError("getting status of '%1%'", dstFile);
}
createSymlink(srcFile, dstFile);
diff --git a/src/libstore/builtins/fetchurl.cc b/src/libstore/builtins/fetchurl.cc
index 254cb4fce..6585a480d 100644
--- a/src/libstore/builtins/fetchurl.cc
+++ b/src/libstore/builtins/fetchurl.cc
@@ -18,7 +18,7 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
auto getAttr = [&](const string & name) {
auto i = drv.env.find(name);
- if (i == drv.env.end()) throw Error(format("attribute '%s' missing") % name);
+ if (i == drv.env.end()) throw Error("attribute '%s' missing", name);
return i->second;
};
@@ -54,7 +54,7 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
auto executable = drv.env.find("executable");
if (executable != drv.env.end() && executable->second == "1") {
if (chmod(storePath.c_str(), 0755) == -1)
- throw SysError(format("making '%1%' executable") % storePath);
+ throw SysError("making '%1%' executable", storePath);
}
};