forked from lix-project/lix
* Sync with the trunk.
This commit is contained in:
commit
d66ea83a76
|
@ -71,6 +71,15 @@ fi
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
|
||||||
|
# To build programs to be run in the build machine
|
||||||
|
if test "$CC_FOR_BUILD" = ""; then
|
||||||
|
if test "$cross_compiling" = "yes"; then
|
||||||
|
AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
|
||||||
|
else
|
||||||
|
CC_FOR_BUILD="$CC"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_SUBST([CC_FOR_BUILD])
|
||||||
|
|
||||||
# We are going to use libtool.
|
# We are going to use libtool.
|
||||||
AC_DISABLE_STATIC
|
AC_DISABLE_STATIC
|
||||||
|
|
|
@ -38,7 +38,7 @@ to end-user applications like Mozilla Firefox. (Nix is however not
|
||||||
tied to the Nix Package collection; you could write your own Nix
|
tied to the Nix Package collection; you could write your own Nix
|
||||||
expressions based on it, or completely new ones.) You can download
|
expressions based on it, or completely new ones.) You can download
|
||||||
the latest version from <link
|
the latest version from <link
|
||||||
xlink:href='http://nixos.org/releases/full-index-nixpkgs.html' />.</para>
|
xlink:href='http://nixos.org/nixpkgs/download.html' />.</para>
|
||||||
|
|
||||||
<para>Assuming that you have downloaded and unpacked a release of Nix
|
<para>Assuming that you have downloaded and unpacked a release of Nix
|
||||||
Packages, you can view the set of available packages in the release:
|
Packages, you can view the set of available packages in the release:
|
||||||
|
|
|
@ -6,6 +6,18 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--==================================================================-->
|
||||||
|
|
||||||
|
<section xml:id="ssec-relnotes-0.15"><title>Release 0.15 (March 17, 2010)</title>
|
||||||
|
|
||||||
|
<para>This is a bug-fix release. Among other things, it fixes
|
||||||
|
building on Mac OS X (Snow Leopard), and improves the contents of
|
||||||
|
<filename>/etc/passwd</filename> and <filename>/etc/group</filename>
|
||||||
|
in <literal>chroot</literal> builds.</para>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<!--==================================================================-->
|
<!--==================================================================-->
|
||||||
|
|
||||||
<section xml:id="ssec-relnotes-0.14"><title>Release 0.14 (February 4, 2010)</title>
|
<section xml:id="ssec-relnotes-0.14"><title>Release 0.14 (February 4, 2010)</title>
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
noinst_PROGRAMS = bin2c
|
noinst_PROGRAMS = bin2c
|
||||||
|
|
||||||
bin2c_SOURCES = bin2c.c
|
bin2c_SOURCES = bin2c.c
|
||||||
|
|
||||||
|
bin2c$(EXEEXT): bin2c.c
|
||||||
|
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o bin2c bin2c.c
|
||||||
|
|
|
@ -24,18 +24,35 @@ typedef set<Expr> ExprSet;
|
||||||
|
|
||||||
|
|
||||||
static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
||||||
ExprSet & drvsSeen);
|
ExprSet & drvsSeen, bool location);
|
||||||
|
|
||||||
|
|
||||||
static void showAttrs(const ATermMap & attrs, XMLWriter & doc,
|
static void showAttrs(const ATermMap & attrs, XMLWriter & doc,
|
||||||
PathSet & context, ExprSet & drvsSeen)
|
PathSet & context, ExprSet & drvsSeen, bool location)
|
||||||
{
|
{
|
||||||
StringSet names;
|
StringSet names;
|
||||||
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i)
|
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i)
|
||||||
names.insert(aterm2String(i->key));
|
names.insert(aterm2String(i->key));
|
||||||
for (StringSet::iterator i = names.begin(); i != names.end(); ++i) {
|
for (StringSet::iterator i = names.begin(); i != names.end(); ++i) {
|
||||||
XMLOpenElement _(doc, "attr", singletonAttrs("name", *i));
|
ATerm attrRHS = attrs.get(toATerm(*i));
|
||||||
printTermAsXML(attrs.get(toATerm(*i)), doc, context, drvsSeen);
|
ATerm attr;
|
||||||
|
Pos pos;
|
||||||
|
XMLAttrs xmlAttrs;
|
||||||
|
|
||||||
|
xmlAttrs["name"] = *i;
|
||||||
|
if(matchAttrRHS(attrRHS, attr, pos)) {
|
||||||
|
ATerm path;
|
||||||
|
int line, column;
|
||||||
|
if (location && matchPos(pos, path, line, column)) {
|
||||||
|
xmlAttrs["path"] = aterm2String(path);
|
||||||
|
xmlAttrs["line"] = (format("%1%") % line).str();
|
||||||
|
xmlAttrs["column"] = (format("%1%") % column).str();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
abort(); // Should not happen.
|
||||||
|
|
||||||
|
XMLOpenElement _(doc, "attr", xmlAttrs);
|
||||||
|
printTermAsXML(attr, doc, context, drvsSeen, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +83,7 @@ static void printPatternAsXML(Pattern pat, XMLWriter & doc)
|
||||||
|
|
||||||
|
|
||||||
static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
||||||
ExprSet & drvsSeen)
|
ExprSet & drvsSeen, bool location)
|
||||||
{
|
{
|
||||||
XMLAttrs attrs;
|
XMLAttrs attrs;
|
||||||
string s;
|
string s;
|
||||||
|
@ -97,19 +114,24 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
||||||
|
|
||||||
else if (matchAttrs(e, as)) {
|
else if (matchAttrs(e, as)) {
|
||||||
ATermMap attrs;
|
ATermMap attrs;
|
||||||
queryAllAttrs(e, attrs);
|
queryAllAttrs(e, attrs, true);
|
||||||
|
|
||||||
Expr a = attrs.get(toATerm("type"));
|
Expr aRHS = attrs.get(toATerm("type"));
|
||||||
|
Expr a = NULL;
|
||||||
|
if (aRHS)
|
||||||
|
matchAttrRHS(aRHS, a, pos);
|
||||||
if (a && matchStr(a, s, context) && s == "derivation") {
|
if (a && matchStr(a, s, context) && s == "derivation") {
|
||||||
|
|
||||||
XMLAttrs xmlAttrs;
|
XMLAttrs xmlAttrs;
|
||||||
Path outPath, drvPath;
|
Path outPath, drvPath;
|
||||||
|
|
||||||
a = attrs.get(toATerm("drvPath"));
|
aRHS = attrs.get(toATerm("drvPath"));
|
||||||
|
matchAttrRHS(aRHS, a, pos);
|
||||||
if (matchStr(a, drvPath, context))
|
if (matchStr(a, drvPath, context))
|
||||||
xmlAttrs["drvPath"] = drvPath;
|
xmlAttrs["drvPath"] = drvPath;
|
||||||
|
|
||||||
a = attrs.get(toATerm("outPath"));
|
aRHS = attrs.get(toATerm("outPath"));
|
||||||
|
matchAttrRHS(aRHS, a, pos);
|
||||||
if (matchStr(a, outPath, context))
|
if (matchStr(a, outPath, context))
|
||||||
xmlAttrs["outPath"] = outPath;
|
xmlAttrs["outPath"] = outPath;
|
||||||
|
|
||||||
|
@ -117,25 +139,33 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
||||||
|
|
||||||
if (drvsSeen.find(e) == drvsSeen.end()) {
|
if (drvsSeen.find(e) == drvsSeen.end()) {
|
||||||
drvsSeen.insert(e);
|
drvsSeen.insert(e);
|
||||||
showAttrs(attrs, doc, context, drvsSeen);
|
showAttrs(attrs, doc, context, drvsSeen, location);
|
||||||
} else
|
} else
|
||||||
doc.writeEmptyElement("repeated");
|
doc.writeEmptyElement("repeated");
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
XMLOpenElement _(doc, "attrs");
|
XMLOpenElement _(doc, "attrs");
|
||||||
showAttrs(attrs, doc, context, drvsSeen);
|
showAttrs(attrs, doc, context, drvsSeen, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchList(e, es)) {
|
else if (matchList(e, es)) {
|
||||||
XMLOpenElement _(doc, "list");
|
XMLOpenElement _(doc, "list");
|
||||||
for (ATermIterator i(es); i; ++i)
|
for (ATermIterator i(es); i; ++i)
|
||||||
printTermAsXML(*i, doc, context, drvsSeen);
|
printTermAsXML(*i, doc, context, drvsSeen, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchFunction(e, pat, body, pos)) {
|
else if (matchFunction(e, pat, body, pos)) {
|
||||||
XMLOpenElement _(doc, "function");
|
ATerm path;
|
||||||
|
int line, column;
|
||||||
|
XMLAttrs xmlAttrs;
|
||||||
|
if (location && matchPos(pos, path, line, column)) {
|
||||||
|
xmlAttrs["path"] = aterm2String(path);
|
||||||
|
xmlAttrs["line"] = (format("%1%") % line).str();
|
||||||
|
xmlAttrs["column"] = (format("%1%") % column).str();
|
||||||
|
}
|
||||||
|
XMLOpenElement _(doc, "function", xmlAttrs);
|
||||||
printPatternAsXML(pat, doc);
|
printPatternAsXML(pat, doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +174,12 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void printTermAsXML(Expr e, std::ostream & out, PathSet & context)
|
void printTermAsXML(Expr e, std::ostream & out, PathSet & context, bool location)
|
||||||
{
|
{
|
||||||
XMLWriter doc(true, out);
|
XMLWriter doc(true, out);
|
||||||
XMLOpenElement root(doc, "expr");
|
XMLOpenElement root(doc, "expr");
|
||||||
ExprSet drvsSeen;
|
ExprSet drvsSeen;
|
||||||
printTermAsXML(e, doc, context, drvsSeen);
|
printTermAsXML(e, doc, context, drvsSeen, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
void printTermAsXML(Expr e, std::ostream & out, PathSet & context);
|
void printTermAsXML(Expr e, std::ostream & out, PathSet & context, bool location = false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -809,7 +809,8 @@ void killUser(uid_t uid)
|
||||||
case 0:
|
case 0:
|
||||||
try { /* child */
|
try { /* child */
|
||||||
|
|
||||||
if (setuid(uid) == -1) abort();
|
if (setuid(uid) == -1)
|
||||||
|
throw SysError("setting uid");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (kill(-1, SIGKILL) == 0) break;
|
if (kill(-1, SIGKILL) == 0) break;
|
||||||
|
@ -819,7 +820,7 @@ void killUser(uid_t uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
std::cerr << format("killing processes beloging to uid `%1%': %1%")
|
std::cerr << format("killing processes belonging to uid `%1%': %2%")
|
||||||
% uid % e.what() << std::endl;
|
% uid % e.what() << std::endl;
|
||||||
quickExit(1);
|
quickExit(1);
|
||||||
}
|
}
|
||||||
|
@ -827,8 +828,9 @@ void killUser(uid_t uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent */
|
/* parent */
|
||||||
if (pid.wait(true) != 0)
|
int status = pid.wait(true);
|
||||||
throw Error(format("cannot kill processes for uid `%1%'") % uid);
|
if (status != 0)
|
||||||
|
throw Error(format("cannot kill processes for uid `%1%': %2%") % uid % statusToString(status));
|
||||||
|
|
||||||
/* !!! We should really do some check to make sure that there are
|
/* !!! We should really do some check to make sure that there are
|
||||||
no processes left running under `uid', but there is no portable
|
no processes left running under `uid', but there is no portable
|
||||||
|
|
|
@ -91,6 +91,7 @@ void XMLWriter::writeAttrs(const XMLAttrs & attrs)
|
||||||
char c = i->second[j];
|
char c = i->second[j];
|
||||||
if (c == '"') output << """;
|
if (c == '"') output << """;
|
||||||
else if (c == '<') output << "<";
|
else if (c == '<') output << "<";
|
||||||
|
else if (c == '>') output << ">";
|
||||||
else if (c == '&') output << "&";
|
else if (c == '&') output << "&";
|
||||||
/* Escape newlines to prevent attribute normalisation (see
|
/* Escape newlines to prevent attribute normalisation (see
|
||||||
XML spec, section 3.3.3. */
|
XML spec, section 3.3.3. */
|
||||||
|
|
|
@ -22,6 +22,8 @@ Options:
|
||||||
For --eval-only / --parse-only:
|
For --eval-only / --parse-only:
|
||||||
|
|
||||||
--xml: print an XML representation of the abstract syntax tree
|
--xml: print an XML representation of the abstract syntax tree
|
||||||
|
--no-location: don't provide source location information in the
|
||||||
|
output XML tree
|
||||||
|
|
||||||
For --eval-only:
|
For --eval-only:
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@ static bool indirectRoot = false;
|
||||||
|
|
||||||
|
|
||||||
static void printResult(EvalState & state, Expr e,
|
static void printResult(EvalState & state, Expr e,
|
||||||
bool evalOnly, bool xmlOutput, const ATermMap & autoArgs)
|
bool evalOnly, bool xmlOutput, bool location, const ATermMap & autoArgs)
|
||||||
{
|
{
|
||||||
PathSet context;
|
PathSet context;
|
||||||
|
|
||||||
if (evalOnly)
|
if (evalOnly)
|
||||||
if (xmlOutput)
|
if (xmlOutput)
|
||||||
printTermAsXML(e, std::cout, context);
|
printTermAsXML(e, std::cout, context, location);
|
||||||
else
|
else
|
||||||
std::cout << format("%1%\n") % canonicaliseExpr(e);
|
std::cout << format("%1%\n") % canonicaliseExpr(e);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ static void printResult(EvalState & state, Expr e,
|
||||||
|
|
||||||
void processExpr(EvalState & state, const Strings & attrPaths,
|
void processExpr(EvalState & state, const Strings & attrPaths,
|
||||||
bool parseOnly, bool strict, const ATermMap & autoArgs,
|
bool parseOnly, bool strict, const ATermMap & autoArgs,
|
||||||
bool evalOnly, bool xmlOutput, Expr e)
|
bool evalOnly, bool xmlOutput, bool location, Expr e)
|
||||||
{
|
{
|
||||||
for (Strings::const_iterator i = attrPaths.begin(); i != attrPaths.end(); ++i) {
|
for (Strings::const_iterator i = attrPaths.begin(); i != attrPaths.end(); ++i) {
|
||||||
Expr e2 = findAlongAttrPath(state, *i, autoArgs, e);
|
Expr e2 = findAlongAttrPath(state, *i, autoArgs, e);
|
||||||
|
@ -77,7 +77,7 @@ void processExpr(EvalState & state, const Strings & attrPaths,
|
||||||
e2 = strictEvalExpr(state, e2);
|
e2 = strictEvalExpr(state, e2);
|
||||||
else
|
else
|
||||||
e2 = evalExpr(state, e2);
|
e2 = evalExpr(state, e2);
|
||||||
printResult(state, e2, evalOnly, xmlOutput, autoArgs);
|
printResult(state, e2, evalOnly, xmlOutput, location, autoArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ void run(Strings args)
|
||||||
bool evalOnly = false;
|
bool evalOnly = false;
|
||||||
bool parseOnly = false;
|
bool parseOnly = false;
|
||||||
bool xmlOutput = false;
|
bool xmlOutput = false;
|
||||||
|
bool xmlOutputSourceLocation = true;
|
||||||
bool strict = false;
|
bool strict = false;
|
||||||
Strings attrPaths;
|
Strings attrPaths;
|
||||||
ATermMap autoArgs(128);
|
ATermMap autoArgs(128);
|
||||||
|
@ -125,6 +126,8 @@ void run(Strings args)
|
||||||
indirectRoot = true;
|
indirectRoot = true;
|
||||||
else if (arg == "--xml")
|
else if (arg == "--xml")
|
||||||
xmlOutput = true;
|
xmlOutput = true;
|
||||||
|
else if (arg == "--no-location")
|
||||||
|
xmlOutputSourceLocation = false;
|
||||||
else if (arg == "--strict")
|
else if (arg == "--strict")
|
||||||
strict = true;
|
strict = true;
|
||||||
else if (arg[0] == '-')
|
else if (arg[0] == '-')
|
||||||
|
@ -140,7 +143,7 @@ void run(Strings args)
|
||||||
if (readStdin) {
|
if (readStdin) {
|
||||||
Expr e = parseStdin(state);
|
Expr e = parseStdin(state);
|
||||||
processExpr(state, attrPaths, parseOnly, strict, autoArgs,
|
processExpr(state, attrPaths, parseOnly, strict, autoArgs,
|
||||||
evalOnly, xmlOutput, e);
|
evalOnly, xmlOutput, xmlOutputSourceLocation, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Strings::iterator i = files.begin();
|
for (Strings::iterator i = files.begin();
|
||||||
|
@ -149,7 +152,7 @@ void run(Strings args)
|
||||||
Path path = absPath(*i);
|
Path path = absPath(*i);
|
||||||
Expr e = parseExprFromFile(state, path);
|
Expr e = parseExprFromFile(state, path);
|
||||||
processExpr(state, attrPaths, parseOnly, strict, autoArgs,
|
processExpr(state, attrPaths, parseOnly, strict, autoArgs,
|
||||||
evalOnly, xmlOutput, e);
|
evalOnly, xmlOutput, xmlOutputSourceLocation, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
printEvalStats(state);
|
printEvalStats(state);
|
||||||
|
|
|
@ -54,7 +54,8 @@ for i in lang/eval-okay-*.nix; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -e lang/$i.exp.xml; then
|
if test -e lang/$i.exp.xml; then
|
||||||
if ! $nixinstantiate --eval-only --xml --strict lang/$i.nix > lang/$i.out.xml; then
|
if ! $nixinstantiate --eval-only --xml --no-location --strict \
|
||||||
|
lang/$i.nix > lang/$i.out.xml; then
|
||||||
echo "FAIL: $i should evaluate"
|
echo "FAIL: $i should evaluate"
|
||||||
fail=1
|
fail=1
|
||||||
elif ! cmp -s lang/$i.out.xml lang/$i.exp.xml; then
|
elif ! cmp -s lang/$i.out.xml lang/$i.exp.xml; then
|
||||||
|
|
1
tests/lang/eval-okay-toxml.exp
Normal file
1
tests/lang/eval-okay-toxml.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Str("<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <attrs>\n <attr name=\"a\">\n <string value=\"s\" />\n </attr>\n </attrs>\n</expr>\n",[])
|
3
tests/lang/eval-okay-toxml.nix
Normal file
3
tests/lang/eval-okay-toxml.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Make sure the expected XML output is produced; in particular, make sure it
|
||||||
|
# doesn't contain source location information.
|
||||||
|
builtins.toXML { a = "s"; }
|
|
@ -1 +1 @@
|
||||||
Str("xyzzybar",[])
|
Str("xyzzybarxyzzybar",[])
|
||||||
|
|
|
@ -7,7 +7,13 @@ let {
|
||||||
b = "bar";
|
b = "bar";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bs = {
|
||||||
|
a = "bar";
|
||||||
|
};
|
||||||
|
|
||||||
x = with as; a + b;
|
x = with as; a + b;
|
||||||
|
|
||||||
body = x;
|
y = with as; with bs; a + b;
|
||||||
|
|
||||||
|
body = x + y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue