mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
Rename final -> __final
This commit is contained in:
parent
7d1f7f8d59
commit
a7a0767df7
5 changed files with 16 additions and 15 deletions
|
@ -45,7 +45,7 @@ let
|
||||||
else
|
else
|
||||||
# FIXME: remove obsolete node.info.
|
# FIXME: remove obsolete node.info.
|
||||||
# Note: lock file entries are always final.
|
# 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 "";
|
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();
|
auto allowedAttrs = inputScheme->allowedAttrs();
|
||||||
|
|
||||||
for (auto & [name, _] : attrs)
|
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);
|
throw Error("input attribute '%s' not supported by scheme '%s'", name, schemeName);
|
||||||
|
|
||||||
auto res = inputScheme->inputFromAttrs(settings, attrs);
|
auto res = inputScheme->inputFromAttrs(settings, attrs);
|
||||||
|
@ -148,7 +148,7 @@ bool Input::isLocked() const
|
||||||
|
|
||||||
bool Input::isFinal() const
|
bool Input::isFinal() const
|
||||||
{
|
{
|
||||||
return maybeGetBoolAttr(attrs, "final").value_or(false);
|
return maybeGetBoolAttr(attrs, "__final").value_or(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Attrs Input::toAttrs() const
|
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
|
// getAccessorUnchecked(), but then we can't add
|
||||||
// narHash. Or maybe narHash should be excluded from the
|
// narHash. Or maybe narHash should be excluded from the
|
||||||
// concept of "final" inputs?
|
// 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());
|
assert(final.isFinal());
|
||||||
|
|
||||||
|
|
|
@ -78,24 +78,28 @@ public:
|
||||||
Attrs toAttrs() const;
|
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.
|
* one that goes through a registry.
|
||||||
*/
|
*/
|
||||||
bool isDirect() const;
|
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
|
* attributes like a Git revision or NAR hash that uniquely
|
||||||
* identify its contents.
|
* identify its contents.
|
||||||
*/
|
*/
|
||||||
bool isLocked() const;
|
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
|
* will not add or change any attributes. For instance, a Git
|
||||||
* input with a `rev` attribute but without a `lastModified`
|
* input with a `rev` attribute but without a `lastModified`
|
||||||
* attribute is considered locked but not final. Only "final"
|
* attribute is considered locked but not final. Only "final"
|
||||||
* inputs can be substituted from a binary cache.
|
* 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;
|
bool isFinal() const;
|
||||||
|
|
||||||
|
@ -226,15 +230,12 @@ struct InputScheme
|
||||||
*/
|
*/
|
||||||
virtual std::optional<ExperimentalFeature> experimentalFeature() const;
|
virtual std::optional<ExperimentalFeature> experimentalFeature() const;
|
||||||
|
|
||||||
/// See `Input::isDirect()`.
|
|
||||||
virtual bool isDirect(const Input & input) const
|
virtual bool isDirect(const Input & input) const
|
||||||
{ return true; }
|
{ return true; }
|
||||||
|
|
||||||
/// See `Input::getFingerprint()`.
|
|
||||||
virtual std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const
|
virtual std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const
|
||||||
{ return std::nullopt; }
|
{ return std::nullopt; }
|
||||||
|
|
||||||
/// See `Input::isLocked()`.
|
|
||||||
virtual bool isLocked(const Input & input) const
|
virtual bool isLocked(const Input & input) const
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ struct PathInputScheme : InputScheme
|
||||||
auto query = attrsToQuery(input.attrs);
|
auto query = attrsToQuery(input.attrs);
|
||||||
query.erase("path");
|
query.erase("path");
|
||||||
query.erase("type");
|
query.erase("type");
|
||||||
query.erase("final");
|
query.erase("__final");
|
||||||
return ParsedURL {
|
return ParsedURL {
|
||||||
.scheme = "path",
|
.scheme = "path",
|
||||||
.path = getStrAttr(input.attrs, "path"),
|
.path = getStrAttr(input.attrs, "path"),
|
||||||
|
|
|
@ -48,8 +48,8 @@ LockedNode::LockedNode(
|
||||||
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
||||||
|
|
||||||
// For backward compatibility, lock file entries are implicitly final.
|
// For backward compatibility, lock file entries are implicitly final.
|
||||||
assert(!lockedRef.input.attrs.contains("final"));
|
assert(!lockedRef.input.attrs.contains("__final"));
|
||||||
lockedRef.input.attrs.insert_or_assign("final", Explicit<bool>(true));
|
lockedRef.input.attrs.insert_or_assign("__final", Explicit<bool>(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
StorePath LockedNode::computeStorePath(Store & store) const
|
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>()) {
|
if (auto lockedNode = node.dynamic_pointer_cast<const LockedNode>()) {
|
||||||
n["original"] = fetchers::attrsToJSON(lockedNode->originalRef.toAttrs());
|
n["original"] = fetchers::attrsToJSON(lockedNode->originalRef.toAttrs());
|
||||||
n["locked"] = fetchers::attrsToJSON(lockedNode->lockedRef.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
|
attribute. We never allow non-final inputs in lock files
|
||||||
anyway. */
|
anyway. */
|
||||||
assert(lockedNode->lockedRef.input.isFinal());
|
assert(lockedNode->lockedRef.input.isFinal());
|
||||||
n["locked"].erase("final");
|
n["locked"].erase("__final");
|
||||||
if (!lockedNode->isFlake)
|
if (!lockedNode->isFlake)
|
||||||
n["flake"] = false;
|
n["flake"] = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue