mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Rename Buildable
This commit is contained in:
parent
9dfb97c987
commit
9b805d36ac
35 changed files with 165 additions and 162 deletions
|
|
@ -73,7 +73,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath,
|
|||
state = &DerivationGoal::getDerivation;
|
||||
name = fmt(
|
||||
"building of '%s' from .drv file",
|
||||
BuildableReqFromDrv { drvPath, wantedOutputs }.to_string(worker.store));
|
||||
DerivedPath::Built { drvPath, wantedOutputs }.to_string(worker.store));
|
||||
trace("created");
|
||||
|
||||
mcExpectedBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.expectedBuilds);
|
||||
|
|
@ -94,7 +94,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath, const BasicDerivation
|
|||
state = &DerivationGoal::haveDerivation;
|
||||
name = fmt(
|
||||
"building of '%s' from in-memory derivation",
|
||||
BuildableReqFromDrv { drvPath, drv.outputNames() }.to_string(worker.store));
|
||||
DerivedPath::Built { drvPath, drv.outputNames() }.to_string(worker.store));
|
||||
trace("created");
|
||||
|
||||
mcExpectedBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.expectedBuilds);
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
void Store::buildPaths(const std::vector<BuildableReq> & reqs, BuildMode buildMode)
|
||||
void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMode)
|
||||
{
|
||||
Worker worker(*this);
|
||||
|
||||
Goals goals;
|
||||
for (auto & br : reqs) {
|
||||
std::visit(overloaded {
|
||||
[&](BuildableReqFromDrv bfd) {
|
||||
[&](DerivedPath::Built bfd) {
|
||||
goals.insert(worker.makeDerivationGoal(bfd.drvPath, bfd.outputs, buildMode));
|
||||
},
|
||||
[&](BuildableOpaque bo) {
|
||||
[&](DerivedPath::Opaque bo) {
|
||||
goals.insert(worker.makePathSubstitutionGoal(bo.path, buildMode == bmRepair ? Repair : NoRepair));
|
||||
},
|
||||
}, br.raw());
|
||||
|
|
|
|||
|
|
@ -1191,20 +1191,20 @@ void LocalDerivationGoal::writeStructuredAttrs()
|
|||
}
|
||||
|
||||
|
||||
static StorePath pathPartOfReq(const BuildableReq & req)
|
||||
static StorePath pathPartOfReq(const DerivedPath & req)
|
||||
{
|
||||
return std::visit(overloaded {
|
||||
[&](BuildableOpaque bo) {
|
||||
[&](DerivedPath::Opaque bo) {
|
||||
return bo.path;
|
||||
},
|
||||
[&](BuildableReqFromDrv bfd) {
|
||||
[&](DerivedPath::Built bfd) {
|
||||
return bfd.drvPath;
|
||||
},
|
||||
}, req.raw());
|
||||
}
|
||||
|
||||
|
||||
bool LocalDerivationGoal::isAllowed(const BuildableReq & req)
|
||||
bool LocalDerivationGoal::isAllowed(const DerivedPath & req)
|
||||
{
|
||||
return this->isAllowed(pathPartOfReq(req));
|
||||
}
|
||||
|
|
@ -1332,7 +1332,7 @@ struct RestrictedStore : public virtual RestrictedStoreConfig, public virtual Lo
|
|||
// an allowed derivation
|
||||
{ throw Error("queryRealisation"); }
|
||||
|
||||
void buildPaths(const std::vector<BuildableReq> & paths, BuildMode buildMode) override
|
||||
void buildPaths(const std::vector<DerivedPath> & paths, BuildMode buildMode) override
|
||||
{
|
||||
if (buildMode != bmNormal) throw Error("unsupported build mode");
|
||||
|
||||
|
|
@ -1346,7 +1346,7 @@ struct RestrictedStore : public virtual RestrictedStoreConfig, public virtual Lo
|
|||
next->buildPaths(paths, buildMode);
|
||||
|
||||
for (auto & path : paths) {
|
||||
auto p = std::get_if<BuildableReqFromDrv>(&path);
|
||||
auto p = std::get_if<DerivedPath::Built>(&path);
|
||||
if (!p) continue;
|
||||
auto & bfd = *p;
|
||||
auto outputs = next->queryDerivationOutputMap(bfd.drvPath);
|
||||
|
|
@ -1380,7 +1380,7 @@ struct RestrictedStore : public virtual RestrictedStoreConfig, public virtual Lo
|
|||
void addSignatures(const StorePath & storePath, const StringSet & sigs) override
|
||||
{ unsupported("addSignatures"); }
|
||||
|
||||
void queryMissing(const std::vector<BuildableReq> & targets,
|
||||
void queryMissing(const std::vector<DerivedPath> & targets,
|
||||
StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
|
||||
uint64_t & downloadSize, uint64_t & narSize) override
|
||||
{
|
||||
|
|
@ -1388,7 +1388,7 @@ struct RestrictedStore : public virtual RestrictedStoreConfig, public virtual Lo
|
|||
client about what paths will be built/substituted or are
|
||||
already present. Probably not a big deal. */
|
||||
|
||||
std::vector<BuildableReq> allowed;
|
||||
std::vector<DerivedPath> allowed;
|
||||
for (auto & req : targets) {
|
||||
if (goal.isAllowed(req))
|
||||
allowed.emplace_back(req);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ struct LocalDerivationGoal : public DerivationGoal
|
|||
{
|
||||
return inputPaths.count(path) || addedPaths.count(path);
|
||||
}
|
||||
bool isAllowed(const BuildableReq & req);
|
||||
bool isAllowed(const DerivedPath & req);
|
||||
|
||||
friend struct RestrictedStore;
|
||||
|
||||
|
|
|
|||
|
|
@ -226,14 +226,14 @@ void Worker::waitForAWhile(GoalPtr goal)
|
|||
|
||||
void Worker::run(const Goals & _topGoals)
|
||||
{
|
||||
std::vector<nix::BuildableReq> topPaths;
|
||||
std::vector<nix::DerivedPath> topPaths;
|
||||
|
||||
for (auto & i : _topGoals) {
|
||||
topGoals.insert(i);
|
||||
if (auto goal = dynamic_cast<DerivationGoal *>(i.get())) {
|
||||
topPaths.push_back(BuildableReqFromDrv{goal->drvPath, goal->wantedOutputs});
|
||||
topPaths.push_back(DerivedPath::Built{goal->drvPath, goal->wantedOutputs});
|
||||
} else if (auto goal = dynamic_cast<PathSubstitutionGoal *>(i.get())) {
|
||||
topPaths.push_back(BuildableOpaque{goal->storePath});
|
||||
topPaths.push_back(DerivedPath::Opaque{goal->storePath});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
nlohmann::json BuildableOpaque::toJSON(ref<Store> store) const {
|
||||
nlohmann::json DerivedPath::Opaque::toJSON(ref<Store> store) const {
|
||||
nlohmann::json res;
|
||||
res["path"] = store->printStorePath(path);
|
||||
return res;
|
||||
}
|
||||
|
||||
nlohmann::json BuildableFromDrv::toJSON(ref<Store> store) const {
|
||||
nlohmann::json DerivedPathWithHintsBuilt::toJSON(ref<Store> store) const {
|
||||
nlohmann::json res;
|
||||
res["drvPath"] = store->printStorePath(drvPath);
|
||||
for (const auto& [output, path] : outputs) {
|
||||
|
|
@ -20,9 +20,9 @@ nlohmann::json BuildableFromDrv::toJSON(ref<Store> store) const {
|
|||
return res;
|
||||
}
|
||||
|
||||
nlohmann::json buildablesToJSON(const Buildables & buildables, ref<Store> store) {
|
||||
nlohmann::json derivedPathsWithHintsToJSON(const DerivedPathsWithHints & buildables, ref<Store> store) {
|
||||
auto res = nlohmann::json::array();
|
||||
for (const Buildable & buildable : buildables) {
|
||||
for (const DerivedPathWithHints & buildable : buildables) {
|
||||
std::visit([&res, store](const auto & buildable) {
|
||||
res.push_back(buildable.toJSON(store));
|
||||
}, buildable);
|
||||
|
|
@ -31,17 +31,17 @@ nlohmann::json buildablesToJSON(const Buildables & buildables, ref<Store> store)
|
|||
}
|
||||
|
||||
|
||||
std::string BuildableOpaque::to_string(const Store & store) const {
|
||||
std::string DerivedPath::Opaque::to_string(const Store & store) const {
|
||||
return store.printStorePath(path);
|
||||
}
|
||||
|
||||
std::string BuildableReqFromDrv::to_string(const Store & store) const {
|
||||
std::string DerivedPath::Built::to_string(const Store & store) const {
|
||||
return store.printStorePath(drvPath)
|
||||
+ "!"
|
||||
+ (outputs.empty() ? std::string { "*" } : concatStringsSep(",", outputs));
|
||||
}
|
||||
|
||||
std::string BuildableReq::to_string(const Store & store) const
|
||||
std::string DerivedPath::to_string(const Store & store) const
|
||||
{
|
||||
return std::visit(
|
||||
[&](const auto & req) { return req.to_string(store); },
|
||||
|
|
@ -49,12 +49,12 @@ std::string BuildableReq::to_string(const Store & store) const
|
|||
}
|
||||
|
||||
|
||||
BuildableOpaque BuildableOpaque::parse(const Store & store, std::string_view s)
|
||||
DerivedPath::Opaque DerivedPath::Opaque::parse(const Store & store, std::string_view s)
|
||||
{
|
||||
return {store.parseStorePath(s)};
|
||||
}
|
||||
|
||||
BuildableReqFromDrv BuildableReqFromDrv::parse(const Store & store, std::string_view s)
|
||||
DerivedPath::Built DerivedPath::Built::parse(const Store & store, std::string_view s)
|
||||
{
|
||||
size_t n = s.find("!");
|
||||
assert(n != s.npos);
|
||||
|
|
@ -66,12 +66,12 @@ BuildableReqFromDrv BuildableReqFromDrv::parse(const Store & store, std::string_
|
|||
return {drvPath, outputs};
|
||||
}
|
||||
|
||||
BuildableReq BuildableReq::parse(const Store & store, std::string_view s)
|
||||
DerivedPath DerivedPath::parse(const Store & store, std::string_view s)
|
||||
{
|
||||
size_t n = s.find("!");
|
||||
return n == s.npos
|
||||
? (BuildableReq) BuildableOpaque::parse(store, s)
|
||||
: (BuildableReq) BuildableReqFromDrv::parse(store, s);
|
||||
? (DerivedPath) DerivedPath::Opaque::parse(store, s)
|
||||
: (DerivedPath) DerivedPath::Built::parse(store, s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,54 +12,57 @@ namespace nix {
|
|||
|
||||
class Store;
|
||||
|
||||
struct BuildableOpaque {
|
||||
struct DerivedPathOpaque {
|
||||
StorePath path;
|
||||
|
||||
nlohmann::json toJSON(ref<Store> store) const;
|
||||
std::string to_string(const Store & store) const;
|
||||
static BuildableOpaque parse(const Store & store, std::string_view);
|
||||
static DerivedPathOpaque parse(const Store & store, std::string_view);
|
||||
};
|
||||
|
||||
struct BuildableReqFromDrv {
|
||||
struct DerivedPathBuilt {
|
||||
StorePath drvPath;
|
||||
std::set<std::string> outputs;
|
||||
|
||||
std::string to_string(const Store & store) const;
|
||||
static BuildableReqFromDrv parse(const Store & store, std::string_view);
|
||||
static DerivedPathBuilt parse(const Store & store, std::string_view);
|
||||
};
|
||||
|
||||
using _BuildableReqRaw = std::variant<
|
||||
BuildableOpaque,
|
||||
BuildableReqFromDrv
|
||||
using _DerivedPathRaw = std::variant<
|
||||
DerivedPathOpaque,
|
||||
DerivedPathBuilt
|
||||
>;
|
||||
|
||||
struct BuildableReq : _BuildableReqRaw {
|
||||
using Raw = _BuildableReqRaw;
|
||||
struct DerivedPath : _DerivedPathRaw {
|
||||
using Raw = _DerivedPathRaw;
|
||||
using Raw::Raw;
|
||||
|
||||
using Opaque = DerivedPathOpaque;
|
||||
using Built = DerivedPathBuilt;
|
||||
|
||||
inline const Raw & raw() const {
|
||||
return static_cast<const Raw &>(*this);
|
||||
}
|
||||
|
||||
std::string to_string(const Store & store) const;
|
||||
static BuildableReq parse(const Store & store, std::string_view);
|
||||
static DerivedPath parse(const Store & store, std::string_view);
|
||||
};
|
||||
|
||||
struct BuildableFromDrv {
|
||||
struct DerivedPathWithHintsBuilt {
|
||||
StorePath drvPath;
|
||||
std::map<std::string, std::optional<StorePath>> outputs;
|
||||
|
||||
nlohmann::json toJSON(ref<Store> store) const;
|
||||
static BuildableFromDrv parse(const Store & store, std::string_view);
|
||||
static DerivedPathWithHintsBuilt parse(const Store & store, std::string_view);
|
||||
};
|
||||
|
||||
using Buildable = std::variant<
|
||||
BuildableOpaque,
|
||||
BuildableFromDrv
|
||||
using DerivedPathWithHints = std::variant<
|
||||
DerivedPath::Opaque,
|
||||
DerivedPathWithHintsBuilt
|
||||
>;
|
||||
|
||||
typedef std::vector<Buildable> Buildables;
|
||||
typedef std::vector<DerivedPathWithHints> DerivedPathsWithHints;
|
||||
|
||||
nlohmann::json buildablesToJSON(const Buildables & buildables, ref<Store> store);
|
||||
nlohmann::json derivedPathsWithHintsToJSON(const DerivedPathsWithHints & buildables, ref<Store> store);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,14 +260,14 @@ static void writeValidPathInfo(
|
|||
}
|
||||
}
|
||||
|
||||
static std::vector<BuildableReq> readBuildableReqs(Store & store, unsigned int clientVersion, Source & from)
|
||||
static std::vector<DerivedPath> readDerivedPaths(Store & store, unsigned int clientVersion, Source & from)
|
||||
{
|
||||
std::vector<BuildableReq> reqs;
|
||||
std::vector<DerivedPath> reqs;
|
||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 29) {
|
||||
reqs = worker_proto::read(store, from, Phantom<std::vector<BuildableReq>> {});
|
||||
reqs = worker_proto::read(store, from, Phantom<std::vector<DerivedPath>> {});
|
||||
} else {
|
||||
for (auto & s : readStrings<Strings>(from))
|
||||
reqs.push_back(parsePathWithOutputs(store, s).toBuildableReq());
|
||||
reqs.push_back(parsePathWithOutputs(store, s).toDerivedPath());
|
||||
}
|
||||
return reqs;
|
||||
}
|
||||
|
|
@ -506,7 +506,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
|||
}
|
||||
|
||||
case wopBuildPaths: {
|
||||
auto drvs = readBuildableReqs(*store, clientVersion, from);
|
||||
auto drvs = readDerivedPaths(*store, clientVersion, from);
|
||||
BuildMode mode = bmNormal;
|
||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 15) {
|
||||
mode = (BuildMode) readInt(from);
|
||||
|
|
@ -870,7 +870,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
|||
}
|
||||
|
||||
case wopQueryMissing: {
|
||||
auto targets = readBuildableReqs(*store, clientVersion, from);
|
||||
auto targets = readDerivedPaths(*store, clientVersion, from);
|
||||
logger->startWork();
|
||||
StorePathSet willBuild, willSubstitute, unknown;
|
||||
uint64_t downloadSize, narSize;
|
||||
|
|
|
|||
|
|
@ -267,14 +267,14 @@ public:
|
|||
return status;
|
||||
}
|
||||
|
||||
void buildPaths(const std::vector<BuildableReq> & drvPaths, BuildMode buildMode) override
|
||||
void buildPaths(const std::vector<DerivedPath> & drvPaths, BuildMode buildMode) override
|
||||
{
|
||||
auto conn(connections->get());
|
||||
|
||||
conn->to << cmdBuildPaths;
|
||||
Strings ss;
|
||||
for (auto & p : drvPaths) {
|
||||
auto sOrDrvPath = StorePathWithOutputs::tryFromBuildableReq(p);
|
||||
auto sOrDrvPath = StorePathWithOutputs::tryFromDerivedPath(p);
|
||||
std::visit(overloaded {
|
||||
[&](StorePathWithOutputs s) {
|
||||
ss.push_back(s.to_string(*this));
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ std::optional<ContentAddress> getDerivationCA(const BasicDerivation & drv)
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
||||
void Store::queryMissing(const std::vector<DerivedPath> & targets,
|
||||
StorePathSet & willBuild_, StorePathSet & willSubstitute_, StorePathSet & unknown_,
|
||||
uint64_t & downloadSize_, uint64_t & narSize_)
|
||||
{
|
||||
|
|
@ -145,7 +145,7 @@ void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
|
||||
Sync<State> state_(State{{}, unknown_, willSubstitute_, willBuild_, downloadSize_, narSize_});
|
||||
|
||||
std::function<void(BuildableReq)> doPath;
|
||||
std::function<void(DerivedPath)> doPath;
|
||||
|
||||
auto mustBuildDrv = [&](const StorePath & drvPath, const Derivation & drv) {
|
||||
{
|
||||
|
|
@ -154,7 +154,7 @@ void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
}
|
||||
|
||||
for (auto & i : drv.inputDrvs)
|
||||
pool.enqueue(std::bind(doPath, BuildableReqFromDrv { i.first, i.second }));
|
||||
pool.enqueue(std::bind(doPath, DerivedPath::Built { i.first, i.second }));
|
||||
};
|
||||
|
||||
auto checkOutput = [&](
|
||||
|
|
@ -177,13 +177,13 @@ void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
drvState->outPaths.insert(outPath);
|
||||
if (!drvState->left) {
|
||||
for (auto & path : drvState->outPaths)
|
||||
pool.enqueue(std::bind(doPath, BuildableOpaque { path } ));
|
||||
pool.enqueue(std::bind(doPath, DerivedPath::Opaque { path } ));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
doPath = [&](const BuildableReq & req) {
|
||||
doPath = [&](const DerivedPath & req) {
|
||||
|
||||
{
|
||||
auto state(state_.lock());
|
||||
|
|
@ -191,7 +191,7 @@ void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
}
|
||||
|
||||
std::visit(overloaded {
|
||||
[&](BuildableReqFromDrv bfd) {
|
||||
[&](DerivedPath::Built bfd) {
|
||||
if (!isValidPath(bfd.drvPath)) {
|
||||
// FIXME: we could try to substitute the derivation.
|
||||
auto state(state_.lock());
|
||||
|
|
@ -224,7 +224,7 @@ void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
mustBuildDrv(bfd.drvPath, *drv);
|
||||
|
||||
},
|
||||
[&](BuildableOpaque bo) {
|
||||
[&](DerivedPath::Opaque bo) {
|
||||
|
||||
if (isValidPath(bo.path)) return;
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ void Store::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
}
|
||||
|
||||
for (auto & ref : info->second.references)
|
||||
pool.enqueue(std::bind(doPath, BuildableOpaque { ref }));
|
||||
pool.enqueue(std::bind(doPath, DerivedPath::Opaque { ref }));
|
||||
},
|
||||
}, req.raw());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,34 +11,34 @@ std::string StorePathWithOutputs::to_string(const Store & store) const
|
|||
}
|
||||
|
||||
|
||||
BuildableReq StorePathWithOutputs::toBuildableReq() const
|
||||
DerivedPath StorePathWithOutputs::toDerivedPath() const
|
||||
{
|
||||
if (!outputs.empty() || path.isDerivation())
|
||||
return BuildableReqFromDrv { path, outputs };
|
||||
return DerivedPath::Built { path, outputs };
|
||||
else
|
||||
return BuildableOpaque { path };
|
||||
return DerivedPath::Opaque { path };
|
||||
}
|
||||
|
||||
|
||||
std::vector<BuildableReq> toBuildableReqs(const std::vector<StorePathWithOutputs> ss)
|
||||
std::vector<DerivedPath> toDerivedPaths(const std::vector<StorePathWithOutputs> ss)
|
||||
{
|
||||
std::vector<BuildableReq> reqs;
|
||||
for (auto & s : ss) reqs.push_back(s.toBuildableReq());
|
||||
std::vector<DerivedPath> reqs;
|
||||
for (auto & s : ss) reqs.push_back(s.toDerivedPath());
|
||||
return reqs;
|
||||
}
|
||||
|
||||
|
||||
std::variant<StorePathWithOutputs, StorePath> StorePathWithOutputs::tryFromBuildableReq(const BuildableReq & p)
|
||||
std::variant<StorePathWithOutputs, StorePath> StorePathWithOutputs::tryFromDerivedPath(const DerivedPath & p)
|
||||
{
|
||||
return std::visit(overloaded {
|
||||
[&](BuildableOpaque bo) -> std::variant<StorePathWithOutputs, StorePath> {
|
||||
[&](DerivedPath::Opaque bo) -> std::variant<StorePathWithOutputs, StorePath> {
|
||||
if (bo.path.isDerivation()) {
|
||||
// drv path gets interpreted as "build", not "get drv file itself"
|
||||
return bo.path;
|
||||
}
|
||||
return StorePathWithOutputs { bo.path };
|
||||
},
|
||||
[&](BuildableReqFromDrv bfd) -> std::variant<StorePathWithOutputs, StorePath> {
|
||||
[&](DerivedPath::Built bfd) -> std::variant<StorePathWithOutputs, StorePath> {
|
||||
return StorePathWithOutputs { bfd.drvPath, bfd.outputs };
|
||||
},
|
||||
}, p.raw());
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ struct StorePathWithOutputs
|
|||
|
||||
std::string to_string(const Store & store) const;
|
||||
|
||||
BuildableReq toBuildableReq() const;
|
||||
DerivedPath toDerivedPath() const;
|
||||
|
||||
static std::variant<StorePathWithOutputs, StorePath> tryFromBuildableReq(const BuildableReq &);
|
||||
static std::variant<StorePathWithOutputs, StorePath> tryFromDerivedPath(const DerivedPath &);
|
||||
};
|
||||
|
||||
std::vector<BuildableReq> toBuildableReqs(const std::vector<StorePathWithOutputs>);
|
||||
std::vector<DerivedPath> toDerivedPaths(const std::vector<StorePathWithOutputs>);
|
||||
|
||||
std::pair<std::string_view, StringSet> parsePathWithOutputs(std::string_view s);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ void write(const Store & store, Sink & out, const ContentAddress & ca)
|
|||
}
|
||||
|
||||
|
||||
BuildableReq read(const Store & store, Source & from, Phantom<BuildableReq> _)
|
||||
DerivedPath read(const Store & store, Source & from, Phantom<DerivedPath> _)
|
||||
{
|
||||
auto s = readString(from);
|
||||
return BuildableReq::parse(store, s);
|
||||
return DerivedPath::parse(store, s);
|
||||
}
|
||||
|
||||
void write(const Store & store, Sink & out, const BuildableReq & req)
|
||||
void write(const Store & store, Sink & out, const DerivedPath & req)
|
||||
{
|
||||
out << req.to_string(store);
|
||||
}
|
||||
|
|
@ -670,14 +670,14 @@ std::optional<const Realisation> RemoteStore::queryRealisation(const DrvOutput &
|
|||
return {Realisation{.id = id, .outPath = *outPaths.begin()}};
|
||||
}
|
||||
|
||||
static void writeBuildableReqs(RemoteStore & store, ConnectionHandle & conn, const std::vector<BuildableReq> & reqs)
|
||||
static void writeDerivedPaths(RemoteStore & store, ConnectionHandle & conn, const std::vector<DerivedPath> & reqs)
|
||||
{
|
||||
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 29) {
|
||||
worker_proto::write(store, conn->to, reqs);
|
||||
} else {
|
||||
Strings ss;
|
||||
for (auto & p : reqs) {
|
||||
auto sOrDrvPath = StorePathWithOutputs::tryFromBuildableReq(p);
|
||||
auto sOrDrvPath = StorePathWithOutputs::tryFromDerivedPath(p);
|
||||
std::visit(overloaded {
|
||||
[&](StorePathWithOutputs s) {
|
||||
ss.push_back(s.to_string(store));
|
||||
|
|
@ -694,12 +694,12 @@ static void writeBuildableReqs(RemoteStore & store, ConnectionHandle & conn, con
|
|||
}
|
||||
}
|
||||
|
||||
void RemoteStore::buildPaths(const std::vector<BuildableReq> & drvPaths, BuildMode buildMode)
|
||||
void RemoteStore::buildPaths(const std::vector<DerivedPath> & drvPaths, BuildMode buildMode)
|
||||
{
|
||||
auto conn(getConnection());
|
||||
conn->to << wopBuildPaths;
|
||||
assert(GET_PROTOCOL_MINOR(conn->daemonVersion) >= 13);
|
||||
writeBuildableReqs(*this, conn, drvPaths);
|
||||
writeDerivedPaths(*this, conn, drvPaths);
|
||||
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 15)
|
||||
conn->to << buildMode;
|
||||
else
|
||||
|
|
@ -838,7 +838,7 @@ void RemoteStore::addSignatures(const StorePath & storePath, const StringSet & s
|
|||
}
|
||||
|
||||
|
||||
void RemoteStore::queryMissing(const std::vector<BuildableReq> & targets,
|
||||
void RemoteStore::queryMissing(const std::vector<DerivedPath> & targets,
|
||||
StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
|
||||
uint64_t & downloadSize, uint64_t & narSize)
|
||||
{
|
||||
|
|
@ -849,7 +849,7 @@ void RemoteStore::queryMissing(const std::vector<BuildableReq> & targets,
|
|||
// to prevent a deadlock.
|
||||
goto fallback;
|
||||
conn->to << wopQueryMissing;
|
||||
writeBuildableReqs(*this, conn, targets);
|
||||
writeDerivedPaths(*this, conn, targets);
|
||||
conn.processStderr();
|
||||
willBuild = worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
|
||||
willSubstitute = worker_proto::read(*this, conn->from, Phantom<StorePathSet> {});
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
std::optional<const Realisation> queryRealisation(const DrvOutput &) override;
|
||||
|
||||
void buildPaths(const std::vector<BuildableReq> & paths, BuildMode buildMode) override;
|
||||
void buildPaths(const std::vector<DerivedPath> & paths, BuildMode buildMode) override;
|
||||
|
||||
BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
|
||||
BuildMode buildMode) override;
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
void addSignatures(const StorePath & storePath, const StringSet & sigs) override;
|
||||
|
||||
void queryMissing(const std::vector<BuildableReq> & targets,
|
||||
void queryMissing(const std::vector<DerivedPath> & targets,
|
||||
StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
|
||||
uint64_t & downloadSize, uint64_t & narSize) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -529,10 +529,10 @@ void Store::queryPathInfo(const StorePath & storePath,
|
|||
|
||||
void Store::substitutePaths(const StorePathSet & paths)
|
||||
{
|
||||
std::vector<BuildableReq> paths2;
|
||||
std::vector<DerivedPath> paths2;
|
||||
for (auto & path : paths)
|
||||
if (!path.isDerivation())
|
||||
paths2.push_back(BuildableOpaque{path});
|
||||
paths2.push_back(DerivedPath::Opaque{path});
|
||||
uint64_t downloadSize, narSize;
|
||||
StorePathSet willBuild, willSubstitute, unknown;
|
||||
queryMissing(paths2,
|
||||
|
|
@ -540,8 +540,8 @@ void Store::substitutePaths(const StorePathSet & paths)
|
|||
|
||||
if (!willSubstitute.empty())
|
||||
try {
|
||||
std::vector<BuildableReq> subs;
|
||||
for (auto & p : willSubstitute) subs.push_back(BuildableOpaque{p});
|
||||
std::vector<DerivedPath> subs;
|
||||
for (auto & p : willSubstitute) subs.push_back(DerivedPath::Opaque{p});
|
||||
buildPaths(subs);
|
||||
} catch (Error & e) {
|
||||
logWarning(e.info());
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ public:
|
|||
recursively building any sub-derivations. For inputs that are
|
||||
not derivations, substitute them. */
|
||||
virtual void buildPaths(
|
||||
const std::vector<BuildableReq> & paths,
|
||||
const std::vector<DerivedPath> & paths,
|
||||
BuildMode buildMode = bmNormal);
|
||||
|
||||
/* Build a single non-materialized derivation (i.e. not from an
|
||||
|
|
@ -656,7 +656,7 @@ public:
|
|||
/* Given a set of paths that are to be built, return the set of
|
||||
derivations that will be built, and the set of output paths
|
||||
that will be substituted. */
|
||||
virtual void queryMissing(const std::vector<BuildableReq> & targets,
|
||||
virtual void queryMissing(const std::vector<DerivedPath> & targets,
|
||||
StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
|
||||
uint64_t & downloadSize, uint64_t & narSize);
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace worker_proto {
|
|||
MAKE_WORKER_PROTO(, std::string);
|
||||
MAKE_WORKER_PROTO(, StorePath);
|
||||
MAKE_WORKER_PROTO(, ContentAddress);
|
||||
MAKE_WORKER_PROTO(, BuildableReq);
|
||||
MAKE_WORKER_PROTO(, DerivedPath);
|
||||
MAKE_WORKER_PROTO(, Realisation);
|
||||
MAKE_WORKER_PROTO(, DrvOutput);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue