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

View File

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