All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] npm.bbclass: introduce NPM_PXORY
@ 2019-01-09 17:24 liu.ming50
  2019-01-09 17:27 ` Alexander Kanavin
  0 siblings, 1 reply; 3+ messages in thread
From: liu.ming50 @ 2019-01-09 17:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

This is needed to support building npm packages under environment with
proxy setting.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/npm.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 6dbae6b..0f37f30 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -24,6 +24,9 @@ def npm_oe_arch_map(target_arch, d):
 NPM_ARCH ?= "${@npm_oe_arch_map(d.getVar('TARGET_ARCH'), d)}"
 NPM_INSTALL_DEV ?= "0"
 
+# Format: http://proxyhost:proxyport
+NPM_PROXY ?= ""
+
 npm_do_compile() {
 	# Copy in any additionally fetched modules
 	if [ -d ${WORKDIR}/node_modules ] ; then
@@ -32,6 +35,13 @@ npm_do_compile() {
 	# changing the home directory to the working directory, the .npmrc will
 	# be created in this directory
 	export HOME=${WORKDIR}
+	if [ -n "${NPM_PROXY}" ]; then
+		npm config set proxy ${NPM_PROXY}
+		npm config set https-proxy ${NPM_PROXY}
+	else
+		npm config set proxy null
+		npm config set https-proxy null
+	fi
 	if [  "${NPM_INSTALL_DEV}" = "1" ]; then
 		npm config set dev true
 	else
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] npm.bbclass: introduce NPM_PXORY
  2019-01-09 17:24 [PATCH] npm.bbclass: introduce NPM_PXORY liu.ming50
@ 2019-01-09 17:27 ` Alexander Kanavin
  2019-01-09 17:32   ` Burton, Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kanavin @ 2019-01-09 17:27 UTC (permalink / raw)
  To: liu.ming50; +Cc: OE-core

On Wed, 9 Jan 2019 at 18:24, <liu.ming50@gmail.com> wrote:

> +       if [ -n "${NPM_PROXY}" ]; then
> +               npm config set proxy ${NPM_PROXY}
> +               npm config set https-proxy ${NPM_PROXY}
> +       else
> +               npm config set proxy null
> +               npm config set https-proxy null
> +       fi

Isn't it better to set those from http[s]_proxy environment variables
which are standard?

Alex


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] npm.bbclass: introduce NPM_PXORY
  2019-01-09 17:27 ` Alexander Kanavin
@ 2019-01-09 17:32   ` Burton, Ross
  0 siblings, 0 replies; 3+ messages in thread
From: Burton, Ross @ 2019-01-09 17:32 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core, Ming Liu

On Wed, 9 Jan 2019 at 17:28, Alexander Kanavin <alex.kanavin@gmail.com> wrote:
> > +       if [ -n "${NPM_PROXY}" ]; then
> > +               npm config set proxy ${NPM_PROXY}
> > +               npm config set https-proxy ${NPM_PROXY}
> > +       else
> > +               npm config set proxy null
> > +               npm config set https-proxy null
> > +       fi
>
> Isn't it better to set those from http[s]_proxy environment variables
> which are standard?

Please, unless there's a very good reason lets use the proxy variables
that we already export to various other bits of the system.

If npm will respect http_proxy in the environment, then just use
bb.utils.export_proxies.

Ross


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-09 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 17:24 [PATCH] npm.bbclass: introduce NPM_PXORY liu.ming50
2019-01-09 17:27 ` Alexander Kanavin
2019-01-09 17:32   ` Burton, Ross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.