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:
parent
1cb9fc74b7
commit
6d4fa01f1e
1 changed files with 48 additions and 0 deletions
48
pkgs/lib/strings-with-deps.nix
Normal file
48
pkgs/lib/strings-with-deps.nix
Normal 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;};
|
||||
}
|
Loading…
Reference in a new issue