std::string_view for new derivation name parameters
This commit is contained in:
parent
13ec627e0a
commit
5d0b75e5b6
|
@ -12,7 +12,7 @@ namespace nix {
|
||||||
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
||||||
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||||
|
|
||||||
StorePath DerivationOutput::path(const Store & store, string drvName) const
|
StorePath DerivationOutput::path(const Store & store, std::string_view drvName) const
|
||||||
{
|
{
|
||||||
return std::visit(overloaded {
|
return std::visit(overloaded {
|
||||||
[](DerivationOutputExtensional doi) {
|
[](DerivationOutputExtensional doi) {
|
||||||
|
@ -149,7 +149,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Derivation parseDerivation(const Store & store, const string & s, string name)
|
static Derivation parseDerivation(const Store & store, const string & s, std::string_view name)
|
||||||
{
|
{
|
||||||
Derivation drv;
|
Derivation drv;
|
||||||
drv.name = name;
|
drv.name = name;
|
||||||
|
@ -197,7 +197,7 @@ static Derivation parseDerivation(const Store & store, const string & s, string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Derivation readDerivation(const Store & store, const Path & drvPath, std::string name)
|
Derivation readDerivation(const Store & store, const Path & drvPath, std::string_view name)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return parseDerivation(store, readFile(drvPath), name);
|
return parseDerivation(store, readFile(drvPath), name);
|
||||||
|
@ -465,7 +465,7 @@ StringSet BasicDerivation::outputNames() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv, string name)
|
Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv, std::string_view name)
|
||||||
{
|
{
|
||||||
drv.name = name;
|
drv.name = name;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct DerivationOutputFixed
|
||||||
struct DerivationOutput
|
struct DerivationOutput
|
||||||
{
|
{
|
||||||
std::variant<DerivationOutputExtensional, DerivationOutputFixed> output;
|
std::variant<DerivationOutputExtensional, DerivationOutputFixed> output;
|
||||||
StorePath path(const Store & store, string drvName) const;
|
StorePath path(const Store & store, std::string_view drvName) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<string, DerivationOutput> DerivationOutputs;
|
typedef std::map<string, DerivationOutput> DerivationOutputs;
|
||||||
|
@ -45,7 +45,7 @@ struct BasicDerivation
|
||||||
Path builder;
|
Path builder;
|
||||||
Strings args;
|
Strings args;
|
||||||
StringPairs env;
|
StringPairs env;
|
||||||
string name;
|
std::string name;
|
||||||
|
|
||||||
BasicDerivation() { }
|
BasicDerivation() { }
|
||||||
virtual ~BasicDerivation() { };
|
virtual ~BasicDerivation() { };
|
||||||
|
@ -87,7 +87,7 @@ StorePath writeDerivation(ref<Store> store,
|
||||||
const Derivation & drv, std::string_view name, RepairFlag repair = NoRepair);
|
const Derivation & drv, std::string_view name, RepairFlag repair = NoRepair);
|
||||||
|
|
||||||
/* Read a derivation from a file. */
|
/* Read a derivation from a file. */
|
||||||
Derivation readDerivation(const Store & store, const Path & drvPath, string name);
|
Derivation readDerivation(const Store & store, const Path & drvPath, std::string_view name);
|
||||||
|
|
||||||
// FIXME: remove
|
// FIXME: remove
|
||||||
bool isDerivation(const string & fileName);
|
bool isDerivation(const string & fileName);
|
||||||
|
@ -104,7 +104,7 @@ bool wantOutput(const string & output, const std::set<string> & wanted);
|
||||||
struct Source;
|
struct Source;
|
||||||
struct Sink;
|
struct Sink;
|
||||||
|
|
||||||
Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv, string name);
|
Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv, std::string_view name);
|
||||||
void writeDerivation(Sink & out, const Store & store, const BasicDerivation & drv);
|
void writeDerivation(Sink & out, const Store & store, const BasicDerivation & drv);
|
||||||
|
|
||||||
std::string hashPlaceholder(const std::string & outputName);
|
std::string hashPlaceholder(const std::string & outputName);
|
||||||
|
|
Loading…
Reference in a new issue