aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/add-to-store.cc2
-rw-r--r--src/nix/hash.cc38
-rw-r--r--src/nix/installables.cc2
-rw-r--r--src/nix/main.cc2
-rw-r--r--src/nix/make-content-addressable.cc2
-rw-r--r--src/nix/path-info.cc2
-rw-r--r--src/nix/repl.cc6
-rw-r--r--src/nix/sigs.cc2
-rw-r--r--src/nix/upgrade-nix.cc8
-rw-r--r--src/nix/verify.cc13
10 files changed, 39 insertions, 38 deletions
diff --git a/src/nix/add-to-store.cc b/src/nix/add-to-store.cc
index 3c0f7cdd6..f43f774c1 100644
--- a/src/nix/add-to-store.cc
+++ b/src/nix/add-to-store.cc
@@ -43,7 +43,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
StringSink sink;
dumpPath(path, sink);
- auto narHash = hashString(HashType::SHA256, *sink.s);
+ auto narHash = hashString(htSHA256, *sink.s);
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Recursive, narHash, *namePart));
info.narHash = narHash;
diff --git a/src/nix/hash.cc b/src/nix/hash.cc
index d1b5cca72..f435192fc 100644
--- a/src/nix/hash.cc
+++ b/src/nix/hash.cc
@@ -10,18 +10,18 @@ using namespace nix;
struct CmdHash : Command
{
FileIngestionMethod mode;
- Base base = Base::SRI;
+ Base base = SRI;
bool truncate = false;
- HashType ht = HashType::SHA256;
+ HashType ht = htSHA256;
std::vector<std::string> paths;
std::optional<std::string> modulus;
CmdHash(FileIngestionMethod mode) : mode(mode)
{
- mkFlag(0, "sri", "print hash in Base::SRI format", &base, Base::SRI);
- mkFlag(0, "base64", "print hash in base-64", &base, Base::Base64);
- mkFlag(0, "base32", "print hash in base-32 (Nix-specific)", &base, Base::Base32);
- mkFlag(0, "base16", "print hash in base-16", &base, Base::Base16);
+ mkFlag(0, "sri", "print hash in SRI format", &base, SRI);
+ mkFlag(0, "base64", "print hash in base-64", &base, Base64);
+ mkFlag(0, "base32", "print hash in base-32 (Nix-specific)", &base, Base32);
+ mkFlag(0, "base16", "print hash in base-16", &base, Base16);
addFlag(Flag::mkHashTypeFlag("type", &ht));
#if 0
mkFlag()
@@ -68,7 +68,7 @@ struct CmdHash : Command
Hash h = hashSink->finish().first;
if (truncate && h.hashSize > 20) h = compressHash(h, 20);
- logger->stdout(h.to_string(base, base == Base::SRI));
+ logger->stdout(h.to_string(base, base == SRI));
}
}
};
@@ -91,10 +91,10 @@ struct CmdToBase : Command
std::string description() override
{
return fmt("convert a hash to %s representation",
- base == Base::Base16 ? "base-16" :
- base == Base::Base32 ? "base-32" :
- base == Base::Base64 ? "base-64" :
- "Base::SRI");
+ base == Base16 ? "base-16" :
+ base == Base32 ? "base-32" :
+ base == Base64 ? "base-64" :
+ "SRI");
}
Category category() override { return catUtility; }
@@ -102,19 +102,19 @@ struct CmdToBase : Command
void run() override
{
for (auto s : args)
- logger->stdout(Hash(s, ht).to_string(base, base == Base::SRI));
+ logger->stdout(Hash(s, ht).to_string(base, base == SRI));
}
};
-static RegisterCommand r3("to-base16", [](){ return make_ref<CmdToBase>(Base::Base16); });
-static RegisterCommand r4("to-base32", [](){ return make_ref<CmdToBase>(Base::Base32); });
-static RegisterCommand r5("to-base64", [](){ return make_ref<CmdToBase>(Base::Base64); });
-static RegisterCommand r6("to-sri", [](){ return make_ref<CmdToBase>(Base::SRI); });
+static RegisterCommand r3("to-base16", [](){ return make_ref<CmdToBase>(Base16); });
+static RegisterCommand r4("to-base32", [](){ return make_ref<CmdToBase>(Base32); });
+static RegisterCommand r5("to-base64", [](){ return make_ref<CmdToBase>(Base64); });
+static RegisterCommand r6("to-sri", [](){ return make_ref<CmdToBase>(SRI); });
/* Legacy nix-hash command. */
static int compatNixHash(int argc, char * * argv)
{
- HashType ht = HashType::MD5;
+ HashType ht = htMD5;
bool flat = false;
bool base32 = false;
bool truncate = false;
@@ -145,14 +145,14 @@ static int compatNixHash(int argc, char * * argv)
if (op == opHash) {
CmdHash cmd(flat ? FileIngestionMethod::Flat : FileIngestionMethod::Recursive);
cmd.ht = ht;
- cmd.base = base32 ? Base::Base32 : Base::Base16;
+ cmd.base = base32 ? Base32 : Base16;
cmd.truncate = truncate;
cmd.paths = ss;
cmd.run();
}
else {
- CmdToBase cmd(op == opTo32 ? Base::Base32 : Base::Base16);
+ CmdToBase cmd(op == opTo32 ? Base32 : Base16);
cmd.args = ss;
cmd.ht = ht;
cmd.run();
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index 687026ca7..708a0dc88 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -279,7 +279,7 @@ Buildables build(ref<Store> store, RealiseMode mode,
}
if (mode == DryRun)
- printMissing(store, pathsToBuild, Verbosity::Error);
+ printMissing(store, pathsToBuild, lvlError);
else if (mode == Build)
store->buildPaths(pathsToBuild);
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 2af28ed3e..203901168 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -163,7 +163,7 @@ void mainWrapped(int argc, char * * argv)
if (legacy) return legacy(argc, argv);
}
- verbosity = Verbosity::Warn;
+ verbosity = lvlWarn;
settings.verboseBuild = false;
setLogFormat("bar");
diff --git a/src/nix/make-content-addressable.cc b/src/nix/make-content-addressable.cc
index 8923ea05d..0ebb8f13b 100644
--- a/src/nix/make-content-addressable.cc
+++ b/src/nix/make-content-addressable.cc
@@ -72,7 +72,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
*sink.s = rewriteStrings(*sink.s, rewrites);
- HashModuloSink hashModuloSink(HashType::SHA256, oldHashPart);
+ HashModuloSink hashModuloSink(htSHA256, oldHashPart);
hashModuloSink((unsigned char *) sink.s->data(), sink.s->size());
auto narHash = hashModuloSink.finish().first;
diff --git a/src/nix/path-info.cc b/src/nix/path-info.cc
index d9b132581..fb7bacc4c 100644
--- a/src/nix/path-info.cc
+++ b/src/nix/path-info.cc
@@ -91,7 +91,7 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
store->pathInfoToJSON(jsonRoot,
// FIXME: preserve order?
StorePathSet(storePaths.begin(), storePaths.end()),
- true, showClosureSize, Base::SRI, AllowInvalid);
+ true, showClosureSize, SRI, AllowInvalid);
}
else {
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index 2c3e52a16..617d49614 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -211,12 +211,12 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
// input without clearing the input so far.
continue;
} else {
- printMsg(Verbosity::Error, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ printMsg(lvlError, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
}
} catch (Error & e) {
- printMsg(Verbosity::Error, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ printMsg(lvlError, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
} catch (Interrupted & e) {
- printMsg(Verbosity::Error, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ printMsg(lvlError, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
}
// We handled the current input fully, so we should clear it
diff --git a/src/nix/sigs.cc b/src/nix/sigs.cc
index 311817d1f..6c9b9a792 100644
--- a/src/nix/sigs.cc
+++ b/src/nix/sigs.cc
@@ -47,7 +47,7 @@ struct CmdCopySigs : StorePathsCommand
//logger->setExpected(doneLabel, storePaths.size());
auto doPath = [&](const Path & storePathS) {
- //Activity act(*logger, Verbosity::Info, format("getting signatures for '%s'") % storePath);
+ //Activity act(*logger, lvlInfo, format("getting signatures for '%s'") % storePath);
checkInterrupt();
diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc
index e3f37cb88..a880bdae0 100644
--- a/src/nix/upgrade-nix.cc
+++ b/src/nix/upgrade-nix.cc
@@ -76,12 +76,12 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
}
{
- Activity act(*logger, Verbosity::Info, ActivityType::Unknown, fmt("downloading '%s'...", store->printStorePath(storePath)));
+ Activity act(*logger, lvlInfo, actUnknown, fmt("downloading '%s'...", store->printStorePath(storePath)));
store->ensurePath(storePath);
}
{
- Activity act(*logger, Verbosity::Info, ActivityType::Unknown, fmt("verifying that '%s' works...", store->printStorePath(storePath)));
+ Activity act(*logger, lvlInfo, actUnknown, fmt("verifying that '%s' works...", store->printStorePath(storePath)));
auto program = store->printStorePath(storePath) + "/bin/nix-env";
auto s = runProgram(program, false, {"--version"});
if (s.find("Nix") == std::string::npos)
@@ -91,7 +91,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
stopProgressBar();
{
- Activity act(*logger, Verbosity::Info, ActivityType::Unknown,
+ Activity act(*logger, lvlInfo, actUnknown,
fmt("installing '%s' into profile '%s'...", store->printStorePath(storePath), profileDir));
runProgram(settings.nixBinDir + "/nix-env", false,
{"--profile", profileDir, "-i", store->printStorePath(storePath), "--no-sandbox"});
@@ -142,7 +142,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
/* Return the store path of the latest stable Nix. */
StorePath getLatestNix(ref<Store> store)
{
- Activity act(*logger, Verbosity::Info, ActivityType::Unknown, "querying latest Nix version");
+ Activity act(*logger, lvlInfo, actUnknown, "querying latest Nix version");
// FIXME: use nixos.org?
auto req = FileTransferRequest(storePathsUrl);
diff --git a/src/nix/verify.cc b/src/nix/verify.cc
index 5b9175744..d1aba08e3 100644
--- a/src/nix/verify.cc
+++ b/src/nix/verify.cc
@@ -59,7 +59,7 @@ struct CmdVerify : StorePathsCommand
auto publicKeys = getDefaultPublicKeys();
- Activity act(*logger, ActivityType::VerifyPaths);
+ Activity act(*logger, actVerifyPaths);
std::atomic<size_t> done{0};
std::atomic<size_t> untrusted{0};
@@ -77,7 +77,7 @@ struct CmdVerify : StorePathsCommand
try {
checkInterrupt();
- Activity act2(*logger, Verbosity::Info, ActivityType::Unknown, fmt("checking '%s'", storePath));
+ Activity act2(*logger, lvlInfo, actUnknown, fmt("checking '%s'", storePath));
MaintainCount<std::atomic<size_t>> mcActive(active);
update();
@@ -98,14 +98,14 @@ struct CmdVerify : StorePathsCommand
if (hash.first != info->narHash) {
corrupted++;
- act2.result(ResultType::CorruptedPath, store->printStorePath(info->path));
+ act2.result(resCorruptedPath, store->printStorePath(info->path));
logError({
.name = "Hash error - path modified",
.hint = hintfmt(
"path '%s' was modified! expected hash '%s', got '%s'",
store->printStorePath(info->path),
- info->narHash.to_string(Base::Base32, true),
- hash.first.to_string(Base::Base32, true))
+ info->narHash.to_string(Base32, true),
+ hash.first.to_string(Base32, true))
});
}
}
@@ -153,12 +153,13 @@ struct CmdVerify : StorePathsCommand
if (!good) {
untrusted++;
- act2.result(ResultType::UntrustedPath, store->printStorePath(info->path));
+ act2.result(resUntrustedPath, store->printStorePath(info->path));
logError({
.name = "Untrusted path",
.hint = hintfmt("path '%s' is untrusted",
store->printStorePath(info->path))
});
+
}
}