mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-28 08:36:15 +02:00
Remove Input::computeStorePath()
This commit is contained in:
parent
4f8f52ae58
commit
c0555c8e1f
4 changed files with 0 additions and 35 deletions
|
@ -41,11 +41,6 @@ LockedNode::LockedNode(const nlohmann::json & json)
|
||||||
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
StorePath LockedNode::computeStorePath(Store & store) const
|
|
||||||
{
|
|
||||||
return lockedRef.input.computeStorePath(store);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Node> LockFile::findInput(const InputPath & path)
|
std::shared_ptr<Node> LockFile::findInput(const InputPath & path)
|
||||||
{
|
{
|
||||||
auto pos = root;
|
auto pos = root;
|
||||||
|
|
|
@ -46,8 +46,6 @@ struct LockedNode : Node
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
LockedNode(const nlohmann::json & json);
|
LockedNode(const nlohmann::json & json);
|
||||||
|
|
||||||
StorePath computeStorePath(Store & store) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LockFile
|
struct LockFile
|
||||||
|
|
|
@ -117,24 +117,6 @@ std::pair<StorePath, Input> Input::fetch(ref<Store> store) const
|
||||||
if (!scheme)
|
if (!scheme)
|
||||||
throw Error("cannot fetch unsupported input '%s'", attrsToJSON(toAttrs()));
|
throw Error("cannot fetch unsupported input '%s'", attrsToJSON(toAttrs()));
|
||||||
|
|
||||||
/* The tree may already be in the Nix store, or it could be
|
|
||||||
substituted (which is often faster than fetching from the
|
|
||||||
original source). So check that. */
|
|
||||||
if (hasAllInfo()) {
|
|
||||||
try {
|
|
||||||
auto storePath = computeStorePath(*store);
|
|
||||||
|
|
||||||
store->ensurePath(storePath);
|
|
||||||
|
|
||||||
debug("using substituted/cached input '%s' in '%s'",
|
|
||||||
to_string(), store->printStorePath(storePath));
|
|
||||||
|
|
||||||
return {std::move(storePath), *this};
|
|
||||||
} catch (Error & e) {
|
|
||||||
debug("substitution of input '%s' failed: %s", to_string(), e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto [storePath, input] = [&]() -> std::pair<StorePath, Input> {
|
auto [storePath, input] = [&]() -> std::pair<StorePath, Input> {
|
||||||
try {
|
try {
|
||||||
return scheme->fetch(store, *this);
|
return scheme->fetch(store, *this);
|
||||||
|
@ -223,14 +205,6 @@ std::string Input::getName() const
|
||||||
return maybeGetStrAttr(attrs, "name").value_or("source");
|
return maybeGetStrAttr(attrs, "name").value_or("source");
|
||||||
}
|
}
|
||||||
|
|
||||||
StorePath Input::computeStorePath(Store & store) const
|
|
||||||
{
|
|
||||||
auto narHash = getNarHash();
|
|
||||||
if (!narHash)
|
|
||||||
throw Error("cannot compute store path for unlocked input '%s'", to_string());
|
|
||||||
return store.makeFixedOutputPath(FileIngestionMethod::Recursive, *narHash, getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Input::getType() const
|
std::string Input::getType() const
|
||||||
{
|
{
|
||||||
return getStrAttr(attrs, "type");
|
return getStrAttr(attrs, "type");
|
||||||
|
|
|
@ -85,8 +85,6 @@ public:
|
||||||
|
|
||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
|
|
||||||
StorePath computeStorePath(Store & store) const;
|
|
||||||
|
|
||||||
// Convenience functions for common attributes.
|
// Convenience functions for common attributes.
|
||||||
std::string getType() const;
|
std::string getType() const;
|
||||||
std::optional<Hash> getNarHash() const;
|
std::optional<Hash> getNarHash() const;
|
||||||
|
|
Loading…
Reference in a new issue