Index: tools/config.py
===================================================================
--- tools/config.py	(revision ac0cb2ac8774922acaa210b75ea25715e04c97fe)
+++ tools/config.py	(revision ef0e2598ce81b621e2ab24cc22dec0ca61e29182)
@@ -231,15 +231,31 @@
     f.close()
 
-def check_condition(text, defaults):
-    result = True
-    conds = text.split('&')
+def check_condition(text, defaults, asked_names):
+    seen_vars = [ x[0] for x in asked_names ]
+    ctype = 'cnf'
+    if ')|' in text or '|(' in text:
+        ctype = 'dnf'
+    
+    if ctype == 'cnf':
+        conds = text.split('&')
+    else:
+        conds = text.split('|')
+
     for cond in conds:
         if cond.startswith('(') and cond.endswith(')'):
             cond = cond[1:-1]
-        if not check_dnf(cond, defaults):
+            
+        inside = check_inside(cond, defaults, ctype, seen_vars)
+        
+        if ctype == 'cnf' and not inside:
             return False
-    return True
-
-def check_dnf(text, defaults):
+        if ctype == 'dnf' and inside:
+            return True
+
+    if ctype == 'cnf':
+        return True
+    return False
+
+def check_inside(text, defaults, ctype, seen_vars):
     """
     Check that the condition specified on input line is True
@@ -247,5 +263,8 @@
     only CNF is supported
     """
-    conds = text.split('|')
+    if ctype == 'cnf':
+        conds = text.split('|')
+    else:
+        conds = text.split('&')
     for cond in conds:
         res = re.match(r'^(.*?)(!?=)(.*)$', cond)
@@ -255,13 +274,25 @@
         oper = res.group(2)
         condval = res.group(3)
+        if condname not in seen_vars:
+            raise RuntimeError("Variable %s not defined before being asked." %\
+                               condname)
         if not defaults.has_key(condname):
             raise RuntimeError("Condition var %s does not exist: %s" % \
                                (condname,text))
 
-        if oper=='=' and  condval == defaults[condname]:
-            return True
-        if oper == '!=' and condval != defaults[condname]:
-            return True
-    return False
+        if ctype == 'cnf':
+            if oper == '=' and  condval == defaults[condname]:
+                return True
+            if oper == '!=' and condval != defaults[condname]:
+                return True
+        else:
+            if oper== '=' and condval != defaults[condname]:
+                return False
+            if oper== '!=' and condval == defaults[condname]:
+                print 2
+                return False
+    if ctype=='cnf':
+        return False
+    return True
 
 def parse_config(input, output, dlg, defaults={}, askonly=None):
@@ -305,5 +336,6 @@
                 raise RuntimeError('Invalid command: %s' % line)
             if res.group(1):
-                if not check_condition(res.group(1), defaults):
+                if not check_condition(res.group(1), defaults,
+                                       asked_names):
                     continue
             args = res.group(2).strip().split(' ')
@@ -335,5 +367,6 @@
             
             if res.group(1):
-                if not check_condition(res.group(1), defaults):
+                if not check_condition(res.group(1), defaults,
+                                       asked_names):
                     if default is not None:
                         outf.write('#!# %s = %s\n' % (varname, default))
@@ -366,5 +399,6 @@
                 raise RuntimeError("Bad line: %s" % line)
             if res.group(1):
-                if not check_condition(res.group(1),defaults):
+                if not check_condition(res.group(1),defaults,
+                                       asked_names):
                     continue
             choices.append((res.group(2), res.group(3)))
@@ -434,5 +468,5 @@
     
     if not defmode and dlg.yesno('Rebuild kernel?') == 'y':
-        os.execlp('make','make','clean','all')
+        os.execlp('make','make','clean','build')
 
 if __name__ == '__main__':
