mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 21:49:33 +02:00
bitbake: fetch2: Abstract fetcher environment to a function
The changing of the environment inside the wget fetcher can race if threading is used, such as with sstate in OE-Core. Abstract the function so the environment can be correct before the function is called, removing the race since the enviroment is then no longer changed. (Bitbake rev: c73bb6023c73f003a160bb02aa4da1b580b86c23) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -851,6 +851,17 @@ FETCH_EXPORT_VARS = ['HOME', 'PATH',
|
|||||||
'AWS_SECRET_ACCESS_KEY',
|
'AWS_SECRET_ACCESS_KEY',
|
||||||
'AWS_DEFAULT_REGION']
|
'AWS_DEFAULT_REGION']
|
||||||
|
|
||||||
|
def get_fetcher_environment(d):
|
||||||
|
newenv = {}
|
||||||
|
origenv = d.getVar("BB_ORIGENV")
|
||||||
|
for name in bb.fetch2.FETCH_EXPORT_VARS:
|
||||||
|
value = d.getVar(name)
|
||||||
|
if not value and origenv:
|
||||||
|
value = origenv.getVar(name)
|
||||||
|
if value:
|
||||||
|
newenv[name] = value
|
||||||
|
return newenv
|
||||||
|
|
||||||
def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None):
|
def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None):
|
||||||
"""
|
"""
|
||||||
Run cmd returning the command output
|
Run cmd returning the command output
|
||||||
|
|||||||
@@ -315,14 +315,7 @@ class Wget(FetchMethod):
|
|||||||
# Avoid tramping the environment too much by using bb.utils.environment
|
# Avoid tramping the environment too much by using bb.utils.environment
|
||||||
# to scope the changes to the build_opener request, which is when the
|
# to scope the changes to the build_opener request, which is when the
|
||||||
# environment lookups happen.
|
# environment lookups happen.
|
||||||
newenv = {}
|
newenv = bb.fetch2.get_fetcher_environment(d)
|
||||||
origenv = d.getVar("BB_ORIGENV")
|
|
||||||
for name in bb.fetch2.FETCH_EXPORT_VARS:
|
|
||||||
value = d.getVar(name)
|
|
||||||
if not value and origenv:
|
|
||||||
value = origenv.getVar(name)
|
|
||||||
if value:
|
|
||||||
newenv[name] = value
|
|
||||||
|
|
||||||
with bb.utils.environment(**newenv):
|
with bb.utils.environment(**newenv):
|
||||||
import ssl
|
import ssl
|
||||||
|
|||||||
Reference in New Issue
Block a user