mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
* Simplify the substitute mechanism:
- Drop the store expression. So now a substitute is just a command-line invocation (a program name + arguments). If you register a substitute you are responsible for registering the expression that built it (if any) as a root of the garbage collector. - Drop the substitutes-rev DB table.
This commit is contained in:
parent
015beb7cd0
commit
fa9259f5f5
5 changed files with 42 additions and 122 deletions
|
@ -11,6 +11,7 @@ Operations:
|
|||
|
||||
--successor: register a successor expression (dangerous!)
|
||||
--substitute: register a substitute expression (dangerous!)
|
||||
--clear-substitute: clear all substitutes
|
||||
--validpath: register path validity (dangerous!)
|
||||
--isvalid: check path validity
|
||||
|
||||
|
|
|
@ -166,7 +166,6 @@ static void opSubstitute(Strings opFlags, Strings opArgs)
|
|||
Substitute sub;
|
||||
getline(cin, srcPath);
|
||||
if (cin.eof()) break;
|
||||
getline(cin, sub.storeExpr);
|
||||
getline(cin, sub.program);
|
||||
string s;
|
||||
getline(cin, s);
|
||||
|
@ -186,6 +185,17 @@ static void opSubstitute(Strings opFlags, Strings opArgs)
|
|||
}
|
||||
|
||||
|
||||
static void opClearSubstitutes(Strings opFlags, Strings opArgs)
|
||||
{
|
||||
if (!opFlags.empty()) throw UsageError("unknown flag");
|
||||
if (!opArgs.empty())
|
||||
throw UsageError("no arguments expected");
|
||||
|
||||
clearSubstitutes();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void opValidPath(Strings opFlags, Strings opArgs)
|
||||
{
|
||||
if (!opFlags.empty()) throw UsageError("unknown flag");
|
||||
|
@ -354,6 +364,8 @@ void run(Strings args)
|
|||
op = opSuccessor;
|
||||
else if (arg == "--substitute")
|
||||
op = opSubstitute;
|
||||
else if (arg == "--clear-substitutes")
|
||||
op = opClearSubstitutes;
|
||||
else if (arg == "--validpath")
|
||||
op = opValidPath;
|
||||
else if (arg == "--isvalid")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue