3
0
Fork 0
forked from mirrors/nixpkgs

Added strings-with-deps, a set of functions that are intended to

build a minimal text which includes given strings and satisfies
'dependencies' of type A requires B to go before it. Just like
global variable intialization must occur before using them. Supposed
to be used for constructing builder.sh .

svn path=/nixpkgs/trunk/; revision=9196
This commit is contained in:
Michael Raskin 2007-08-26 21:59:31 +00:00
parent 1cb9fc74b7
commit 6d4fa01f1e

View file

@ -0,0 +1,48 @@
args:
with args;
with lib;
let
inherit (builtins)
head tail isList;
rec {
/*
let shelllib = rec {
a= {
text = "aaaa";
deps = [b c];
};
b = {
text = "b";
};
c = {
text = "c";
deps = [];
};
};
in
[textClosure [shelllib.a]
textclosure shelllib.a];
*/
textClosureDupList = arg:
(
if isList arg then
textClosureDupList {text = ""; deps = arg;}
else
(if (arg ? deps) then
map textClosureDupList arg.deps
else [])
++ [arg]
);
textClosureList = arg: uniqList (textClosureDupList arg);
textClosure = arg: concatStringsSep "
" (textClosureList arg);
noDepEntry = text : {inherit text;};
FullDepEntry = text : deps: {inherit text args;};
}