From d93753b79455bfcf19a9c3c6f797b1c7fa5b8cf1 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Sat, 10 Nov 2007 13:35:50 +0000
Subject: [PATCH] Fixed option checker after changin option format.

svn path=/nixpkgs/trunk/; revision=9621
---
 pkgs/build-support/checker/default.nix | 39 ++++++++++++++------------
 pkgs/top-level/all-packages.nix        |  4 +--
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/pkgs/build-support/checker/default.nix b/pkgs/build-support/checker/default.nix
index 989d58133833..ebf977d4755f 100644
--- a/pkgs/build-support/checker/default.nix
+++ b/pkgs/build-support/checker/default.nix
@@ -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
+
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 8a5b60580855..12d502dd2b43 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -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) {