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/agl-core-image.bbclass32
-rw-r--r--meta-agl-core/classes/agl-crosssdk.bbclass9
-rw-r--r--meta-agl-core/classes/cloc.bbclass33
-rw-r--r--meta-agl-core/classes/image_types_wic_workaround.bbclass32
-rw-r--r--meta-agl-core/classes/sanity-meta-agl-core.bbclass10
5 files changed, 116 insertions, 0 deletions
diff --git a/meta-agl-core/classes/agl-core-image.bbclass b/meta-agl-core/classes/agl-core-image.bbclass
new file mode 100644
index 000000000..bb5580391
--- /dev/null
+++ b/meta-agl-core/classes/agl-core-image.bbclass
@@ -0,0 +1,32 @@
+# AGL base image class
+#
+# As opposed to using core-image directly, this class:
+# - does not pull in packagegroup-base-extended by default to minimize images.
+# This does mean that many of the oe-core / poky MACHINE and DISTRO features
+# (e.g. 3g, nfs, etc.) will not result in packages being automatically pulled
+# into images since that is driven via packagegroup-base.
+# - includes hooks for integrating SELinux via meta-selinux
+# - disables locale installation by default
+#
+
+# Disable locales
+IMAGE_LINGUAS = ""
+
+# Hook to allow inheriting e.g. selinux-image by default.
+# Any bbclass used as a value should ultimately inherit core-image
+AGL_BASE_IMAGE ?= "core-image"
+
+inherit ${AGL_BASE_IMAGE}
+
+FEATURE_PACKAGES_selinux = " \
+ packagegroup-agl-core-selinux \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'packagegroup-agl-core-selinux-devel', '', d)} \
+"
+
+IMAGE_FEATURES:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
+
+CORE_IMAGE_BASE_INSTALL = " \
+ packagegroup-agl-core-boot \
+ \
+ ${CORE_IMAGE_EXTRA_INSTALL} \
+"
diff --git a/meta-agl-core/classes/agl-crosssdk.bbclass b/meta-agl-core/classes/agl-crosssdk.bbclass
new file mode 100644
index 000000000..5f6dbf303
--- /dev/null
+++ b/meta-agl-core/classes/agl-crosssdk.bbclass
@@ -0,0 +1,9 @@
+IMAGE_FEATURES += "dev-pkgs"
+IMAGE_INSTALL += "kernel-dev kernel-devsrc"
+
+inherit populate_sdk
+
+# Task do_populate_sdk and do_rootfs can't be exec simultaneously.
+# Both exec "createrepo" on the same directory, and so one of them
+# can failed (randomly).
+addtask do_populate_sdk after do_rootfs
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/image_types_wic_workaround.bbclass b/meta-agl-core/classes/image_types_wic_workaround.bbclass
new file mode 100644
index 000000000..1a287ff7c
--- /dev/null
+++ b/meta-agl-core/classes/image_types_wic_workaround.bbclass
@@ -0,0 +1,32 @@
+# This is a workaround for the race condition between do_image_wic and other
+# do_image_* tasks. It ensures that no other do_image_* task can be running and
+# reading the rootfs directory at the same time as do_image_wic is modifying
+# the /etc/fstab file in the rootfs directory.
+#
+# A much better fix has been submitted upstream [1], but we can't carry those
+# modifications to `scripts/lib/wic` from poky easily in meta-agl. So instead
+# we have this workaround until the upstream fix is accepted and backported.
+#
+# Serializing the image functions as done here impacts build speed but it's
+# better to be slow and correct than to be fast and wrong.
+#
+# [1]: https://lists.openembedded.org/g/openembedded-core/topic/patch_5_6_wic_copy_rootfs/79592787,
+# https://lists.openembedded.org/g/openembedded-core/topic/patch_6_6_wic_optimise/79592788
+# and related patches.
+#
+# Bug-AGL: SPEC-3621
+
+def get_workaround_wic_typedeps(d):
+ if d.getVar('USING_WIC'):
+ fstypes = d.getVar('IMAGE_FSTYPES').split()
+ basetypes = set()
+ for fs in fstypes:
+ # Add the basetype to our set of basetypes in use
+ t = fs.split('.')[0]
+ if t != "wic":
+ basetypes.add(t)
+ return ' '.join(basetypes)
+ else:
+ return ''
+
+IMAGE_TYPEDEP:wic += "${@get_workaround_wic_typedeps(d)}"
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.")
+}