[OE-core] [PATCH v3 11/17] npm.bbclass: restrict the build to be offline
Jean-Marie LEMETAYER
jean-marie.lemetayer at savoirfairelinux.com
Wed Nov 20 09:33:52 UTC 2019
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 <jean-marie.lemetayer at savoirfairelinux.com>
---
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
More information about the Openembedded-core
mailing list