summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/image.bbclass7
-rw-r--r--classes/recipe_sanity.bbclass70
-rw-r--r--classes/rootfs_deb.bbclass2
3 files changed, 71 insertions, 8 deletions
diff --git a/classes/image.bbclass b/classes/image.bbclass
index 0d798fa7db..864230bc91 100644
--- a/classes/image.bbclass
+++ b/classes/image.bbclass
@@ -243,8 +243,8 @@ if [ -e ${IMAGE_ROOTFS}/usr/bin/opkg-cl ] ; then
${OPKG} update
${OPKG} list_installed | awk '{print $1}' |sort | uniq > /tmp/installed-packages
- for i in $(cat /tmp/installed-packages) ; do
- for translation in ${IMAGE_LINGUAS}; do
+ for i in $(cat /tmp/installed-packages | grep -v locale) ; do
+ for translation in ${IMAGE_LINGUAS} $(echo ${IMAGE_LINGUAS} | awk -F_ '{print $1}'); do
echo ${i}-locale-${translation}
done
done | sort | uniq > /tmp/wanted-locale-packages
@@ -252,9 +252,8 @@ if [ -e ${IMAGE_ROOTFS}/usr/bin/opkg-cl ] ; then
${OPKG} list | awk '{print $1}' |grep locale |sort | uniq > /tmp/available-locale-packages
cat /tmp/wanted-locale-packages /tmp/available-locale-packages | sort | uniq -d > /tmp/pending-locale-packages
- cat /tmp/installed-packages /tmp/pending-locale-packages | grep locale | sort | uniq -u > /tmp/translation-list
- cat /tmp/translation-list | xargs ${OPKG} -nodeps install
+ cat /tmp/pending-locale-packages | xargs ${OPKG} -nodeps install
rm -f ${IMAGE_ROOTFS}${libdir}/opkg/lists/*
for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do
diff --git a/classes/recipe_sanity.bbclass b/classes/recipe_sanity.bbclass
index 4d00ddf1e5..29f4a8fada 100644
--- a/classes/recipe_sanity.bbclass
+++ b/classes/recipe_sanity.bbclass
@@ -1,3 +1,47 @@
+def __note(msg, d):
+ import bb
+ bb.note("%s: recipe_sanity: %s" % (d.getVar("P", 1), msg))
+
+__recipe_sanity_badtargetvars = "RDEPENDS RPROVIDES"
+def bad_target_vars(cfgdata, d):
+ import bb.data
+ if bb.data.inherits_class("native", d) or \
+ bb.data.inherits_class("cross", d):
+ return
+
+ for var in d.getVar("__recipe_sanity_badtargetvars", 1).split():
+ val = d.getVar(var, 0)
+ if val and val != cfgdata.get(var):
+ __note("%s should not be set, but is set to '%s'" % (var, val), d)
+
+__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:
+ for (key, newkey, oldvalue, newvalue) in renames:
+ if oldvalue != newvalue and oldvalue != cfgdata.get(newkey):
+ __note("rename of variable '%s' to '%s' overwrote existing value '%s' with '%s'." % (key, newkey, oldvalue, newvalue), d)
+
def incorrect_nonempty_PACKAGES(cfgdata, d):
import bb.data
if bb.data.inherits_class("native", d) or \
@@ -19,7 +63,7 @@ def can_use_autotools_base(cfgdata, d):
for clsfile in d.getVar("__inherit_cache", 0):
(base, _) = os.path.splitext(os.path.basename(clsfile))
if cfg.find("%s_do_configure" % base) != -1:
- bb.note("%s: recipe_sanity: autotools_base usage needs verification, spotted %s" % (d.getVar("P", 1), "%s_do_configure" % base))
+ __note("autotools_base usage needs verification, spotted %s_do_configure" % base, d)
return True
@@ -34,7 +78,8 @@ def can_remove_FILESPATH(cfgdata, d):
filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)]
for fp in filespath:
if not fp in expectedpaths:
- # bb.note("Path %s in FILESPATH not in the expected paths %s" % (fp, expectedpaths))
+ # __note("Path %s in FILESPATH not in the expected paths %s" %
+ # (fp, expectedpaths), d)
return False
return expected != unexpanded
@@ -74,7 +119,7 @@ def can_remove_others(p, cfgdata, d):
if unexpanded != cfgunexpanded and \
cfgexpanded == expanded:
- bb.note("%s: recipe_sanity: candidate for removal of %s" % (p, k))
+ __note("candidate for removal of %s" % k, d)
bb.debug(1, "%s: recipe_sanity: cfg's '%s' and d's '%s' both expand to %s" %
(p, cfgunexpanded, unexpanded, expanded))
@@ -92,9 +137,12 @@ python do_recipe_sanity () {
for (func, msg) in sanitychecks:
if func(cfgdata, d):
- bb.note("%s: recipe_sanity: %s" % (p, msg))
+ __note(msg, d)
can_remove_others(p, cfgdata, d)
+ var_renames_overwrite(cfgdata, d)
+ req_vars(cfgdata, d)
+ bad_target_vars(cfgdata, d)
}
do_recipe_sanity[nostamp] = "1"
#do_recipe_sanity[recrdeptask] = "do_recipe_sanity"
@@ -122,5 +170,19 @@ 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
+ old = DataSmart.renameVar
+ def myrename(self, key, newkey):
+ oldvalue = self.getVar(newkey, 0)
+ old(self, key, newkey)
+ newvalue = self.getVar(newkey, 0)
+ if oldvalue:
+ renames = self.getVar("__recipe_sanity_renames", 0) or set()
+ renames.add((key, newkey, oldvalue, newvalue))
+ self.setVar("__recipe_sanity_renames", renames)
+ DataSmart.renameVar = myrename
}
addhandler recipe_sanity_eh
diff --git a/classes/rootfs_deb.bbclass b/classes/rootfs_deb.bbclass
index 82220661f3..dc2b2cb02c 100644
--- a/classes/rootfs_deb.bbclass
+++ b/classes/rootfs_deb.bbclass
@@ -44,6 +44,8 @@ fakeroot rootfs_deb_do_rootfs () {
cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \
| sed -e 's#Architecture ".*";#Architecture "${DPKG_ARCH}";#' \
+ | sed -e 's#status ".*";#status "${IMAGE_ROOTFS}/var/dpkg/status";#' \
+ | sed -e 's#DPkg::Options {".*"};#DPkg::Options {"--root=${IMAGE_ROOTFS}";"--admindir=${IMAGE_ROOTFS}/var/dpkg";"--force-all";"--no-debsig"};#' \
> "${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf"
export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf"