<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>11638</bug_id>
          
          <creation_ts>2017-06-09 07:07:53 +0000</creation_ts>
          <short_desc>http_proxy does not work during python build stage</short_desc>
          <delta_ts>2017-06-16 14:40:22 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chanho Park">parkch98</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>jku</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>73931</commentid>
    <comment_count>0</comment_count>
    <who name="Chanho Park">parkch98</who>
    <bug_when>2017-06-09 07:07:53 +0000</bug_when>
    <thetext>All environment variables are empty during build stage. The http_proxy, https_proxy are also empty so some python build does not work inside proxy.

For example, &quot;python3-chardet&quot; is not compiled inside proxy environment.
Below workaround can resolve the issue but I&apos;m not sure whether it is okay.

diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 077fddc0eeed..d4e38d5708d3 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -641,9 +641,10 @@ def empty_environment():
     &quot;&quot;&quot;
     Remove all variables from the environment.
     &quot;&quot;&quot;
-    for s in list(os.environ.keys()):
-        os.unsetenv(s)
-        del os.environ[s]
+    if &apos;BB_PRESERVE_ENV&apos; not in os.environ:
+        for s in list(os.environ.keys()):
+            os.unsetenv(s)
+            del os.environ[s]
 
 def build_environment(d):
     &quot;&quot;&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73976</commentid>
    <comment_count>1</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2017-06-12 08:04:14 +0000</bug_when>
    <thetext>Wouldn&apos;t this be a bug in python3-chardet? Why does it need a proxy during build?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73997</commentid>
    <comment_count>2</comment_count>
    <who name="Chanho Park">parkch98</who>
    <bug_when>2017-06-12 16:26:07 +0000</bug_when>
    <thetext>Hi, it&apos;s not a python3-chardet bug.
For fetch stage, the http_proxy/https_proxy/no_proxy are kept but they have gone in the   build stage.
Many of the companies use the proxy server for caching purpose and I have to use the proxy configuration for in-house network configurations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74040</commentid>
    <comment_count>3</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2017-06-13 07:58:22 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Hi, it&apos;s not a python3-chardet bug.
&gt; For fetch stage, the http_proxy/https_proxy/no_proxy are kept but they have
&gt; gone in the   build stage.
&gt; Many of the companies use the proxy server for caching purpose and I have to
&gt; use the proxy configuration for in-house network configurations.

Sure. The question is: why does python3-chardet need network access _after_ fetch? In my opinion it should not -- all required resources should be downloaded during fetch. This still seems like a recipe issue to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74205</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-06-15 14:35:52 +0000</bug_when>
    <thetext>I agree with Jussi, network access should not be happening outside of do_fetch. If it does, the manifests and other tools which handle source scanning are incomplete and don&apos;t have access to valid data.

This is therefore not a bug. If python3-chardet needs data from the network, it needs to get this in do_fetch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74286</commentid>
    <comment_count>5</comment_count>
    <who name="Chanho Park">parkch98</who>
    <bug_when>2017-06-16 14:40:22 +0000</bug_when>
    <thetext>Hmm. I also agree we have to download the source during the fetch phase.
However, Someone will assume BB_PRESERVE_ENV will keep the environments all of the stage. I found the openobex 1.7.2 version also has same problem. It fetch the xml file during cmake build.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>