diff options
author | jade <lix@jade.fyi> | 2024-08-08 22:43:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-08-08 22:43:10 +0000 |
commit | 757041c3e74787c755b3de826078968119f706d6 (patch) | |
tree | 9f3ea456c45130fb3a0910f9a9be9f60a74577cc /src/libstore/optimise-store.cc | |
parent | e03cd8b3a6f70c60f359fd683c2b25f8eba4da0d (diff) | |
parent | 4ed8461cacced97717bf9a7525e12ba69fe168c0 (diff) |
Merge changes I526cceed,Ia4e2f1fa,I22e66972,I9fbd55a9,Ifca22e44 into main
* changes:
sqlite: add a Use::fromStrNullable
util: implement charptr_cast
tree-wide: fix a pile of lints
refactor: make HashType and Base enum classes for type safety
build: integrate clang-tidy into CI
Diffstat (limited to 'src/libstore/optimise-store.cc')
-rw-r--r-- | src/libstore/optimise-store.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index 4f02296c3..9c871b78f 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -2,14 +2,11 @@ #include "globals.hh" #include "signals.hh" -#include <cstdlib> #include <cstring> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <errno.h> -#include <stdio.h> -#include <regex> namespace nix { @@ -145,17 +142,17 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, Also note that if `path' is a symlink, then we're hashing the contents of the symlink (i.e. the result of readlink()), not the contents of the target (which may not even exist). */ - Hash hash = hashPath(htSHA256, path).first; - debug("'%1%' has hash '%2%'", path, hash.to_string(Base32, true)); + Hash hash = hashPath(HashType::SHA256, path).first; + debug("'%1%' has hash '%2%'", path, hash.to_string(Base::Base32, true)); /* Check if this is a known hash. */ - Path linkPath = linksDir + "/" + hash.to_string(Base32, false); + Path linkPath = linksDir + "/" + hash.to_string(Base::Base32, false); /* Maybe delete the link, if it has been corrupted. */ if (pathExists(linkPath)) { auto stLink = lstat(linkPath); if (st.st_size != stLink.st_size - || (repair && hash != hashPath(htSHA256, linkPath).first)) + || (repair && hash != hashPath(HashType::SHA256, linkPath).first)) { // XXX: Consider overwriting linkPath with our valid version. warn("removing corrupted link '%s'", linkPath); |