summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/boost/format/exceptions.hpp4
-rw-r--r--nix/libstore/gc.cc22
-rw-r--r--nix/libutil/util.cc19
-rw-r--r--nix/nix-daemon/guix-daemon.cc7
4 files changed, 47 insertions, 5 deletions
diff --git a/nix/boost/format/exceptions.hpp b/nix/boost/format/exceptions.hpp
index 79e452449e..80da6d5718 100644
--- a/nix/boost/format/exceptions.hpp
+++ b/nix/boost/format/exceptions.hpp
@@ -59,7 +59,7 @@ public:
virtual const char *what() const throw()
{
return "boost::too_few_args: "
- "format-string refered to more arguments than were passed";
+ "format-string referred to more arguments than were passed";
}
};
@@ -70,7 +70,7 @@ public:
virtual const char *what() const throw()
{
return "boost::too_many_args: "
- "format-string refered to less arguments than were passed";
+ "format-string referred to less arguments than were passed";
}
};
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index fe152da015..29b75aa875 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -11,6 +11,7 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <climits>
namespace nix {
@@ -417,7 +418,15 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
throw SysError(format("getting status of %1%") % path);
}
- printMsg(lvlInfo, format("deleting `%1%'") % path);
+ if (state.options.maxFreed != ULLONG_MAX) {
+ double fraction = state.results.bytesFreed + size
+ / state.options.maxFreed;
+ unsigned int percentage = (fraction > 1. ? 1. : fraction) * 100.;
+ printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path);
+ } else {
+ size_t total = (state.results.bytesFreed + size) / (1024 * 1024);
+ printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % total % path);
+ }
state.results.paths.insert(path);
@@ -561,8 +570,17 @@ void LocalStore::removeUnusedLinks(const GCState & state)
if (name == "." || name == "..") continue;
Path path = linksDir + "/" + name;
+#ifdef HAVE_STATX
+# define st_size stx_size
+# define st_nlink stx_nlink
+ struct statx st;
+ if (statx(AT_FDCWD, path.c_str(),
+ AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC,
+ STATX_SIZE | STATX_NLINK, &st) == -1)
+#else
struct stat st;
if (lstat(path.c_str(), &st) == -1)
+#endif
throw SysError(format("statting `%1%'") % path);
if (st.st_nlink != 1) {
@@ -577,6 +595,8 @@ void LocalStore::removeUnusedLinks(const GCState & state)
throw SysError(format("deleting `%1%'") % path);
state.results.bytesFreed += st.st_size;
+#undef st_size
+#undef st_nlink
}
struct stat st;
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 9a83876013..faba3789df 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -177,8 +177,13 @@ struct stat lstat(const Path & path)
bool pathExists(const Path & path)
{
int res;
+#ifdef HAVE_STATX
+ struct statx st;
+ res = statx(AT_FDCWD, path.c_str(), AT_SYMLINK_NOFOLLOW, 0, &st);
+#else
struct stat st;
res = lstat(path.c_str(), &st);
+#endif
if (!res) return true;
if (errno != ENOENT && errno != ENOTDIR)
throw SysError(format("getting status of %1%") % path);
@@ -306,7 +311,18 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed)
printMsg(lvlVomit, format("%1%") % path);
+#ifdef HAVE_STATX
+# define st_mode stx_mode
+# define st_size stx_size
+# define st_nlink stx_nlink
+ struct statx st;
+ if (statx(AT_FDCWD, path.c_str(),
+ AT_SYMLINK_NOFOLLOW,
+ STATX_SIZE | STATX_NLINK | STATX_MODE, &st) == -1)
+ throw SysError(format("getting status of `%1%'") % path);
+#else
struct stat st = lstat(path);
+#endif
if (!S_ISDIR(st.st_mode) && st.st_nlink == 1)
bytesFreed += st.st_size;
@@ -321,6 +337,9 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed)
for (auto & i : readDirectory(path))
_deletePath(path + "/" + i.name, bytesFreed);
}
+#undef st_mode
+#undef st_size
+#undef st_nlink
if (remove(path.c_str()) == -1)
throw SysError(format("cannot unlink `%1%'") % path);
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 6f9c404c8d..cd949aca67 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -113,8 +113,11 @@ static const struct argp_option options[] =
n_("do not use substitutes") },
{ "substitute-urls", GUIX_OPT_SUBSTITUTE_URLS, n_("URLS"), 0,
n_("use URLS as the default list of substitute providers") },
- { "no-build-hook", GUIX_OPT_NO_BUILD_HOOK, 0, 0,
- n_("do not use the 'build hook'") },
+ { "no-offload", GUIX_OPT_NO_BUILD_HOOK, 0, 0,
+ n_("do not attempt to offload builds") },
+ { "no-build-hook", GUIX_OPT_NO_BUILD_HOOK, 0,
+ OPTION_HIDDEN, // deprecated
+ n_("do not attempt to offload builds") },
{ "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0,
n_("cache build failures") },
{ "rounds", GUIX_OPT_BUILD_ROUNDS, "N", 0,