forked from lix-project/hydra
* Start of a helper tool to evaluate job expressions efficiently.
This commit is contained in:
parent
8da2a47568
commit
c3cc2262b7
5
src/c/Makefile
Normal file
5
src/c/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
NIX = /home/eelco/Dev/nix/inst
|
||||
ATERM = /home/eelco/Dev/nix/externals/inst-aterm
|
||||
|
||||
eval-jobs: eval-jobs.cc
|
||||
libtool --mode=link g++ -o eval-jobs eval-jobs.cc -I$(NIX)/include/nix -I$(ATERM)/include -L$(NIX)/lib/nix/ -lmain -lexpr -L$(ATERM)/lib -lATerm
|
41
src/c/eval-jobs.cc
Normal file
41
src/c/eval-jobs.cc
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "eval.hh"
|
||||
#include "parser.hh"
|
||||
#include "expr-to-xml.hh"
|
||||
|
||||
using namespace nix;
|
||||
|
||||
|
||||
void printHelp()
|
||||
{
|
||||
std::cout << "Syntax: eval-jobs <expr>\n";
|
||||
}
|
||||
|
||||
|
||||
void run(Strings args)
|
||||
{
|
||||
EvalState state;
|
||||
Path releaseExpr;
|
||||
|
||||
for (Strings::iterator i = args.begin(); i != args.end(); ) {
|
||||
string arg = *i++;
|
||||
if (arg[0] == '-')
|
||||
throw UsageError(format("unknown flag `%1%'") % arg);
|
||||
else
|
||||
releaseExpr = arg;
|
||||
}
|
||||
|
||||
store = openStore();
|
||||
|
||||
Expr e = evalExpr(state, parseExprFromFile(state, releaseExpr));
|
||||
|
||||
PathSet context;
|
||||
printTermAsXML(e, std::cout, context);
|
||||
}
|
||||
|
||||
|
||||
string programId = "eval-jobs";
|
Loading…
Reference in a new issue