aboutsummaryrefslogtreecommitdiff
path: root/src/nix/make-content-addressable.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-17 03:39:39 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-17 03:39:39 +0000
commit49308ef0397a3da04ae1822188b1fedc70a33243 (patch)
tree96bb06a039bcf472b1f3796bcb4b534df3f732ad /src/nix/make-content-addressable.cc
parent74b251b2f3d6414de051c8523011c0ee3c5ea154 (diff)
parent29542865cee37ab22efe1bd142900b69f6c59f0d (diff)
Merge remote-tracking branch 'upstream/master' into ca-drv
Diffstat (limited to 'src/nix/make-content-addressable.cc')
-rw-r--r--src/nix/make-content-addressable.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nix/make-content-addressable.cc b/src/nix/make-content-addressable.cc
index 3e7ff544d..0ebb8f13b 100644
--- a/src/nix/make-content-addressable.cc
+++ b/src/nix/make-content-addressable.cc
@@ -36,7 +36,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
void run(ref<Store> store, StorePaths storePaths) override
{
- auto paths = store->topoSortPaths(storePathsToSet(storePaths));
+ auto paths = store->topoSortPaths(StorePathSet(storePaths.begin(), storePaths.end()));
std::reverse(paths.begin(), paths.end());
@@ -48,7 +48,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
for (auto & path : paths) {
auto pathS = store->printStorePath(path);
auto oldInfo = store->queryPathInfo(path);
- auto oldHashPart = storePathToHash(pathS);
+ std::string oldHashPart(path.hashPart());
StringSink sink;
store->narFromPath(path, sink);
@@ -62,7 +62,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
hasSelfReference = true;
else {
auto i = remappings.find(ref);
- auto replacement = i != remappings.end() ? i->second.clone() : ref.clone();
+ 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));
@@ -79,16 +79,16 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Recursive, narHash, path.name(), references, hasSelfReference));
info.references = std::move(references);
- if (hasSelfReference) info.references.insert(info.path.clone());
+ if (hasSelfReference) info.references.insert(info.path);
info.narHash = narHash;
info.narSize = sink.s->size();
info.ca = makeFixedOutputCA(FileIngestionMethod::Recursive, info.narHash);
if (!json)
- printError("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
+ printInfo("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
auto source = sinkToSource([&](Sink & nextSink) {
- RewritingSink rsink2(oldHashPart, storePathToHash(store->printStorePath(info.path)), nextSink);
+ RewritingSink rsink2(oldHashPart, std::string(info.path.hashPart()), nextSink);
rsink2((unsigned char *) sink.s->data(), sink.s->size());
rsink2.flush();
});