summaryrefslogtreecommitdiff
path: root/meta-openembedded/meta-oe/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-oe/classes')
-rw-r--r--meta-openembedded/meta-oe/classes/dos2unix.bbclass14
-rw-r--r--meta-openembedded/meta-oe/classes/scancode.bbclass35
2 files changed, 35 insertions, 14 deletions
diff --git a/meta-openembedded/meta-oe/classes/dos2unix.bbclass b/meta-openembedded/meta-oe/classes/dos2unix.bbclass
deleted file mode 100644
index 1bad998dd..000000000
--- a/meta-openembedded/meta-oe/classes/dos2unix.bbclass
+++ /dev/null
@@ -1,14 +0,0 @@
-# Class for use to convert all CRLF line terminators to LF
-# provided that some projects are being developed/maintained
-# on Windows so they have different line terminators(CRLF) vs
-# on Linux(LF), which can cause annoying patching errors during
-# git push/checkout processes.
-
-do_convert_crlf_to_lf[depends] += "dos2unix-native:do_populate_sysroot"
-
-# Convert CRLF line terminators to LF
-do_convert_crlf_to_lf () {
- find ${S} -type f -exec dos2unix {} \;
-}
-
-addtask convert_crlf_to_lf after do_unpack before do_patch
diff --git a/meta-openembedded/meta-oe/classes/scancode.bbclass b/meta-openembedded/meta-oe/classes/scancode.bbclass
new file mode 100644
index 000000000..701660f57
--- /dev/null
+++ b/meta-openembedded/meta-oe/classes/scancode.bbclass
@@ -0,0 +1,35 @@
+# We use scancode utlity for extacting licence information.
+# scancode itself is an OSS Utlitity.
+# For more informaiton https://github.com/nexB/scancode-toolkit
+
+SCANCODE_FORMAT ?= "html-app"
+EXT = "${@'html' if d.getVar('SCANCODE_FORMAT', True) == 'html-app' else 'json'}"
+SCANCODE_TOOLKIT = "${@get_scancode_toolkit(d)}"
+SCANCODE_TAG = "v2.2.1"
+SCANCODE_GIT_LOCATION ?= "https://github.com/nexB/scancode-toolkit.git"
+SCANCODE_SRC_LOCATION ?= "${DL_DIR}/scancode"
+
+def get_scancode_toolkit(d):
+ lf = bb.utils.lockfile(d.getVar('SCANCODE_SRC_LOCATION', True) + ".lock")
+ if (not os.path.exists(d.getVar('SCANCODE_SRC_LOCATION', True))):
+ os.system("git clone %s %s -b %s" % (d.getVar('SCANCODE_GIT_LOCATION', True), d.getVar('SCANCODE_SRC_LOCATION', True), d.getVar('SCANCODE_TAG', True)))
+ bb.utils.unlockfile(lf)
+ return (d.getVar('SCANCODE_SRC_LOCATION', True))
+
+do_scancode() {
+ mkdir -p ${DEPLOY_DIR_IMAGE}/scancode
+ cd ${SCANCODE_TOOLKIT}
+ if [ -d "${S}" ]; then
+ ./scancode ${S} --format ${SCANCODE_FORMAT} ${DEPLOY_DIR_IMAGE}/scancode/${PN}.${EXT}
+ fi
+}
+
+addtask scancode after do_patch
+
+do_scancode_oss() {
+ echo "We are done running scancode"
+}
+
+do_scancode_oss[recrdeptask] = "do_scancode_oss do_scancode"
+do_scancode_oss[nostamp] = "1"
+addtask do_scancode_oss after do_scancode