aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/add-to-store.cc16
-rw-r--r--src/nix/bundle.cc2
-rw-r--r--src/nix/make-content-addressable.cc38
-rw-r--r--src/nix/profile.cc13
-rw-r--r--src/nix/verify.cc6
5 files changed, 45 insertions, 30 deletions
diff --git a/src/nix/add-to-store.cc b/src/nix/add-to-store.cc
index 023ffa4ed..86616d66b 100644
--- a/src/nix/add-to-store.cc
+++ b/src/nix/add-to-store.cc
@@ -69,14 +69,20 @@ struct CmdAddToStore : MixDryRun, StoreCommand
}
ValidPathInfo info {
- store->makeFixedOutputPath(ingestionMethod, hash, *namePart),
+ *store,
+ StorePathDescriptor {
+ .name = *namePart,
+ .info = FixedOutputInfo {
+ {
+ .method = std::move(ingestionMethod),
+ .hash = std::move(hash),
+ },
+ {},
+ },
+ },
narHash,
};
info.narSize = sink.s->size();
- info.ca = std::optional { FixedOutputHash {
- .method = ingestionMethod,
- .hash = hash,
- } };
if (!dryRun) {
auto source = StringSource { *sink.s };
diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc
index fc41da9e4..510df7504 100644
--- a/src/nix/bundle.cc
+++ b/src/nix/bundle.cc
@@ -91,7 +91,7 @@ struct CmdBundle : InstallableCommand
mkString(*evalState->allocAttr(*arg, evalState->symbols.create("system")), settings.thisSystem.get());
arg->attrs->sort();
-
+
auto vRes = evalState->allocValue();
evalState->callFunction(*bundler.toValue(*evalState).first, *arg, *vRes, noPos);
diff --git a/src/nix/make-content-addressable.cc b/src/nix/make-content-addressable.cc
index 7737f6d91..7695c98f8 100644
--- a/src/nix/make-content-addressable.cc
+++ b/src/nix/make-content-addressable.cc
@@ -55,19 +55,15 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
StringMap rewrites;
- StorePathSet references;
- bool hasSelfReference = false;
+ PathReferences<StorePath> refs;
+ refs.hasSelfReference = oldInfo->hasSelfReference;
for (auto & ref : oldInfo->references) {
- if (ref == path)
- hasSelfReference = true;
- else {
- auto i = remappings.find(ref);
- auto replacement = i != remappings.end() ? i->second : ref;
- // FIXME: warn about unremapped paths?
- if (replacement != ref)
- rewrites.insert_or_assign(store->printStorePath(ref), store->printStorePath(replacement));
- references.insert(std::move(replacement));
- }
+ auto i = remappings.find(ref);
+ auto replacement = i != remappings.end() ? i->second : ref;
+ // FIXME: warn about unremapped paths?
+ if (replacement != ref)
+ rewrites.insert_or_assign(store->printStorePath(ref), store->printStorePath(replacement));
+ refs.references.insert(std::move(replacement));
}
*sink.s = rewriteStrings(*sink.s, rewrites);
@@ -78,16 +74,20 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
auto narHash = hashModuloSink.finish().first;
ValidPathInfo info {
- store->makeFixedOutputPath(FileIngestionMethod::Recursive, narHash, path.name(), references, hasSelfReference),
+ *store,
+ StorePathDescriptor {
+ .name = std::string { path.name() },
+ .info = FixedOutputInfo {
+ {
+ .method = FileIngestionMethod::Recursive,
+ .hash = narHash,
+ },
+ std::move(refs),
+ },
+ },
narHash,
};
- info.references = std::move(references);
- info.hasSelfReference = std::move(hasSelfReference);
info.narSize = sink.s->size();
- info.ca = FixedOutputHash {
- .method = FileIngestionMethod::Recursive,
- .hash = info.narHash,
- };
if (!json)
printInfo("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
diff --git a/src/nix/profile.cc b/src/nix/profile.cc
index 7ce4dfe4c..41a4857fc 100644
--- a/src/nix/profile.cc
+++ b/src/nix/profile.cc
@@ -130,12 +130,21 @@ struct ProfileManifest
auto narHash = hashString(htSHA256, *sink.s);
ValidPathInfo info {
- store->makeFixedOutputPath(FileIngestionMethod::Recursive, narHash, "profile", references),
+ *store,
+ StorePathDescriptor {
+ "profile",
+ FixedOutputInfo {
+ {
+ .method = FileIngestionMethod::Recursive,
+ .hash = narHash,
+ },
+ { references },
+ },
+ },
narHash,
};
info.references = std::move(references);
info.narSize = sink.s->size();
- info.ca = FixedOutputHash { .method = FileIngestionMethod::Recursive, .hash = info.narHash };
auto source = StringSource { *sink.s };
store->addToStore(info, source);
diff --git a/src/nix/verify.cc b/src/nix/verify.cc
index 26f755fd9..d189a2fd3 100644
--- a/src/nix/verify.cc
+++ b/src/nix/verify.cc
@@ -73,14 +73,14 @@ struct CmdVerify : StorePathsCommand
ThreadPool pool;
- auto doPath = [&](const Path & storePath) {
+ auto doPath = [&](const StorePath & storePath) {
try {
checkInterrupt();
MaintainCount<std::atomic<size_t>> mcActive(active);
update();
- auto info = store->queryPathInfo(store->parseStorePath(storePath));
+ auto info = store->queryPathInfo(storePath);
// Note: info->path can be different from storePath
// for binary cache stores when using --all (since we
@@ -178,7 +178,7 @@ struct CmdVerify : StorePathsCommand
};
for (auto & storePath : storePaths)
- pool.enqueue(std::bind(doPath, store->printStorePath(storePath)));
+ pool.enqueue(std::bind(doPath, storePath));
pool.process();