[OE-core] [PATCH v3 08/17] npm.bbclass: split the do_compile task

Jean-Marie LEMETAYER jean-marie.lemetayer at savoirfairelinux.com
Wed Nov 20 09:33:49 UTC 2019


The do_compile task must be split in order to fit the yocto workflow.
The dependencies are fetched in the do_fetch task and cached in the
do_unpack task.

Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer at savoirfairelinux.com>
---
 meta/classes/npm.bbclass | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index b3f73d9b67..e2a258afe1 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -48,6 +48,25 @@ NPM_CACHE_DIR ?= "${WORKDIR}/npm_cache"
 
 B = "${WORKDIR}/build"
 
+python do_fetch_append() {
+    """
+        Fetch all dependencies tarball to DL_DIR.
+    """
+    bb.fetch2.npm.fetch_dependencies(d)
+}
+
+python do_unpack_append() {
+    """
+        Unpack all dependencies tarball to the 'node_modules' directory and add
+        them to the npm cache. The dependencies needs to be unpacked to have
+        access to the licenses files checksum feature (LIC_FILES_CHKSUM). They
+        also have to be in the cache to properly execute the 'npm install'.
+    """
+    bb.fetch2.npm.unpack_dependencies(d)
+}
+
+do_unpack[depends] = "nodejs-native:do_populate_sysroot"
+
 npm_install_shrinkwrap() {
     # This function ensures that there is a shrinkwrap file in the specified
     # directory. A shrinkwrap file is mandatory to have reproducible builds.
-- 
2.20.1



More information about the Openembedded-core mailing list