[OE-core] [PATCH v3 15/17] devtool/standard.py: npm: configure the NPM_CACHE_DIR to be persistent

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


When using devtool the ${WORKDIR} is not persistent as the creation
workflow is using temporary directories and external workspace. For npm
recipes the NPM_CACHE_DIR needs to be persistent to make the link
between the first do_fetch, do_unpack tasks and the do_compile task.

As the only persistent directory is the source directory, it is used to
store the npm cache. And it is also excluded from the git repository to
allow the 'devtool finish' command to succeed.

Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer at savoirfairelinux.com>
---
 scripts/lib/devtool/standard.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 31f0c44b20..1e68d37db9 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -262,6 +262,7 @@ def add(args, config, basepath, workspace):
                 f.write('}\n')
 
             if bb.data.inherits_class('npm', rd):
+                f.write('NPM_CACHE_DIR = "${S}/.npm_cache"\n')
                 f.write('exclude_git() {\n')
                 f.write('    local exclude="${S}/.git/info/exclude"\n')
                 f.write('    if [ -f "${exclude}" ] && ! grep -q "${1}" "${exclude}" ; then\n')
@@ -269,6 +270,7 @@ def add(args, config, basepath, workspace):
                 f.write('    fi\n')
                 f.write('}\n')
                 f.write('do_compile_append() {\n')
+                f.write('    exclude_git "/.npm_cache"\n')
                 f.write('    exclude_git "/node_modules"\n')
                 f.write('    rm -rf ${B}/lib/node_modules/*/.git\n')
                 f.write('    rm -rf ${B}/lib/node_modules/@*/*/.git\n')
-- 
2.20.1



More information about the Openembedded-core mailing list