From 59fdcddf05a9aed00b4edd398d6dc82689bfd564 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Sat, 19 Feb 2022 17:59:46 +0100 Subject: [PATCH] bitbake: fetch2/wget: move loop-invariant load of BB_ORIGENV BB_ORIGENV is used as a fallback environment block. It is repeatedly accessed inside the loop. Since it is a loop invariant, move it out of the loop. (Bitbake rev: 346a1a6c76d40458d7b4c116147ec4d371bee74a) Signed-off-by: Zygmunt Krynicki Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/wget.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 253cabce75..2579a65ce6 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -316,12 +316,11 @@ class Wget(FetchMethod): # to scope the changes to the build_opener request, which is when the # environment lookups happen. newenv = {} + origenv = d.getVar("BB_ORIGENV") for name in bb.fetch2.FETCH_EXPORT_VARS: value = d.getVar(name) - if not value: - origenv = d.getVar("BB_ORIGENV") - if origenv: - value = origenv.getVar(name) + if not value and origenv: + value = origenv.getVar(name) if value: newenv[name] = value