diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-19 17:57:10 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-20 16:45:25 +0000 |
commit | 8e71d0e21b7bdcdfaf1db514708e345987cca7a3 (patch) | |
tree | 8f4d4e421ab3b915a46a46638c574c9fabf8722f /bitbake/lib/bb | |
parent | 2b427b9224673ad1a5a39a4b72390f1efa972a4b (diff) | |
download | poky-8e71d0e21b7bdcdfaf1db514708e345987cca7a3.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 9 |
2 files changed, 12 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index a7e84e0dc7..35fae6623a 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -851,6 +851,17 @@ FETCH_EXPORT_VARS = ['HOME', 'PATH', | |||
851 | 'AWS_SECRET_ACCESS_KEY', | 851 | 'AWS_SECRET_ACCESS_KEY', |
852 | 'AWS_DEFAULT_REGION'] | 852 | 'AWS_DEFAULT_REGION'] |
853 | 853 | ||
854 | def get_fetcher_environment(d): | ||
855 | newenv = {} | ||
856 | origenv = d.getVar("BB_ORIGENV") | ||
857 | for name in bb.fetch2.FETCH_EXPORT_VARS: | ||
858 | value = d.getVar(name) | ||
859 | if not value and origenv: | ||
860 | value = origenv.getVar(name) | ||
861 | if value: | ||
862 | newenv[name] = value | ||
863 | return newenv | ||
864 | |||
854 | def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None): | 865 | def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None): |
855 | """ | 866 | """ |
856 | Run cmd returning the command output | 867 | Run cmd returning the command output |
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 92cc10785c..b3a3de571a 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -315,14 +315,7 @@ class Wget(FetchMethod): | |||
315 | # Avoid tramping the environment too much by using bb.utils.environment | 315 | # Avoid tramping the environment too much by using bb.utils.environment |
316 | # to scope the changes to the build_opener request, which is when the | 316 | # to scope the changes to the build_opener request, which is when the |
317 | # environment lookups happen. | 317 | # environment lookups happen. |
318 | newenv = {} | 318 | newenv = bb.fetch2.get_fetcher_environment(d) |
319 | origenv = d.getVar("BB_ORIGENV") | ||
320 | for name in bb.fetch2.FETCH_EXPORT_VARS: | ||
321 | value = d.getVar(name) | ||
322 | if not value and origenv: | ||
323 | value = origenv.getVar(name) | ||
324 | if value: | ||
325 | newenv[name] = value | ||
326 | 319 | ||
327 | with bb.utils.environment(**newenv): | 320 | with bb.utils.environment(**newenv): |
328 | import ssl | 321 | import ssl |