mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Add a dummy Store::buildPaths() method
This default implementation of buildPaths() does nothing if all
requested paths are already valid, and throws an "unsupported
operation" error otherwise. This fixes a regression introduced by
c30330df6f
in binary cache and legacy
SSH stores.
This commit is contained in:
parent
b0b81b7500
commit
0dddcf867a
5 changed files with 36 additions and 38 deletions
|
@ -114,11 +114,6 @@ void BinaryCacheStore::init()
|
|||
}
|
||||
}
|
||||
|
||||
void BinaryCacheStore::notImpl()
|
||||
{
|
||||
throw Error("operation not implemented for binary cache stores");
|
||||
}
|
||||
|
||||
std::shared_ptr<std::string> BinaryCacheStore::getFile(const std::string & path)
|
||||
{
|
||||
std::promise<std::shared_ptr<std::string>> promise;
|
||||
|
|
|
@ -27,8 +27,6 @@ protected:
|
|||
|
||||
BinaryCacheStore(const Params & params);
|
||||
|
||||
[[noreturn]] void notImpl();
|
||||
|
||||
public:
|
||||
|
||||
virtual bool fileExists(const std::string & path) = 0;
|
||||
|
@ -65,7 +63,7 @@ public:
|
|||
bool isValidPathUncached(const Path & path) override;
|
||||
|
||||
PathSet queryAllValidPaths() override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
void queryPathInfoUncached(const Path & path,
|
||||
std::function<void(std::shared_ptr<ValidPathInfo>)> success,
|
||||
|
@ -73,16 +71,16 @@ public:
|
|||
|
||||
void queryReferrers(const Path & path,
|
||||
PathSet & referrers) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
PathSet queryDerivationOutputs(const Path & path) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
StringSet queryDerivationOutputNames(const Path & path) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
Path queryPathFromHashPart(const string & hashPart) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
bool wantMassQuery() override { return wantMassQuery_; }
|
||||
|
||||
|
@ -99,32 +97,29 @@ public:
|
|||
|
||||
void narFromPath(const Path & path, Sink & sink) override;
|
||||
|
||||
void buildPaths(const PathSet & paths, BuildMode buildMode) override
|
||||
{ notImpl(); }
|
||||
|
||||
BuildResult buildDerivation(const Path & drvPath, const BasicDerivation & drv,
|
||||
BuildMode buildMode) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
void ensurePath(const Path & path) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
void addTempRoot(const Path & path) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
void addIndirectRoot(const Path & path) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
Roots findRoots() override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
void collectGarbage(const GCOptions & options, GCResults & results) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
ref<FSAccessor> getFSAccessor() override;
|
||||
|
||||
void addSignatures(const Path & storePath, const StringSet & sigs) override
|
||||
{ notImpl(); }
|
||||
{ unsupported(); }
|
||||
|
||||
std::shared_ptr<std::string> getBuildLog(const Path & path) override;
|
||||
|
||||
|
|
|
@ -148,12 +148,6 @@ struct LegacySSHStore : public Store
|
|||
sink(*savedNAR.data);
|
||||
}
|
||||
|
||||
/* Unsupported methods. */
|
||||
[[noreturn]] void unsupported()
|
||||
{
|
||||
throw Error("operation not supported on SSH stores");
|
||||
}
|
||||
|
||||
PathSet queryAllValidPaths() override { unsupported(); }
|
||||
|
||||
void queryReferrers(const Path & path, PathSet & referrers) override
|
||||
|
@ -177,9 +171,6 @@ struct LegacySSHStore : public Store
|
|||
const PathSet & references, bool repair) override
|
||||
{ unsupported(); }
|
||||
|
||||
void buildPaths(const PathSet & paths, BuildMode buildMode) override
|
||||
{ unsupported(); }
|
||||
|
||||
BuildResult buildDerivation(const Path & drvPath, const BasicDerivation & drv,
|
||||
BuildMode buildMode) override
|
||||
{ unsupported(); }
|
||||
|
|
|
@ -523,6 +523,17 @@ const Store::Stats & Store::getStats()
|
|||
}
|
||||
|
||||
|
||||
void Store::buildPaths(const PathSet & paths, BuildMode buildMode)
|
||||
{
|
||||
for (auto & path : paths)
|
||||
if (isDerivation(path))
|
||||
unsupported();
|
||||
|
||||
if (queryValidPaths(paths).size() != paths.size())
|
||||
unsupported();
|
||||
}
|
||||
|
||||
|
||||
void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
|
||||
const Path & storePath, bool repair, bool dontCheckSigs)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,12 @@
|
|||
namespace nix {
|
||||
|
||||
|
||||
MakeError(SubstError, Error)
|
||||
MakeError(BuildError, Error) /* denotes a permanent build failure */
|
||||
MakeError(InvalidPath, Error)
|
||||
MakeError(Unsupported, Error)
|
||||
|
||||
|
||||
struct BasicDerivation;
|
||||
struct Derivation;
|
||||
class FSAccessor;
|
||||
|
@ -414,7 +420,7 @@ public:
|
|||
output paths can be created by running the builder, after
|
||||
recursively building any sub-derivations. For inputs that are
|
||||
not derivations, substitute them. */
|
||||
virtual void buildPaths(const PathSet & paths, BuildMode buildMode = bmNormal) = 0;
|
||||
virtual void buildPaths(const PathSet & paths, BuildMode buildMode = bmNormal);
|
||||
|
||||
/* Build a single non-materialized derivation (i.e. not from an
|
||||
on-disk .drv file). Note that ‘drvPath’ is only used for
|
||||
|
@ -584,6 +590,12 @@ protected:
|
|||
|
||||
Stats stats;
|
||||
|
||||
/* Unsupported methods. */
|
||||
[[noreturn]] void unsupported()
|
||||
{
|
||||
throw Unsupported("requested operation is not supported by store ‘%s’", getUri());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -720,10 +732,4 @@ ValidPathInfo decodeValidPathInfo(std::istream & str,
|
|||
for paths created by makeFixedOutputPath() / addToStore(). */
|
||||
std::string makeFixedOutputCA(bool recursive, const Hash & hash);
|
||||
|
||||
|
||||
MakeError(SubstError, Error)
|
||||
MakeError(BuildError, Error) /* denotes a permanent build failure */
|
||||
MakeError(InvalidPath, Error)
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue