Fixed option checker after changin option format.

svn path=/nixpkgs/trunk/; revision=9621
This commit is contained in:
Michael Raskin 2007-11-10 13:35:50 +00:00
parent 9d1fc7c5ba
commit d93753b794
2 changed files with 23 additions and 20 deletions

View File

@ -3,24 +3,27 @@
#
options: configuration:
with builtins;
with (import ../../lib);
let lib=(import ../../lib); in
with lib;
let
let
findInList = p: list: default:
if (list == []) then default else
if (p (head list)) then (head list) else
findInList p (tail list) default;
if (list == []) then default else
if (p (head list)) then (head list) else
findInList p (tail list) default;
attrSetToList = attrs: if (isAttrs attrs) then (concatLists (map
(s:
(map (l: ([s] ++ l))
(attrSetToList (getAttr s attrs))))
(attrNames attrs))) else [[]];
in
let opts = (map (a: a.name) options);
conf = attrSetToList configuration;
in
let res=findInList (a: (findInList (b: (eqLists a b)) opts null)==null) conf null;
in
#if res==null then null else map (l: ["<"] ++ l ++ [">"]) res
res
checkAttrInclusion = s: a: b:
(
if (! isAttrs b) then s else
if (lib.getAttr ["_type"] "" b) == "option" then "" else
findInList (x : x != "")
(map (x: checkAttrInclusion
(s + "." + x)
(__getAttr x a)
(lib.getAttr [x] null b))
(attrNames a)) ""
);
in
checkAttrInclusion "" configuration options

View File

@ -206,8 +206,8 @@ rec {
(if flag then let result=(
(import ../build-support/checker)
opts config); in
(if (result==null) then x else
abort (toString result))
(if (result=="") then x else
abort result)
else x);
builderDefs = lib.sumArgs (import ./builder-defs.nix) {