Remove Input::computeStorePath()

This commit is contained in:
Eelco Dolstra 2022-07-25 15:35:53 +02:00
parent 4f8f52ae58
commit c0555c8e1f
4 changed files with 0 additions and 35 deletions

View file

@ -41,11 +41,6 @@ LockedNode::LockedNode(const nlohmann::json & json)
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)
{
auto pos = root;

View file

@ -46,8 +46,6 @@ struct LockedNode : Node
{ }
LockedNode(const nlohmann::json & json);
StorePath computeStorePath(Store & store) const;
};
struct LockFile

View file

@ -117,24 +117,6 @@ std::pair<StorePath, Input> Input::fetch(ref<Store> store) const
if (!scheme)
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> {
try {
return scheme->fetch(store, *this);
@ -223,14 +205,6 @@ std::string Input::getName() const
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
{
return getStrAttr(attrs, "type");

View file

@ -85,8 +85,6 @@ public:
std::string getName() const;
StorePath computeStorePath(Store & store) const;
// Convenience functions for common attributes.
std::string getType() const;
std::optional<Hash> getNarHash() const;