* Improve obsolete/deprecated option warnings.

svn path=/nixos/trunk/; revision=21653
This commit is contained in:
Eelco Dolstra 2010-05-07 15:14:50 +00:00
parent 8fcbaefd2e
commit c1f7622512

View File

@ -13,17 +13,17 @@ let
obsolete = from: to: { obsolete = from: to: {
name = "Obsolete name"; name = "Obsolete name";
msg.use = x: msg.use = x:
builtins.trace "Option '${from}' is used instead of '${to}'." x; builtins.trace "Obsolete option `${from}' is used instead of `${to}'." x;
msg.define = x: msg.define = x:
builtins.trace "Option '${from}' is defined instead of '${to}'." x; builtins.trace "Obsolete option `${from}' is defined instead of `${to}'." x;
}; };
deprecated = from: to: { deprecated = from: to: {
name = "Deprecated name"; name = "Deprecated name";
msg.use = x: msg.use = x:
abort "Option '${from}' is used instead of '${to}'."; abort "Deprecated option `${from}' is used instead of `${to}'.";
msg.define = x: msg.define = x:
abort "Option '${from}' is defined instead of '${to}'."; abort "Deprecated option `${from}' is defined instead of `${to}'.";
}; };
@ -38,9 +38,9 @@ let
setTo = setAttrByPath (splitString "." to); setTo = setAttrByPath (splitString "." to);
setFrom = setAttrByPath (splitString "." from); setFrom = setAttrByPath (splitString "." from);
toOf = attrByPath (splitString "." to) toOf = attrByPath (splitString "." to)
(abort "Renaming Error: option '${to}' does not exists."); (abort "Renaming error: option `${to}' does not exists.");
fromOf = attrByPath (splitString "." from) fromOf = attrByPath (splitString "." from)
(abort "Internal Error: option '${from}' should be declared."); (abort "Internal error: option `${from}' should be declared.");
in in
[{ [{
options = setFrom (mkOption { options = setFrom (mkOption {