mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +01:00
Merge pull request #14232 from roberth/dyndrv-messages
Better dyndrv messages
This commit is contained in:
commit
1fb4ff8c0e
12 changed files with 154 additions and 15 deletions
|
|
@ -290,7 +290,7 @@ static DerivationOutput parseDerivationOutput(
|
|||
if (!hashAlgoStr.empty()) {
|
||||
ContentAddressMethod method = ContentAddressMethod::parsePrefix(hashAlgoStr);
|
||||
if (method == ContentAddressMethod::Raw::Text)
|
||||
xpSettings.require(Xp::DynamicDerivations);
|
||||
xpSettings.require(Xp::DynamicDerivations, "text-hashed derivation output");
|
||||
const auto hashAlgo = parseHashAlgo(hashAlgoStr);
|
||||
if (hashS == "impure"sv) {
|
||||
xpSettings.require(Xp::ImpureDerivations);
|
||||
|
|
@ -428,7 +428,9 @@ Derivation parseDerivation(
|
|||
if (*versionS == "xp-dyn-drv"sv) {
|
||||
// Only version we have so far
|
||||
version = DerivationATermVersion::DynamicDerivations;
|
||||
xpSettings.require(Xp::DynamicDerivations);
|
||||
xpSettings.require(Xp::DynamicDerivations, [&] {
|
||||
return fmt("derivation '%s', ATerm format version 'xp-dyn-drv'", name);
|
||||
});
|
||||
} else {
|
||||
throw FormatError("Unknown derivation ATerm format version '%s'", *versionS);
|
||||
}
|
||||
|
|
@ -1303,7 +1305,7 @@ DerivationOutput::fromJSON(const nlohmann::json & _json, const ExperimentalFeatu
|
|||
auto methodAlgo = [&]() -> std::pair<ContentAddressMethod, HashAlgorithm> {
|
||||
ContentAddressMethod method = ContentAddressMethod::parse(getString(valueAt(json, "method")));
|
||||
if (method == ContentAddressMethod::Raw::Text)
|
||||
xpSettings.require(Xp::DynamicDerivations);
|
||||
xpSettings.require(Xp::DynamicDerivations, "text-hashed derivation output in JSON");
|
||||
|
||||
auto hashAlgo = parseHashAlgo(getString(valueAt(json, "hashAlgo")));
|
||||
return {std::move(method), std::move(hashAlgo)};
|
||||
|
|
@ -1456,7 +1458,8 @@ Derivation Derivation::fromJSON(const nlohmann::json & _json, const Experimental
|
|||
node.value = getStringSet(valueAt(json, "outputs"));
|
||||
auto drvs = getObject(valueAt(json, "dynamicOutputs"));
|
||||
for (auto & [outputId, childNode] : drvs) {
|
||||
xpSettings.require(Xp::DynamicDerivations);
|
||||
xpSettings.require(
|
||||
Xp::DynamicDerivations, [&] { return fmt("dynamic output '%s' in JSON", outputId); });
|
||||
node.childMap[outputId] = doInput(childNode);
|
||||
}
|
||||
return node;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,11 @@ void drvRequireExperiment(const SingleDerivedPath & drv, const ExperimentalFeatu
|
|||
[&](const SingleDerivedPath::Opaque &) {
|
||||
// plain drv path; no experimental features required.
|
||||
},
|
||||
[&](const SingleDerivedPath::Built &) { xpSettings.require(Xp::DynamicDerivations); },
|
||||
[&](const SingleDerivedPath::Built & b) {
|
||||
xpSettings.require(Xp::DynamicDerivations, [&] {
|
||||
return fmt("building output '%s' of '%s'", b.output, b.drvPath->getBaseStorePath().to_string());
|
||||
});
|
||||
},
|
||||
},
|
||||
drv.raw());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ DownstreamPlaceholder DownstreamPlaceholder::unknownDerivation(
|
|||
OutputNameView outputName,
|
||||
const ExperimentalFeatureSettings & xpSettings)
|
||||
{
|
||||
xpSettings.require(Xp::DynamicDerivations);
|
||||
xpSettings.require(
|
||||
Xp::DynamicDerivations, [&] { return fmt("placeholder for unknown derivation output '%s'", outputName); });
|
||||
auto compressed = compressHash(placeholder.hash, 20);
|
||||
auto clearText =
|
||||
"nix-computed-output:" + compressed.to_string(HashFormat::Nix32, false) + ":" + std::string{outputName};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue