After the do_fetch task, every other tasks must not access the network.
In order to ensure this point every npm command must use the '--offline'
argument. In addition, setting an invalid proxy is used as a safety.

Signed-off-by: Jean-Marie LEMETAYER <[email protected]>
---
 meta/classes/npm.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index e2a258afe1..b13dca7eb8 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -97,7 +97,7 @@ npm_do_compile() {
     local NPM_SHRINKWRAP_INSTALLED=$(npm_install_shrinkwrap)
 
     # Then create a tarball from a npm package whose sources must be in ${S}.
-    local NPM_PACK_FILE=$(cd ${WORKDIR} && npm pack ${S}/)
+    local NPM_PACK_FILE=$(cd ${WORKDIR} && npm pack ${S}/ --offline 
--proxy=http://invalid.org)
 
     # Clean source tree.
     rm -f ${NPM_SHRINKWRAP_INSTALLED}
@@ -106,6 +106,8 @@ npm_do_compile() {
     rm -rf ${B}
 
     # Finally install and build the tarball package in ${B}.
+    local NPM_INSTALL_ARGS="${NPM_INSTALL_ARGS} --offline"
+    local NPM_INSTALL_ARGS="${NPM_INSTALL_ARGS} --proxy=http://invalid.org";
     local NPM_INSTALL_ARGS="${NPM_INSTALL_ARGS} --cache=${NPM_CACHE_DIR}"
     local NPM_INSTALL_ARGS="${NPM_INSTALL_ARGS} --loglevel=silly"
     local NPM_INSTALL_ARGS="${NPM_INSTALL_ARGS} --prefix=${B}"
-- 
2.20.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to