aboutsummaryrefslogtreecommitdiffstats
path: root/classes/recipe_sanity.bbclass
diff options
context:
space:
mode:
authorChris Larson <clarson@mvista.com>2009-06-19 12:14:04 -0700
committerChris Larson <clarson@mvista.com>2009-06-19 12:15:14 -0700
commit01c214c0d1c1a8e8ced560e03bc74c3ea2708575 (patch)
tree5d41a933ecd7f793d81def1e53e32a9aa8b74d9e /classes/recipe_sanity.bbclass
parentf090fe6b95e9a4b60341ab324b56569ea447cba0 (diff)
downloadopenembedded-01c214c0d1c1a8e8ced560e03bc74c3ea2708575.tar.gz
recipe_sanity.bbclass: add checks for missing/default variables
By default, for now, it just checks for LICENSE being left as default when SRC_URI is set, and an empty DESCRIPTION, which freaks out the packaging classes. Signed-off-by: Chris Larson <clarson@mvista.com>
Diffstat (limited to 'classes/recipe_sanity.bbclass')
-rw-r--r--classes/recipe_sanity.bbclass23
1 files changed, 23 insertions, 0 deletions
diff --git a/classes/recipe_sanity.bbclass b/classes/recipe_sanity.bbclass
index 60fcfabfb7..870a83f6c3 100644
--- a/classes/recipe_sanity.bbclass
+++ b/classes/recipe_sanity.bbclass
@@ -2,6 +2,27 @@ def __note(msg, d):
import bb
bb.note("%s: recipe_sanity: %s" % (d.getVar("P", 1), msg))
+__recipe_sanity_reqvars = "DESCRIPTION"
+__recipe_sanity_reqdiffvars = "LICENSE"
+def req_vars(cfgdata, d):
+ for var in d.getVar("__recipe_sanity_reqvars", 1).split():
+ if not d.getVar(var, 0):
+ __note("%s should be set" % var, d)
+
+ for var in d.getVar("__recipe_sanity_reqdiffvars", 1).split():
+ val = d.getVar(var, 0)
+ cfgval = cfgdata.get(var)
+
+ # Hardcoding is bad, but I'm lazy. We don't care about license being
+ # unset if the recipe has no sources!
+ if var == "LICENSE" and d.getVar("SRC_URI", 1) == cfgdata.get("SRC_URI"):
+ continue
+
+ if not val:
+ __note("%s should be set" % var, d)
+ elif val == cfgval:
+ __note("%s should be defined to something other than default (%s)" % (var, cfgval), d)
+
def var_renames_overwrite(cfgdata, d):
renames = d.getVar("__recipe_sanity_renames", 0)
if renames:
@@ -108,6 +129,7 @@ python do_recipe_sanity () {
can_remove_others(p, cfgdata, d)
var_renames_overwrite(cfgdata, d)
+ req_vars(cfgdata, d)
}
do_recipe_sanity[nostamp] = "1"
#do_recipe_sanity[recrdeptask] = "do_recipe_sanity"
@@ -135,6 +157,7 @@ python recipe_sanity_eh () {
cfgdata[k] = d.getVar(k, 0)
d.setVar("__recipe_sanity_cfgdata", cfgdata)
+ #d.setVar("__recipe_sanity_cfgdata", d)
# Sick, very sick..
from bb.data_smart import DataSmart