summaryrefslogtreecommitdiffstats
path: root/meta-agl-core/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta-agl-core/classes')
-rw-r--r--meta-agl-core/classes/cloc.bbclass33
-rw-r--r--meta-agl-core/classes/sanity-meta-agl-core.bbclass10
2 files changed, 43 insertions, 0 deletions
diff --git a/meta-agl-core/classes/cloc.bbclass b/meta-agl-core/classes/cloc.bbclass
new file mode 100644
index 000000000..9b73704e8
--- /dev/null
+++ b/meta-agl-core/classes/cloc.bbclass
@@ -0,0 +1,33 @@
+# (C) 2017 Jan-Simon Möller <dl9pf@gmx.de>
+#
+# License: GPLv2
+#
+# summary with
+# cloc --sum-reports `find . -name "*clocreport" | grep -v "\-native" ` --out summary.report
+
+# cloc needs to be installed on the host
+# FIXME: create a cloc-native
+HOSTTOOLS += "cloc"
+
+CLOC_DIRECTORY ??= "${DEPLOY_DIR}/cloc/"
+CLOCSTATEDIR = "${WORKDIR}/cloc-destdir/"
+
+python do_cloc() {
+
+ import subprocess
+
+ source_dir = d.getVar('S', True)
+ pn = d.getVar('PN', True)
+
+ destdir = d.expand('${CLOCSTATEDIR}')
+ bb.utils.mkdirhier(destdir)
+
+ cloc_cmd = 'cloc %s -q --out=%s/%s.clocreport' % (source_dir, destdir, pn )
+ subprocess.call(cloc_cmd, shell=True)
+
+}
+
+
+addtask cloc before do_configure after do_patch
+
+EXPORT_FUNCTIONS do_cloc
diff --git a/meta-agl-core/classes/sanity-meta-agl-core.bbclass b/meta-agl-core/classes/sanity-meta-agl-core.bbclass
new file mode 100644
index 000000000..93df587f4
--- /dev/null
+++ b/meta-agl-core/classes/sanity-meta-agl-core.bbclass
@@ -0,0 +1,10 @@
+addhandler aglcore_bbappend_distrocheck
+aglcore_bbappend_distrocheck[eventmask] = "bb.event.SanityCheck"
+python aglcore_bbappend_distrocheck() {
+ skip_check = e.data.getVar('SKIP_META_AGL_CORE_SANITY_CHECK') == "1"
+ if 'aglcore' not in e.data.getVar('AGL_FEATURES').split() and not skip_check:
+ bb.warn("You have included the meta-agl-core layer, but \
+'aglcore' has not been enabled in your AGL_FEATURES. Some bbappend files \
+may not take effect. See the meta-agl-core README for details on enabling \
+meta-agl-core support.")
+}