summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-31 11:55:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-01 23:14:01 +0100
commitb731e47eeb3e74d1a53ae88318063f0dd2cdd544 (patch)
tree5c8e1d2d9ac552e81b6b8273fd02a81bc2633bc5 /bitbake
parentfd1a6bad77b008af28291567aa53776c644c3a48 (diff)
downloadpoky-b731e47eeb3e74d1a53ae88318063f0dd2cdd544.tar.gz
bitbake: cooker: Restore sys.path and sys.modules between parses
When memory resident bitbake is active and we re-parse, the old module configuration is present which can lead to strange errors. Reset this when reparsing so the state is consistent. This fixes memory resident bitbake errors. (Bitbake rev: 951942c3c284ec2c62e730e145688033190af9b2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 1359d33f77..0d29aa03a0 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -159,6 +159,9 @@ class BBCooker:
159 for f in featureSet: 159 for f in featureSet:
160 self.featureset.setFeature(f) 160 self.featureset.setFeature(f)
161 161
162 self.orig_syspath = sys.path.copy()
163 self.orig_sysmodules = [*sys.modules]
164
162 self.configuration = bb.cookerdata.CookerConfiguration() 165 self.configuration = bb.cookerdata.CookerConfiguration()
163 166
164 self.idleCallBackRegister = idleCallBackRegister 167 self.idleCallBackRegister = idleCallBackRegister
@@ -350,6 +353,11 @@ class BBCooker:
350 self.state = state.initial 353 self.state = state.initial
351 self.caches_array = [] 354 self.caches_array = []
352 355
356 sys.path = self.orig_syspath.copy()
357 for mod in [*sys.modules]:
358 if mod not in self.orig_sysmodules:
359 del sys.modules[mod]
360
353 # Need to preserve BB_CONSOLELOG over resets 361 # Need to preserve BB_CONSOLELOG over resets
354 consolelog = None 362 consolelog = None
355 if hasattr(self, "data"): 363 if hasattr(self, "data"):