diff mbox series

[4/6] support/testing: runtest proxy support

Message ID 20180711143113.11927-5-matthew.weber@rockwellcollins.com
State Accepted
Headers show
Series None | expand

Commit Message

Matt Weber July 11, 2018, 2:31 p.m. UTC
Allow builder.py to inherit the system proxy settings from
the env if they are present.

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 support/testing/infra/builder.py | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Arnout Vandecappelle July 11, 2018, 9:47 p.m. UTC | #1
On 11-07-18 16:31, Matt Weber wrote:
> Allow builder.py to inherit the system proxy settings from
> the env if they are present.
> 
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> ---
>  support/testing/infra/builder.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
> index faf1eb1494..30230fdb17 100644
> --- a/support/testing/infra/builder.py
> +++ b/support/testing/infra/builder.py
> @@ -35,6 +35,12 @@ class Builder(object):
>  
>      def build(self):
>          env = {"PATH": os.environ["PATH"]}
> +        if "http_proxy" in os.environ:
> +            self.logfile.write("Using system proxy: " +
> +                               os.environ["http_proxy"] + "\n")
> +            self.logfile.flush()
> +            env['http_proxy'] = os.environ["http_proxy"]
> +            env['https_proxy'] = os.environ["http_proxy"]

 I'm not sure if we wouldn't want to propagate the possibly different
https_proxy variable instead, but in practice I see little use of that, so

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

>          cmd = ["make", "-C", self.builddir]
>          ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
>                                env=env)
>
Thomas Petazzoni Aug. 10, 2018, 8:51 p.m. UTC | #2
Hello,

On Wed, 11 Jul 2018 09:31:11 -0500, Matt Weber wrote:
> Allow builder.py to inherit the system proxy settings from
> the env if they are present.
> 
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>

I have applied to next, but I have one question below.

> ---
>  support/testing/infra/builder.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
> index faf1eb1494..30230fdb17 100644
> --- a/support/testing/infra/builder.py
> +++ b/support/testing/infra/builder.py
> @@ -35,6 +35,12 @@ class Builder(object):
>  
>      def build(self):
>          env = {"PATH": os.environ["PATH"]}
> +        if "http_proxy" in os.environ:
> +            self.logfile.write("Using system proxy: " +
> +                               os.environ["http_proxy"] + "\n")
> +            self.logfile.flush()

Is this flush() really needed ?

Best regards,

Thomas
Matt Weber Aug. 11, 2018, 12:30 a.m. UTC | #3
Thomas,

On Fri, Aug 10, 2018 at 3:51 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Wed, 11 Jul 2018 09:31:11 -0500, Matt Weber wrote:
> > Allow builder.py to inherit the system proxy settings from
> > the env if they are present.
> >
> > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
>
> I have applied to next, but I have one question below.
>
> > ---
> >  support/testing/infra/builder.py | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
> > index faf1eb1494..30230fdb17 100644
> > --- a/support/testing/infra/builder.py
> > +++ b/support/testing/infra/builder.py
> > @@ -35,6 +35,12 @@ class Builder(object):
> >
> >      def build(self):
> >          env = {"PATH": os.environ["PATH"]}
> > +        if "http_proxy" in os.environ:
> > +            self.logfile.write("Using system proxy: " +
> > +                               os.environ["http_proxy"] + "\n")
> > +            self.logfile.flush()
>
> Is this flush() really needed ?

I had added it because my subprocess.call() in python was failing and
at that time I believed the proxy logfile write wasn't flushing.  It
could probably be removed now as it was an artifact of debugging.

Matt
Matt Weber Aug. 11, 2018, 1:03 a.m. UTC | #4
Thomas,
On Fri, Aug 10, 2018 at 7:30 PM Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
>
> Thomas,
>
> On Fri, Aug 10, 2018 at 3:51 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > Hello,
> >
> > On Wed, 11 Jul 2018 09:31:11 -0500, Matt Weber wrote:
> > > Allow builder.py to inherit the system proxy settings from
> > > the env if they are present.
> > >
> > > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> >
> > I have applied to next, but I have one question below.
> >
> > > ---
> > >  support/testing/infra/builder.py | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
> > > index faf1eb1494..30230fdb17 100644
> > > --- a/support/testing/infra/builder.py
> > > +++ b/support/testing/infra/builder.py
> > > @@ -35,6 +35,12 @@ class Builder(object):
> > >
> > >      def build(self):
> > >          env = {"PATH": os.environ["PATH"]}
> > > +        if "http_proxy" in os.environ:
> > > +            self.logfile.write("Using system proxy: " +
> > > +                               os.environ["http_proxy"] + "\n")
> > > +            self.logfile.flush()
> >
> > Is this flush() really needed ?
>
> I had added it because my subprocess.call() in python was failing and
> at that time I believed the proxy logfile write wasn't flushing.  It
> could probably be removed now as it was an artifact of debugging.
>
> Matt

https://patchwork.ozlabs.org/patch/956512/
diff mbox series

Patch

diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
index faf1eb1494..30230fdb17 100644
--- a/support/testing/infra/builder.py
+++ b/support/testing/infra/builder.py
@@ -35,6 +35,12 @@  class Builder(object):
 
     def build(self):
         env = {"PATH": os.environ["PATH"]}
+        if "http_proxy" in os.environ:
+            self.logfile.write("Using system proxy: " +
+                               os.environ["http_proxy"] + "\n")
+            self.logfile.flush()
+            env['http_proxy'] = os.environ["http_proxy"]
+            env['https_proxy'] = os.environ["http_proxy"]
         cmd = ["make", "-C", self.builddir]
         ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
                               env=env)