Skip to contentSkip to conversation

fetch2/wget: Drop unused import

PATCH New Richard Purdie 1 participant 2 messages Feb 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fetch2/wget: Drop unused import

This import is no longer used anywhere so can be removed.

---
 lib/bb/fetch2/wget.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/fetch2/wget.py +0 -1
index 6d365729e0..859b4f99e2 100644
@@ -26,7 +26,6 @@ from   bb.fetch2 import FetchMethod
 from   bb.fetch2 import FetchError
 from   bb.fetch2 import logger
 from   bb.fetch2 import runfetchcmd
-from   bb.utils import export_proxies
 from   bs4 import BeautifulSoup
 from   bs4 import SoupStrainer
 
Signature · 1 line
2.37.2
#1 lore raw

PATCH 2/2 utils: Use internal fetcher function to avoid duplication

We currently have two lists of "proxy" or "fetcher" environment exports. Make the one in utils match the one on the fetcher which has a more complete list of variables now.

---
 lib/bb/utils.py | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
lib/bb/utils.py +4 -15
index 4446997e42..0624a4f3e9 100644
@@ -1698,22 +1698,11 @@ def disable_network(uid=None, gid=None):
         f.write("%s %s 1" % (gid, gid))
 
 def export_proxies(d):
+    from bb.fetch2 import get_fetcher_environment
     """ export common proxies variables from datastore to environment """
-
-    variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
-                    'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY',
-                    'GIT_PROXY_COMMAND', 'SSL_CERT_FILE', 'SSL_CERT_DIR']
-
-    origenv = d.getVar("BB_ORIGENV")
-
-    for name in variables:
-        value = d.getVar(name)
-        if not value and origenv:
-            value = origenv.getVar(name)
-        if value:
-            os.environ[name] = value
-
-
+    newenv = get_fetcher_environment(d)
+    for v in newenv:
+        os.environ[v] = newenv[v]
 
 def load_plugins(logger, plugins, pluginpath):
     def load_plugin(name):
Signature · 1 line
2.37.2