mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
* Sync with the trunk.
This commit is contained in:
commit
aa45027818
109 changed files with 3350 additions and 4010 deletions
|
@ -30,7 +30,6 @@ export REAL_STORE_DIR=@storedir@
|
|||
export NIX_BUILD_HOOK=
|
||||
export PERL=perl
|
||||
export TOP=$(pwd)/..
|
||||
export aterm_bin=@aterm_bin@
|
||||
export bzip2_bin_test="@bzip2_bin_test@"
|
||||
if test "${bzip2_bin_test:0:1}" != "/"; then
|
||||
bzip2_bin_test=`pwd`/${bzip2_bin_test}
|
||||
|
@ -42,10 +41,6 @@ export xsltproc="@xsltproc@"
|
|||
export sqlite3="@sqlite_bin@/bin/sqlite3"
|
||||
export SHELL="@shell@"
|
||||
|
||||
# Hack to get "atdiff" to run on Cygwin (Windows looks for
|
||||
# DLLs in $PATH).
|
||||
export PATH=$aterm_bin/../lib:$PATH
|
||||
|
||||
export version=@version@
|
||||
export system=@system@
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ let {
|
|||
|
||||
input2 = mkDerivation {
|
||||
name = "dependencies-input-2";
|
||||
builder = ./. ~ "dependencies.builder2.sh";
|
||||
builder = ./dependencies.builder2.sh;
|
||||
};
|
||||
|
||||
body = mkDerivation {
|
||||
|
|
|
@ -16,14 +16,10 @@ done
|
|||
for i in lang/parse-okay-*.nix; do
|
||||
echo "parsing $i (should succeed)";
|
||||
i=$(basename $i .nix)
|
||||
if ! $nixinstantiate --parse-only - < lang/$i.nix > lang/$i.ast; then
|
||||
if ! $nixinstantiate --parse-only - < lang/$i.nix > lang/$i.out; then
|
||||
echo "FAIL: $i should parse"
|
||||
fail=1
|
||||
fi
|
||||
if ! $aterm_bin/atdiff lang/$i.ast lang/$i.exp; then
|
||||
echo "FAIL: parse tree of $i not as expected"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
|
||||
for i in lang/eval-fail-*.nix; do
|
||||
|
@ -44,10 +40,10 @@ for i in lang/eval-okay-*.nix; do
|
|||
if test -e lang/$i.flags; then
|
||||
flags=$(cat lang/$i.flags)
|
||||
fi
|
||||
if ! $nixinstantiate $flags --eval-only lang/$i.nix > lang/$i.out; then
|
||||
if ! $nixinstantiate $flags --eval-only --strict lang/$i.nix > lang/$i.out; then
|
||||
echo "FAIL: $i should evaluate"
|
||||
fail=1
|
||||
elif ! $aterm_bin/atdiff lang/$i.out lang/$i.exp; then
|
||||
elif ! diff lang/$i.out lang/$i.exp; then
|
||||
echo "FAIL: evaluation result of $i not as expected"
|
||||
fail=1
|
||||
fi
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(1275)
|
||||
1275
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("newxfoonewxy",[])
|
||||
"newxfoonewxy"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(987)
|
||||
987
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(987)
|
||||
987
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foo 22 80 itchyxac",[])
|
||||
"foo 22 80 itchyxac"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("xyzzy!xyzzy!foobar",[])
|
||||
"xyzzy!xyzzy!foobar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Path("/foo")
|
||||
/foo
|
||||
|
|
|
@ -1 +1 @@
|
|||
List([Int(1),Int(2),Int(3),Int(4),Int(5),Int(6),Int(7),Int(8),Int(9)])
|
||||
[ 1 2 3 4 5 6 7 8 9 ]
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foo eval-okay-context.nix bar",[])
|
||||
"foo eval-okay-context.nix bar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("ab",[])
|
||||
"ab"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("1234567",[])
|
||||
"1234567"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foobar",[])
|
||||
"foobar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(3)
|
||||
3
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', ${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: ${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\nfoo\n'bla'\nbar\n",[])
|
||||
"This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', ${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: ${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\nfoo\n'bla'\nbar\n"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foobar",[])
|
||||
"foobar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foobarblatest",[])
|
||||
"foobarblatest"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
List([Attrs([Bind("a",Str("A",[]),NoPos),Bind("b",Str("B",[]),NoPos)]),Attrs([Bind("a",Str("A",[]),NoPos),Bind("b",Str("B",[]),NoPos)])])
|
1
tests/lang/eval-okay-listtoattrs.exp
Normal file
1
tests/lang/eval-okay-listtoattrs.exp
Normal file
|
@ -0,0 +1 @@
|
|||
"AA"
|
|
@ -1,8 +1,10 @@
|
|||
# this test shows how to use listToAttrs and that evaluation is still lazy (throw isn't called)
|
||||
with import ./lib.nix;
|
||||
|
||||
let
|
||||
asi = attr: value : { inherit attr value; };
|
||||
asi = name: value : { inherit name value; };
|
||||
list = [ ( asi "a" "A" ) ( asi "b" "B" ) ];
|
||||
a = builtins.listToAttrs list;
|
||||
b = builtins.listToAttrs ( list ++ list );
|
||||
r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ];
|
||||
in r.result
|
||||
in concat (map (x: x.a) r.result)
|
|
@ -1 +1 @@
|
|||
Int(1)
|
||||
1
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foobarblabarxyzzybar",[])
|
||||
"foobarblabarxyzzybar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("xyzzyfoobar",[])
|
||||
"xyzzyfoobar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Bool(True)
|
||||
true
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("abcxyzDDDDEFghijk",[])
|
||||
"abcxyzDDDDEFijk"
|
||||
|
|
|
@ -6,8 +6,6 @@ let
|
|||
|
||||
h = {x ? "d", y ? x, z ? args.x}@args: x + y + z;
|
||||
|
||||
i = args@args2: args.x + args2.y;
|
||||
|
||||
j = {x, y, z, ...}: x + y + z;
|
||||
|
||||
in
|
||||
|
@ -15,5 +13,4 @@ in
|
|||
g {x = "x"; y = "y"; z = "z";} +
|
||||
h {x = "D";} +
|
||||
h {x = "D"; y = "E"; z = "F";} +
|
||||
i {x = "g"; y = "h";} +
|
||||
j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("builtins.readFile ./eval-okay-readfile.nix\n",[])
|
||||
"builtins.readFile ./eval-okay-readfile.nix\n"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(456)
|
||||
456
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(3)
|
||||
3
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(1)
|
||||
1
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(4)
|
||||
4
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("ccdd",[])
|
||||
"ccdd"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("ccdd",[])
|
||||
"ccdd"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Int(1)
|
||||
1
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar",[])
|
||||
"foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("ooxfoobarybarzobaabb",[])
|
||||
"ooxfoobarybarzobaabb"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Str("<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <list>\n <string value=\"ab\" />\n <int value=\"10\" />\n <attrs>\n <attr name=\"x\">\n <string value=\"x\" />\n </attr>\n <attr name=\"y\">\n <string value=\"x\" />\n </attr>\n </attrs>\n </list>\n</expr>\n",[])
|
|
@ -1 +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",[])
|
||||
"<?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"
|
||||
|
|
1
tests/lang/eval-okay-toxml2.exp
Normal file
1
tests/lang/eval-okay-toxml2.exp
Normal file
|
@ -0,0 +1 @@
|
|||
"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <list>\n <string value=\"ab\" />\n <int value=\"10\" />\n <attrs>\n <attr name=\"x\">\n <string value=\"x\" />\n </attr>\n <attr name=\"y\">\n <string value=\"x\" />\n </attr>\n </attrs>\n </list>\n</expr>\n"
|
1
tests/lang/eval-okay-tryeval.exp
Normal file
1
tests/lang/eval-okay-tryeval.exp
Normal file
|
@ -0,0 +1 @@
|
|||
{ x = { success = true; value = "x"; }; y = { success = false; value = false; }; z = { success = false; value = false; }; }
|
5
tests/lang/eval-okay-tryeval.nix
Normal file
5
tests/lang/eval-okay-tryeval.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
x = builtins.tryEval "x";
|
||||
y = builtins.tryEval (assert false; "y");
|
||||
z = builtins.tryEval (throw "bla");
|
||||
}
|
|
@ -1 +1 @@
|
|||
Bool(True)
|
||||
true
|
||||
|
|
|
@ -1 +1 @@
|
|||
Str("xyzzybarxyzzybar",[])
|
||||
"xyzzybarxyzzybar"
|
||||
|
|
|
@ -6,14 +6,11 @@
|
|||
</attr>
|
||||
<attr name="at">
|
||||
<function>
|
||||
<at>
|
||||
<varpat name="args" />
|
||||
<attrspat>
|
||||
<attr name="x" />
|
||||
<attr name="y" />
|
||||
<attr name="z" />
|
||||
</attrspat>
|
||||
</at>
|
||||
<attrspat name="args">
|
||||
<attr name="x" />
|
||||
<attr name="y" />
|
||||
<attr name="z" />
|
||||
</attrspat>
|
||||
</function>
|
||||
</attr>
|
||||
<attr name="b">
|
||||
|
@ -24,11 +21,10 @@
|
|||
</attr>
|
||||
<attr name="ellipsis">
|
||||
<function>
|
||||
<attrspat>
|
||||
<attrspat ellipsis="1">
|
||||
<attr name="x" />
|
||||
<attr name="y" />
|
||||
<attr name="z" />
|
||||
<ellipsis />
|
||||
</attrspat>
|
||||
</function>
|
||||
</attr>
|
||||
|
|
9
tests/lang/parse-fail-dup-attrs-7.nix
Normal file
9
tests/lang/parse-fail-dup-attrs-7.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
rec {
|
||||
|
||||
x = 1;
|
||||
|
||||
as = {
|
||||
inherit x;
|
||||
inherit x;
|
||||
};
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Function(AttrsPat([Formal("x",NoDefaultValue),Formal("y",NoDefaultValue),Formal("z",NoDefaultValue)],Bool(False)),OpPlus(OpPlus(Var("x"),Var("y")),Var("z")),NoPos)
|
|
@ -1 +0,0 @@
|
|||
Rec([Bind("x",Var("y"),NoPos),Bind("y",Int(123),NoPos),Bind("foo",Str("multi\nline\n string\n test\r",[]),NoPos),Bind("z",Int(456),NoPos)],[])
|
|
@ -1 +0,0 @@
|
|||
Function(AttrsPat([Formal("stdenv",NoDefaultValue),Formal("fetchurl",NoDefaultValue)],Bool(False)),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("name",Str("libXi-6.0.1",[]),NoPos),Bind("src",Call(Var("fetchurl"),Attrs([Bind("md5",Str("7e935a42428d63a387b3c048be0f2756",[]),NoPos),Bind("url",Str("http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2",[]),NoPos)])),NoPos)])),NoPos)
|
|
@ -1 +0,0 @@
|
|||
Function(AttrsPat([Formal("localServer",DefaultValue(Var("false"))),Formal("httpServer",DefaultValue(Var("false"))),Formal("sslSupport",DefaultValue(Var("false"))),Formal("pythonBindings",DefaultValue(Var("false"))),Formal("javaSwigBindings",DefaultValue(Var("false"))),Formal("javahlBindings",DefaultValue(Var("false"))),Formal("stdenv",NoDefaultValue),Formal("fetchurl",NoDefaultValue),Formal("openssl",DefaultValue(Var("null"))),Formal("httpd",DefaultValue(Var("null"))),Formal("db4",DefaultValue(Var("null"))),Formal("expat",NoDefaultValue),Formal("swig",DefaultValue(Var("null"))),Formal("j2sdk",DefaultValue(Var("null")))],Bool(False)),Assert(OpNEq(Var("expat"),Var("null")),Assert(OpImpl(Var("localServer"),OpNEq(Var("db4"),Var("null"))),Assert(OpImpl(Var("httpServer"),OpAnd(OpNEq(Var("httpd"),Var("null")),OpEq(Select(Var("httpd"),"expat"),Var("expat")))),Assert(OpImpl(Var("sslSupport"),OpAnd(OpNEq(Var("openssl"),Var("null")),OpImpl(Var("httpServer"),OpEq(Select(Var("httpd"),"openssl"),Var("openssl"))))),Assert(OpImpl(Var("pythonBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"pythonSupport"))),Assert(OpImpl(Var("javaSwigBindings"),OpAnd(OpNEq(Var("swig"),Var("null")),Select(Var("swig"),"javaSupport"))),Assert(OpImpl(Var("javahlBindings"),OpNEq(Var("j2sdk"),Var("null"))),Call(Select(Var("stdenv"),"mkDerivation"),Attrs([Bind("builder",Path("/foo/bar"),NoPos),Bind("db4",If(Var("localServer"),Var("db4"),Var("null")),NoPos),Bind("expat",Var("expat"),NoPos),Bind("httpServer",Var("httpServer"),NoPos),Bind("httpd",If(Var("httpServer"),Var("httpd"),Var("null")),NoPos),Bind("j2sdk",If(Var("javaSwigBindings"),Select(Var("swig"),"j2sdk"),If(Var("javahlBindings"),Var("j2sdk"),Var("null"))),NoPos),Bind("javaSwigBindings",Var("javaSwigBindings"),NoPos),Bind("javahlBindings",Var("javahlBindings"),NoPos),Bind("localServer",Var("localServer"),NoPos),Bind("name",Str("subversion-1.1.1",[]),NoPos),Bind("openssl",If(Var("sslSupport"),Var("openssl"),Var("null")),NoPos),Bind("patches",If(Var("javahlBindings"),List([Path("/javahl.patch")]),List([])),NoPos),Bind("python",If(Var("pythonBindings"),Select(Var("swig"),"python"),Var("null")),NoPos),Bind("pythonBindings",Var("pythonBindings"),NoPos),Bind("src",Call(Var("fetchurl"),Attrs([Bind("md5",Str("a180c3fe91680389c210c99def54d9e0",[]),NoPos),Bind("url",Str("http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2",[]),NoPos)])),NoPos),Bind("sslSupport",Var("sslSupport"),NoPos),Bind("swig",If(OpOr(Var("pythonBindings"),Var("javaSwigBindings")),Var("swig"),Var("null")),NoPos)])),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos),NoPos)
|
|
@ -1 +0,0 @@
|
|||
List([Str("x:x",[]),Str("https://svn.cs.uu.nl:12443/repos/trace/trunk",[]),Str("http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2",[]),Str("http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz",[]),Str("http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz",[]),Str("ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz",[])])
|
Loading…
Add table
Add a link
Reference in a new issue