Options for kernel and checker for configuration.nix

svn path=/nixpkgs/trunk/; revision=9371
This commit is contained in:
Michael Raskin 2007-09-25 19:03:07 +00:00
parent 218ec9ae8b
commit dd5daab9d1
3 changed files with 61 additions and 2 deletions

View file

@ -0,0 +1,26 @@
#
# Checks that all set options are described.
#
options: configuration:
with builtins;
with (import ../../lib);
let
findInList = p: 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

View file

@ -22,8 +22,24 @@ configurePhase() {
cp $config .config
chmod u+w .config
echo --extraConfig--;
echo "${extraConfig}";
echo "$extraConfig" | while read; do
optionName=$( echo "$REPLY" | sed -e 's/[^A-Z_]//g' );
echo --optionName--;
echo "$REPLY";
echo ${optionName};
if [ -n "${optionName}" ]; then
sed -e s/.'*'${optionName}.'*'/"$REPLY/" -i .config
fi;
done;
echo "$extraConfig" >> .config
echo --finalConfig--
cat .config
#substituteInPlace scripts/kconfig/lxdialog/check-lxdialog.sh \
# --replace /usr /no-such-path

View file

@ -197,6 +197,15 @@ rec {
} // extraAttrs co // co.pass // co.flags_prefixed );
*/
# Check absence of non-used options
checker = x: flag: opts: config:
(if flag then let result=(
(import ../build-support/checker)
opts config); in
(if (result==null) then x else
abort (toString result))
else x);
### STANDARD ENVIRONMENT
@ -275,7 +284,6 @@ rec {
inherit stdenv;
};
### TOOLS
@ -2766,9 +2774,18 @@ rec {
{
name = "Enable-NO_HZ";
patch = ../lib/empty.file;
extraConfig = "NO_HZ=y\n";
extraConfig = "CONFIG_NO_HZ=y\n";
}
] else [])
++
(if (getConfig ["kernel" "timer_stats"] false) then [
{
name = "Enable-TIMER_STATS";
patch = ../lib/empty.file;
extraConfig = "CONFIG_TIMER_STATS=y\n";
}
] else [])
;
};