mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
Rename final -> __final
This commit is contained in:
parent
7d1f7f8d59
commit
a7a0767df7
@ -45,7 +45,7 @@ let
|
||||
else
|
||||
# FIXME: remove obsolete node.info.
|
||||
# Note: lock file entries are always final.
|
||||
fetchTree (node.info or {} // removeAttrs node.locked ["dir"] // { final = true; });
|
||||
fetchTree (node.info or {} // removeAttrs node.locked ["dir"] // { __final = true; });
|
||||
|
||||
subdir = overrides.${key}.dir or node.locked.dir or "";
|
||||
|
||||
|
@ -101,7 +101,7 @@ Input Input::fromAttrs(const Settings & settings, Attrs && attrs)
|
||||
auto allowedAttrs = inputScheme->allowedAttrs();
|
||||
|
||||
for (auto & [name, _] : attrs)
|
||||
if (name != "type" && name != "final" && allowedAttrs.count(name) == 0)
|
||||
if (name != "type" && name != "__final" && allowedAttrs.count(name) == 0)
|
||||
throw Error("input attribute '%s' not supported by scheme '%s'", name, schemeName);
|
||||
|
||||
auto res = inputScheme->inputFromAttrs(settings, attrs);
|
||||
@ -148,7 +148,7 @@ bool Input::isLocked() const
|
||||
|
||||
bool Input::isFinal() const
|
||||
{
|
||||
return maybeGetBoolAttr(attrs, "final").value_or(false);
|
||||
return maybeGetBoolAttr(attrs, "__final").value_or(false);
|
||||
}
|
||||
|
||||
Attrs Input::toAttrs() const
|
||||
@ -189,7 +189,7 @@ std::pair<StorePath, Input> Input::fetchToStore(ref<Store> store) const
|
||||
// getAccessorUnchecked(), but then we can't add
|
||||
// narHash. Or maybe narHash should be excluded from the
|
||||
// concept of "final" inputs?
|
||||
final.attrs.insert_or_assign("final", Explicit<bool>(true));
|
||||
final.attrs.insert_or_assign("__final", Explicit<bool>(true));
|
||||
|
||||
assert(final.isFinal());
|
||||
|
||||
|
@ -78,24 +78,28 @@ public:
|
||||
Attrs toAttrs() const;
|
||||
|
||||
/**
|
||||
* Check whether this is a "direct" input, that is, not
|
||||
* Return whether this is a "direct" input, that is, not
|
||||
* one that goes through a registry.
|
||||
*/
|
||||
bool isDirect() const;
|
||||
|
||||
/**
|
||||
* Check whether this is a "locked" input, that is, it has
|
||||
* Return whether this is a "locked" input, that is, it has
|
||||
* attributes like a Git revision or NAR hash that uniquely
|
||||
* identify its contents.
|
||||
*/
|
||||
bool isLocked() const;
|
||||
|
||||
/**
|
||||
* Check whether this is a "final" input, meaning that fetching it
|
||||
* Return whether this is a "final" input, meaning that fetching it
|
||||
* will not add or change any attributes. For instance, a Git
|
||||
* input with a `rev` attribute but without a `lastModified`
|
||||
* attribute is considered locked but not final. Only "final"
|
||||
* inputs can be substituted from a binary cache.
|
||||
*
|
||||
* The "final" state is denoted by the presence of an attribute
|
||||
* `__final = true`. This attribute is currently undocumented and
|
||||
* for internal use only.
|
||||
*/
|
||||
bool isFinal() const;
|
||||
|
||||
@ -226,15 +230,12 @@ struct InputScheme
|
||||
*/
|
||||
virtual std::optional<ExperimentalFeature> experimentalFeature() const;
|
||||
|
||||
/// See `Input::isDirect()`.
|
||||
virtual bool isDirect(const Input & input) const
|
||||
{ return true; }
|
||||
|
||||
/// See `Input::getFingerprint()`.
|
||||
virtual std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const
|
||||
{ return std::nullopt; }
|
||||
|
||||
/// See `Input::isLocked()`.
|
||||
virtual bool isLocked(const Input & input) const
|
||||
{ return false; }
|
||||
|
||||
|
@ -72,7 +72,7 @@ struct PathInputScheme : InputScheme
|
||||
auto query = attrsToQuery(input.attrs);
|
||||
query.erase("path");
|
||||
query.erase("type");
|
||||
query.erase("final");
|
||||
query.erase("__final");
|
||||
return ParsedURL {
|
||||
.scheme = "path",
|
||||
.path = getStrAttr(input.attrs, "path"),
|
||||
|
@ -48,8 +48,8 @@ LockedNode::LockedNode(
|
||||
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
||||
|
||||
// For backward compatibility, lock file entries are implicitly final.
|
||||
assert(!lockedRef.input.attrs.contains("final"));
|
||||
lockedRef.input.attrs.insert_or_assign("final", Explicit<bool>(true));
|
||||
assert(!lockedRef.input.attrs.contains("__final"));
|
||||
lockedRef.input.attrs.insert_or_assign("__final", Explicit<bool>(true));
|
||||
}
|
||||
|
||||
StorePath LockedNode::computeStorePath(Store & store) const
|
||||
@ -194,11 +194,11 @@ std::pair<nlohmann::json, LockFile::KeyMap> LockFile::toJSON() const
|
||||
if (auto lockedNode = node.dynamic_pointer_cast<const LockedNode>()) {
|
||||
n["original"] = fetchers::attrsToJSON(lockedNode->originalRef.toAttrs());
|
||||
n["locked"] = fetchers::attrsToJSON(lockedNode->lockedRef.toAttrs());
|
||||
/* For backward compatibility, omit the "final"
|
||||
/* For backward compatibility, omit the "__final"
|
||||
attribute. We never allow non-final inputs in lock files
|
||||
anyway. */
|
||||
assert(lockedNode->lockedRef.input.isFinal());
|
||||
n["locked"].erase("final");
|
||||
n["locked"].erase("__final");
|
||||
if (!lockedNode->isFlake)
|
||||
n["flake"] = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user