forked from lix-project/lix
WIP
This commit is contained in:
parent
754c910953
commit
efcd30da89
|
@ -70,7 +70,10 @@ DownloadFileResult downloadFile(
|
||||||
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Flat, hash, name));
|
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Flat, hash, name));
|
||||||
info.narHash = hashString(HashType::SHA256, *sink.s);
|
info.narHash = hashString(HashType::SHA256, *sink.s);
|
||||||
info.narSize = sink.s->size();
|
info.narSize = sink.s->size();
|
||||||
info.ca = makeFixedOutputCA(FileIngestionMethod::Flat, hash);
|
info.ca = FileSystemHash {
|
||||||
|
.method = FileIngestionMethod::Flat,
|
||||||
|
.hash = hash,
|
||||||
|
};
|
||||||
store->addToStore(info, sink.s, NoRepair, NoCheckSigs);
|
store->addToStore(info, sink.s, NoRepair, NoCheckSigs);
|
||||||
storePath = std::move(info.path);
|
storePath = std::move(info.path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3708,7 +3708,7 @@ void DerivationGoal::registerOutputs()
|
||||||
/* Check that fixed-output derivations produced the right
|
/* Check that fixed-output derivations produced the right
|
||||||
outputs (i.e., the content hash should match the specified
|
outputs (i.e., the content hash should match the specified
|
||||||
hash). */
|
hash). */
|
||||||
std::string ca;
|
std::optional<ContentAddress> ca;
|
||||||
|
|
||||||
if (fixedOutput) {
|
if (fixedOutput) {
|
||||||
|
|
||||||
|
@ -3757,7 +3757,10 @@ void DerivationGoal::registerOutputs()
|
||||||
else
|
else
|
||||||
assert(worker.store.parseStorePath(path) == dest);
|
assert(worker.store.parseStorePath(path) == dest);
|
||||||
|
|
||||||
ca = makeFixedOutputCA(i.second.hash->method, h2);
|
ca = FileSystemHash {
|
||||||
|
.method = i.second.hash->method,
|
||||||
|
.hash = h2,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get rid of all weird permissions. This also checks that
|
/* Get rid of all weird permissions. This also checks that
|
||||||
|
@ -3830,7 +3833,10 @@ void DerivationGoal::registerOutputs()
|
||||||
info.ca = ca;
|
info.ca = ca;
|
||||||
worker.store.signPathInfo(info);
|
worker.store.signPathInfo(info);
|
||||||
|
|
||||||
if (!info.references.empty()) info.ca.clear();
|
if (!info.references.empty()) {
|
||||||
|
// FIXME don't we have an experimental feature for fixed output with references?
|
||||||
|
info.ca = {};
|
||||||
|
}
|
||||||
|
|
||||||
infos.emplace(i.first, std::move(info));
|
infos.emplace(i.first, std::move(info));
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,7 +650,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 16) {
|
if (GET_PROTOCOL_MINOR(clientVersion) >= 16) {
|
||||||
to << info->ultimate
|
to << info->ultimate
|
||||||
<< info->sigs
|
<< info->sigs
|
||||||
<< info->ca;
|
<< renderContentAddress(info->ca);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(GET_PROTOCOL_MINOR(clientVersion) >= 17);
|
assert(GET_PROTOCOL_MINOR(clientVersion) >= 17);
|
||||||
|
@ -708,7 +708,12 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||||
info.references = readStorePaths<StorePathSet>(*store, from);
|
info.references = readStorePaths<StorePathSet>(*store, from);
|
||||||
from >> info.registrationTime >> info.narSize >> info.ultimate;
|
from >> info.registrationTime >> info.narSize >> info.ultimate;
|
||||||
info.sigs = readStrings<StringSet>(from);
|
info.sigs = readStrings<StringSet>(from);
|
||||||
from >> info.ca >> repair >> dontCheckSigs;
|
{
|
||||||
|
string caOptRaw;
|
||||||
|
from >> caOptRaw;
|
||||||
|
info.ca = parseCaOpt(caOptRaw);
|
||||||
|
}
|
||||||
|
from >> repair >> dontCheckSigs;
|
||||||
if (!trusted && dontCheckSigs)
|
if (!trusted && dontCheckSigs)
|
||||||
dontCheckSigs = false;
|
dontCheckSigs = false;
|
||||||
if (!trusted)
|
if (!trusted)
|
||||||
|
|
|
@ -38,8 +38,16 @@ std::string renderContentAddress(ContentAddress ca) {
|
||||||
}, ca);
|
}, ca);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string renderContentAddress(std::optionalContent<Address> ca) {
|
ContentAddress parseCa(std::string_view rawCa) {
|
||||||
return ca ? renderContentAddress(*ca) else "";
|
throw Error("TODO");
|
||||||
|
};
|
||||||
|
|
||||||
|
std::optional<ContentAddress> parseCaOpt(std::string_view rawCaOpt) {
|
||||||
|
return rawCaOpt == "" ? std::optional<ContentAddress> {} : parseCa(rawCaOpt);
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string renderContentAddress(std::optional<ContentAddress> ca) {
|
||||||
|
return ca ? renderContentAddress(*ca) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,9 @@ enum struct FileIngestionMethod : uint8_t {
|
||||||
|
|
||||||
struct TextHash {
|
struct TextHash {
|
||||||
Hash hash;
|
Hash hash;
|
||||||
|
TextHash(const TextHash &) = default;
|
||||||
|
TextHash(TextHash &&) = default;
|
||||||
|
TextHash & operator = (const TextHash &) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Pair of a hash, and how the file system was ingested
|
/// Pair of a hash, and how the file system was ingested
|
||||||
|
@ -56,4 +59,8 @@ std::string renderContentAddress(ContentAddress ca);
|
||||||
|
|
||||||
std::string renderContentAddress(std::optional<ContentAddress> ca);
|
std::string renderContentAddress(std::optional<ContentAddress> ca);
|
||||||
|
|
||||||
|
ContentAddress parseCa(std::string_view rawCa);
|
||||||
|
|
||||||
|
std::optional<ContentAddress> parseCaOpt(std::string_view rawCaOpt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,11 @@ struct LegacySSHStore : public Store
|
||||||
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) {
|
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) {
|
||||||
auto s = readString(conn->from);
|
auto s = readString(conn->from);
|
||||||
info->narHash = s.empty() ? Hash() : Hash(s);
|
info->narHash = s.empty() ? Hash() : Hash(s);
|
||||||
conn->from >> info->ca;
|
{
|
||||||
|
std::string rawCaOpt;
|
||||||
|
conn->from >> rawCaOpt;
|
||||||
|
info->ca = parseCaOpt(rawCaOpt);
|
||||||
|
}
|
||||||
info->sigs = readStrings<StringSet>(conn->from);
|
info->sigs = readStrings<StringSet>(conn->from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +150,7 @@ struct LegacySSHStore : public Store
|
||||||
<< info.narSize
|
<< info.narSize
|
||||||
<< info.ultimate
|
<< info.ultimate
|
||||||
<< info.sigs
|
<< info.sigs
|
||||||
<< info.ca;
|
<< renderContentAddress(info.ca);
|
||||||
try {
|
try {
|
||||||
copyNAR(source, conn->to);
|
copyNAR(source, conn->to);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
|
@ -576,7 +576,7 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat
|
||||||
uint64_t LocalStore::addValidPath(State & state,
|
uint64_t LocalStore::addValidPath(State & state,
|
||||||
const ValidPathInfo & info, bool checkOutputs)
|
const ValidPathInfo & info, bool checkOutputs)
|
||||||
{
|
{
|
||||||
if (info.ca != "" && !info.isContentAddressed(*this))
|
if (info.ca && !info.isContentAddressed(*this))
|
||||||
throw Error("cannot add path '%s' to the Nix store because it claims to be content-addressed but isn't",
|
throw Error("cannot add path '%s' to the Nix store because it claims to be content-addressed but isn't",
|
||||||
printStorePath(info.path));
|
printStorePath(info.path));
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ uint64_t LocalStore::addValidPath(State & state,
|
||||||
(info.narSize, info.narSize != 0)
|
(info.narSize, info.narSize != 0)
|
||||||
(info.ultimate ? 1 : 0, info.ultimate)
|
(info.ultimate ? 1 : 0, info.ultimate)
|
||||||
(concatStringsSep(" ", info.sigs), !info.sigs.empty())
|
(concatStringsSep(" ", info.sigs), !info.sigs.empty())
|
||||||
(info.ca, !info.ca.empty())
|
(renderContentAddress(info.ca), (bool) info.ca)
|
||||||
.exec();
|
.exec();
|
||||||
uint64_t id = sqlite3_last_insert_rowid(state.db);
|
uint64_t id = sqlite3_last_insert_rowid(state.db);
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ void LocalStore::queryPathInfoUncached(const StorePath & path,
|
||||||
if (s) info->sigs = tokenizeString<StringSet>(s, " ");
|
if (s) info->sigs = tokenizeString<StringSet>(s, " ");
|
||||||
|
|
||||||
s = (const char *) sqlite3_column_text(state->stmtQueryPathInfo, 7);
|
s = (const char *) sqlite3_column_text(state->stmtQueryPathInfo, 7);
|
||||||
if (s) info->ca = s;
|
if (s) info->ca = parseCaOpt(s);
|
||||||
|
|
||||||
/* Get the references. */
|
/* Get the references. */
|
||||||
auto useQueryReferences(state->stmtQueryReferences.use()(info->id));
|
auto useQueryReferences(state->stmtQueryReferences.use()(info->id));
|
||||||
|
@ -685,7 +685,7 @@ void LocalStore::updatePathInfo(State & state, const ValidPathInfo & info)
|
||||||
(info.narHash.to_string(Base::Base16))
|
(info.narHash.to_string(Base::Base16))
|
||||||
(info.ultimate ? 1 : 0, info.ultimate)
|
(info.ultimate ? 1 : 0, info.ultimate)
|
||||||
(concatStringsSep(" ", info.sigs), !info.sigs.empty())
|
(concatStringsSep(" ", info.sigs), !info.sigs.empty())
|
||||||
(info.ca, !info.ca.empty())
|
(renderContentAddress(info.ca), (bool) info.ca)
|
||||||
(printStorePath(info.path))
|
(printStorePath(info.path))
|
||||||
.exec();
|
.exec();
|
||||||
}
|
}
|
||||||
|
@ -999,15 +999,13 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
|
||||||
|
|
||||||
deletePath(realPath);
|
deletePath(realPath);
|
||||||
|
|
||||||
if (info.ca != "" &&
|
if (info.ca && !info.references.empty() && !std::holds_alternative<TextHash>(*info.ca))
|
||||||
!((hasPrefix(info.ca, "text:") && !info.references.count(info.path))
|
|
||||||
|| info.references.empty()))
|
|
||||||
settings.requireExperimentalFeature("ca-references");
|
settings.requireExperimentalFeature("ca-references");
|
||||||
|
|
||||||
/* While restoring the path from the NAR, compute the hash
|
/* While restoring the path from the NAR, compute the hash
|
||||||
of the NAR. */
|
of the NAR. */
|
||||||
std::unique_ptr<AbstractHashSink> hashSink;
|
std::unique_ptr<AbstractHashSink> hashSink;
|
||||||
if (info.ca == "" || !info.references.count(info.path))
|
if (info.ca || !info.references.count(info.path))
|
||||||
hashSink = std::make_unique<HashSink>(HashType::SHA256);
|
hashSink = std::make_unique<HashSink>(HashType::SHA256);
|
||||||
else
|
else
|
||||||
hashSink = std::make_unique<HashModuloSink>(HashType::SHA256, storePathToHash(printStorePath(info.path)));
|
hashSink = std::make_unique<HashModuloSink>(HashType::SHA256, storePathToHash(printStorePath(info.path)));
|
||||||
|
@ -1093,7 +1091,10 @@ StorePath LocalStore::addToStoreFromDump(const string & dump, const string & nam
|
||||||
ValidPathInfo info(dstPath.clone());
|
ValidPathInfo info(dstPath.clone());
|
||||||
info.narHash = hash.first;
|
info.narHash = hash.first;
|
||||||
info.narSize = hash.second;
|
info.narSize = hash.second;
|
||||||
info.ca = makeFixedOutputCA(method, h);
|
info.ca = FileSystemHash {
|
||||||
|
.method = method,
|
||||||
|
.hash = h,
|
||||||
|
};
|
||||||
registerValidPath(info);
|
registerValidPath(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1157,7 +1158,7 @@ StorePath LocalStore::addTextToStore(const string & name, const string & s,
|
||||||
info.narHash = narHash;
|
info.narHash = narHash;
|
||||||
info.narSize = sink.s->size();
|
info.narSize = sink.s->size();
|
||||||
info.references = cloneStorePathSet(references);
|
info.references = cloneStorePathSet(references);
|
||||||
info.ca = "text:" + hash.to_string();
|
info.ca = TextHash { .hash = hash };
|
||||||
registerValidPath(info);
|
registerValidPath(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1265,7 +1266,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
||||||
printMsg(Verbosity::Talkative, "checking contents of '%s'", printStorePath(i));
|
printMsg(Verbosity::Talkative, "checking contents of '%s'", printStorePath(i));
|
||||||
|
|
||||||
std::unique_ptr<AbstractHashSink> hashSink;
|
std::unique_ptr<AbstractHashSink> hashSink;
|
||||||
if (info->ca == "" || !info->references.count(info->path))
|
if (info->ca || !info->references.count(info->path))
|
||||||
hashSink = std::make_unique<HashSink>(info->narHash.type);
|
hashSink = std::make_unique<HashSink>(info->narHash.type);
|
||||||
else
|
else
|
||||||
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(printStorePath(info->path)));
|
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(printStorePath(info->path)));
|
||||||
|
|
|
@ -203,7 +203,7 @@ public:
|
||||||
narInfo->deriver = StorePath::fromBaseName(queryNAR.getStr(9));
|
narInfo->deriver = StorePath::fromBaseName(queryNAR.getStr(9));
|
||||||
for (auto & sig : tokenizeString<Strings>(queryNAR.getStr(10), " "))
|
for (auto & sig : tokenizeString<Strings>(queryNAR.getStr(10), " "))
|
||||||
narInfo->sigs.insert(sig);
|
narInfo->sigs.insert(sig);
|
||||||
narInfo->ca = queryNAR.getStr(11);
|
narInfo->ca = parseCaOpt(queryNAR.getStr(11));
|
||||||
|
|
||||||
return {oValid, narInfo};
|
return {oValid, narInfo};
|
||||||
});
|
});
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
(concatStringsSep(" ", info->shortRefs()))
|
(concatStringsSep(" ", info->shortRefs()))
|
||||||
(info->deriver ? std::string(info->deriver->to_string()) : "", (bool) info->deriver)
|
(info->deriver ? std::string(info->deriver->to_string()) : "", (bool) info->deriver)
|
||||||
(concatStringsSep(" ", info->sigs))
|
(concatStringsSep(" ", info->sigs))
|
||||||
(info->ca)
|
(renderContentAddress(info->ca))
|
||||||
(time(0)).exec();
|
(time(0)).exec();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,8 +67,9 @@ NarInfo::NarInfo(const Store & store, const std::string & s, const std::string &
|
||||||
else if (name == "Sig")
|
else if (name == "Sig")
|
||||||
sigs.insert(value);
|
sigs.insert(value);
|
||||||
else if (name == "CA") {
|
else if (name == "CA") {
|
||||||
if (!ca.empty()) corrupt();
|
if (ca) corrupt();
|
||||||
ca = value;
|
// FIXME: allow blank ca or require skipping field?
|
||||||
|
ca = parseCaOpt(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = eol + 1;
|
pos = eol + 1;
|
||||||
|
@ -104,8 +105,8 @@ std::string NarInfo::to_string(const Store & store) const
|
||||||
for (auto sig : sigs)
|
for (auto sig : sigs)
|
||||||
res += "Sig: " + sig + "\n";
|
res += "Sig: " + sig + "\n";
|
||||||
|
|
||||||
if (!ca.empty())
|
if (ca)
|
||||||
res += "CA: " + ca + "\n";
|
res += "CA: " + renderContentAddress(*ca) + "\n";
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,9 @@ void RemoteStore::queryPathInfoUncached(const StorePath & path,
|
||||||
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
|
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
|
||||||
conn->from >> info->ultimate;
|
conn->from >> info->ultimate;
|
||||||
info->sigs = readStrings<StringSet>(conn->from);
|
info->sigs = readStrings<StringSet>(conn->from);
|
||||||
conn->from >> info->ca;
|
string caOptRaw;
|
||||||
|
conn->from >> caOptRaw;
|
||||||
|
info->ca = parseCaOpt(caOptRaw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callback(std::move(info));
|
callback(std::move(info));
|
||||||
|
@ -474,7 +476,7 @@ void RemoteStore::addToStore(const ValidPathInfo & info, Source & source,
|
||||||
<< info.narHash.to_string(Base::Base16, false);
|
<< info.narHash.to_string(Base::Base16, false);
|
||||||
writeStorePaths(*this, conn->to, info.references);
|
writeStorePaths(*this, conn->to, info.references);
|
||||||
conn->to << info.registrationTime << info.narSize
|
conn->to << info.registrationTime << info.narSize
|
||||||
<< info.ultimate << info.sigs << info.ca
|
<< info.ultimate << info.sigs << renderContentAddress(info.ca)
|
||||||
<< repair << !checkSigs;
|
<< repair << !checkSigs;
|
||||||
bool tunnel = GET_PROTOCOL_MINOR(conn->daemonVersion) >= 21;
|
bool tunnel = GET_PROTOCOL_MINOR(conn->daemonVersion) >= 21;
|
||||||
if (!tunnel) copyNAR(source, conn->to);
|
if (!tunnel) copyNAR(source, conn->to);
|
||||||
|
|
|
@ -468,7 +468,7 @@ void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & store
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->ca)
|
if (info->ca)
|
||||||
jsonPath.attr("ca", info->ca);
|
jsonPath.attr("ca", renderContentAddress(info->ca));
|
||||||
|
|
||||||
std::pair<uint64_t, uint64_t> closureSizes;
|
std::pair<uint64_t, uint64_t> closureSizes;
|
||||||
|
|
||||||
|
@ -760,24 +760,23 @@ bool ValidPathInfo::isContentAddressed(const Store & store) const
|
||||||
printError("warning: path '%s' claims to be content-addressed but isn't", store.printStorePath(path));
|
printError("warning: path '%s' claims to be content-addressed but isn't", store.printStorePath(path));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasPrefix(ca, "text:")) {
|
if (! ca) {}
|
||||||
Hash hash(std::string(ca, 5));
|
|
||||||
if (store.makeTextPath(path.name(), hash, references) == path)
|
else if (auto p = std::get_if<TextHash>(&*ca)) {
|
||||||
|
if (store.makeTextPath(path.name(), p->hash, references) == path)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
warn();
|
warn();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (hasPrefix(ca, "fixed:")) {
|
else if (auto p = std::get_if<FileSystemHash>(&*ca)) {
|
||||||
FileIngestionMethod recursive { ca.compare(6, 2, "r:") == 0 };
|
|
||||||
Hash hash(std::string(ca, recursive == FileIngestionMethod::Recursive ? 8 : 6));
|
|
||||||
auto refs = cloneStorePathSet(references);
|
auto refs = cloneStorePathSet(references);
|
||||||
bool hasSelfReference = false;
|
bool hasSelfReference = false;
|
||||||
if (refs.count(path)) {
|
if (refs.count(path)) {
|
||||||
hasSelfReference = true;
|
hasSelfReference = true;
|
||||||
refs.erase(path);
|
refs.erase(path);
|
||||||
}
|
}
|
||||||
if (store.makeFixedOutputPath(recursive, hash, path.name(), refs, hasSelfReference) == path)
|
if (store.makeFixedOutputPath(p->method, p->hash, path.name(), refs, hasSelfReference) == path)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
warn();
|
warn();
|
||||||
|
|
Binary file not shown.
|
@ -944,7 +944,11 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
info.references = readStorePaths<StorePathSet>(*store, in);
|
info.references = readStorePaths<StorePathSet>(*store, in);
|
||||||
in >> info.registrationTime >> info.narSize >> info.ultimate;
|
in >> info.registrationTime >> info.narSize >> info.ultimate;
|
||||||
info.sigs = readStrings<StringSet>(in);
|
info.sigs = readStrings<StringSet>(in);
|
||||||
in >> info.ca;
|
{
|
||||||
|
std::string rawCA;
|
||||||
|
in >> rawCA;
|
||||||
|
info.ca = parseCaOpt(rawCA);
|
||||||
|
}
|
||||||
|
|
||||||
if (info.narSize == 0)
|
if (info.narSize == 0)
|
||||||
throw Error("narInfo is too old and missing the narSize field");
|
throw Error("narInfo is too old and missing the narSize field");
|
||||||
|
|
|
@ -48,7 +48,10 @@ struct CmdAddToStore : MixDryRun, StoreCommand
|
||||||
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Recursive, narHash, *namePart));
|
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Recursive, narHash, *namePart));
|
||||||
info.narHash = narHash;
|
info.narHash = narHash;
|
||||||
info.narSize = sink.s->size();
|
info.narSize = sink.s->size();
|
||||||
info.ca = makeFixedOutputCA(FileIngestionMethod::Recursive, info.narHash);
|
*info.ca = FileSystemHash {
|
||||||
|
.method = FileIngestionMethod::Recursive,
|
||||||
|
.hash = info.narHash
|
||||||
|
};
|
||||||
|
|
||||||
if (!dryRun)
|
if (!dryRun)
|
||||||
store->addToStore(info, sink.s);
|
store->addToStore(info, sink.s);
|
||||||
|
|
|
@ -82,7 +82,10 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
|
||||||
if (hasSelfReference) info.references.insert(info.path.clone());
|
if (hasSelfReference) info.references.insert(info.path.clone());
|
||||||
info.narHash = narHash;
|
info.narHash = narHash;
|
||||||
info.narSize = sink.s->size();
|
info.narSize = sink.s->size();
|
||||||
info.ca = makeFixedOutputCA(FileIngestionMethod::Recursive, info.narHash);
|
info.ca = FileSystemHash {
|
||||||
|
.method = FileIngestionMethod::Recursive,
|
||||||
|
.hash = info.narHash,
|
||||||
|
};
|
||||||
|
|
||||||
if (!json)
|
if (!json)
|
||||||
printError("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
|
printError("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
|
||||||
|
|
|
@ -115,7 +115,7 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||||
std::cout << '\t';
|
std::cout << '\t';
|
||||||
Strings ss;
|
Strings ss;
|
||||||
if (info->ultimate) ss.push_back("ultimate");
|
if (info->ultimate) ss.push_back("ultimate");
|
||||||
if (info->ca != "") ss.push_back("ca:" + renderContentAddress(*info->ca));
|
if (info->ca) ss.push_back("ca:" + renderContentAddress(*info->ca));
|
||||||
for (auto & sig : info->sigs) ss.push_back(sig);
|
for (auto & sig : info->sigs) ss.push_back(sig);
|
||||||
std::cout << concatStringsSep(" ", ss);
|
std::cout << concatStringsSep(" ", ss);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
if (!noContents) {
|
if (!noContents) {
|
||||||
|
|
||||||
std::unique_ptr<AbstractHashSink> hashSink;
|
std::unique_ptr<AbstractHashSink> hashSink;
|
||||||
if (info->ca == "")
|
if (info->ca)
|
||||||
hashSink = std::make_unique<HashSink>(info->narHash.type);
|
hashSink = std::make_unique<HashSink>(info->narHash.type);
|
||||||
else
|
else
|
||||||
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(store->printStorePath(info->path)));
|
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(store->printStorePath(info->path)));
|
||||||
|
|
Loading…
Reference in a new issue