mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
getBuildLog: factor out resolving derivations
This commit is contained in:
parent
3b27181ee5
commit
e5eb05c599
7 changed files with 16 additions and 19 deletions
|
@ -502,14 +502,9 @@ void BinaryCacheStore::addSignatures(const StorePath & storePath, const StringSe
|
||||||
writeNarInfo(narInfo);
|
writeNarInfo(narInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> BinaryCacheStore::getBuildLog(const StorePath & path)
|
std::optional<std::string> BinaryCacheStore::getBuildLogExact(const StorePath & path)
|
||||||
{
|
{
|
||||||
auto maybePath = getBuildDerivationPath(path);
|
auto logPath = "log/" + std::string(baseNameOf(printStorePath(path)));
|
||||||
if (!maybePath)
|
|
||||||
return std::nullopt;
|
|
||||||
auto drvPath = maybePath.value();
|
|
||||||
|
|
||||||
auto logPath = "log/" + std::string(baseNameOf(printStorePath(drvPath)));
|
|
||||||
|
|
||||||
debug("fetching build log from binary cache '%s/%s'", getUri(), logPath);
|
debug("fetching build log from binary cache '%s/%s'", getUri(), logPath);
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ public:
|
||||||
|
|
||||||
void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
|
void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
|
||||||
|
|
||||||
std::optional<std::string> getBuildLog(const StorePath & path) override;
|
std::optional<std::string> getBuildLogExact(const StorePath & path) override;
|
||||||
|
|
||||||
void addBuildLog(const StorePath & drvPath, std::string_view log) override;
|
void addBuildLog(const StorePath & drvPath, std::string_view log) override;
|
||||||
|
|
||||||
|
|
|
@ -1460,7 +1460,7 @@ struct RestrictedStore : public virtual RestrictedStoreConfig, public virtual Lo
|
||||||
unknown, downloadSize, narSize);
|
unknown, downloadSize, narSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::optional<std::string> getBuildLog(const StorePath & path) override
|
virtual std::optional<std::string> getBuildLogExact(const StorePath & path) override
|
||||||
{ return std::nullopt; }
|
{ return std::nullopt; }
|
||||||
|
|
||||||
virtual void addBuildLog(const StorePath & path, std::string_view log) override
|
virtual void addBuildLog(const StorePath & path, std::string_view log) override
|
||||||
|
|
|
@ -87,13 +87,8 @@ void LocalFSStore::narFromPath(const StorePath & path, Sink & sink)
|
||||||
|
|
||||||
const std::string LocalFSStore::drvsLogDir = "drvs";
|
const std::string LocalFSStore::drvsLogDir = "drvs";
|
||||||
|
|
||||||
std::optional<std::string> LocalFSStore::getBuildLog(const StorePath & path_)
|
std::optional<std::string> LocalFSStore::getBuildLogExact(const StorePath & path)
|
||||||
{
|
{
|
||||||
auto maybePath = getBuildDerivationPath(path_);
|
|
||||||
if (!maybePath)
|
|
||||||
return std::nullopt;
|
|
||||||
auto path = maybePath.value();
|
|
||||||
|
|
||||||
auto baseName = path.to_string();
|
auto baseName = path.to_string();
|
||||||
|
|
||||||
for (int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
return getRealStoreDir() + "/" + std::string(storePath, storeDir.size() + 1);
|
return getRealStoreDir() + "/" + std::string(storePath, storeDir.size() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> getBuildLog(const StorePath & path) override;
|
std::optional<std::string> getBuildLogExact(const StorePath & path) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,14 @@ struct LogStore : public virtual Store
|
||||||
|
|
||||||
/* Return the build log of the specified store path, if available,
|
/* Return the build log of the specified store path, if available,
|
||||||
or null otherwise. */
|
or null otherwise. */
|
||||||
virtual std::optional<std::string> getBuildLog(const StorePath & path) = 0;
|
std::optional<std::string> getBuildLog(const StorePath & path) {
|
||||||
|
auto maybePath = getBuildDerivationPath(path);
|
||||||
|
if (!maybePath)
|
||||||
|
return std::nullopt;
|
||||||
|
return getBuildLogExact(maybePath.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::optional<std::string> getBuildLogExact(const StorePath & path) = 0;
|
||||||
|
|
||||||
virtual void addBuildLog(const StorePath & path, std::string_view log) = 0;
|
virtual void addBuildLog(const StorePath & path, std::string_view log) = 0;
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ public:
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
// FIXME extend daemon protocol, move implementation to RemoteStore
|
// FIXME extend daemon protocol, move implementation to RemoteStore
|
||||||
std::optional<std::string> getBuildLog(const StorePath & path) override
|
std::optional<std::string> getBuildLogExact(const StorePath & path) override
|
||||||
{ unsupported("getBuildLog"); }
|
{ unsupported("getBuildLogExact"); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue