forked from lix-project/lix
* Handle store path arguments in `nix-env -i' correctly again.
This commit is contained in:
parent
bfe4875a5e
commit
9ec7e58aa4
|
@ -49,6 +49,11 @@ typedef void (* Operation) (Globals & globals,
|
||||||
|
|
||||||
struct UserEnvElem
|
struct UserEnvElem
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
string drvPath;
|
||||||
|
string outPath;
|
||||||
|
|
||||||
|
public:
|
||||||
string name;
|
string name;
|
||||||
string system;
|
string system;
|
||||||
|
|
||||||
|
@ -56,15 +61,31 @@ struct UserEnvElem
|
||||||
|
|
||||||
string queryDrvPath(EvalState & state) const
|
string queryDrvPath(EvalState & state) const
|
||||||
{
|
{
|
||||||
|
if (drvPath == "") {
|
||||||
Expr a = attrs.get("drvPath");
|
Expr a = attrs.get("drvPath");
|
||||||
return a ? evalPath(state, a) : "";
|
(string &) drvPath = a ? evalPath(state, a) : "";
|
||||||
|
}
|
||||||
|
return drvPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
string queryOutPath(EvalState & state) const
|
string queryOutPath(EvalState & state) const
|
||||||
{
|
{
|
||||||
|
if (outPath == "") {
|
||||||
Expr a = attrs.get("outPath");
|
Expr a = attrs.get("outPath");
|
||||||
if (!a) throw Error("output path missing");
|
if (!a) throw Error("output path missing");
|
||||||
return evalPath(state, a);
|
(string &) outPath = evalPath(state, a);
|
||||||
|
}
|
||||||
|
return outPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDrvPath(const string & s)
|
||||||
|
{
|
||||||
|
drvPath = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOutPath(const string & s)
|
||||||
|
{
|
||||||
|
outPath = s;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -394,13 +415,13 @@ static void queryInstSources(EvalState & state,
|
||||||
name = string(name, dash + 1);
|
name = string(name, dash + 1);
|
||||||
|
|
||||||
if (isDerivation(*i)) {
|
if (isDerivation(*i)) {
|
||||||
elem.queryDrvPath(state) = *i;
|
elem.setDrvPath(*i);
|
||||||
elem.queryOutPath(state) = findOutput(derivationFromPath(*i), "out");
|
elem.setOutPath(findOutput(derivationFromPath(*i), "out"));
|
||||||
if (name.size() >= drvExtension.size() &&
|
if (name.size() >= drvExtension.size() &&
|
||||||
string(name, name.size() - drvExtension.size()) == drvExtension)
|
string(name, name.size() - drvExtension.size()) == drvExtension)
|
||||||
name = string(name, 0, name.size() - drvExtension.size());
|
name = string(name, 0, name.size() - drvExtension.size());
|
||||||
}
|
}
|
||||||
else elem.queryOutPath(state) = *i;
|
else elem.setOutPath(*i);
|
||||||
|
|
||||||
elem.name = name;
|
elem.name = name;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue