Skip to contentSkip to conversation

oeqa/devtool: Avoid unbound variable errors

PATCH New Richard Purdie 1 participant 2 messages Nov 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 oeqa/devtool: Avoid unbound variable errors

inherits can be unset resulting in:

UnboundLocalError: local variable 'inherits' referenced before assignment

which can mask real errors. Avoid this.

---
 meta/lib/oeqa/selftest/cases/devtool.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/devtool.py +2 -1
index 3a25da2033b..f4b303bd1c7 100644
@@ -137,6 +137,7 @@ class DevtoolBase(OESelftestTestCase):
         with open(recipefile, 'r') as f:
             invar = None
             invalue = None
+            inherits = set()
             for line in f:
                 var = None
                 if invar:
@@ -158,7 +159,7 @@ class DevtoolBase(OESelftestTestCase):
                         invar = var
                         continue
                 elif line.startswith('inherit '):
-                    inherits = line.split()[1:]
+                    inherits.update(line.split()[1:])
 
                 if var and var in checkvars:
                     needvalue = checkvars.pop(var)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 recipetool/create: Fix to work with reproducible_builds

The extra diretory created by reproducibile_builds was confusing recipetool and hence devtool. Ignore this directory to restore the correct behaviour and allow it to work with the class.

---
 scripts/lib/recipetool/create.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/recipetool/create.py +1 -1
index 1fb6b555301..b5c9f788433 100644
@@ -496,7 +496,7 @@ def create_recipe(args):
             logger.info('Fetch temp directory is %s' % ftmpdir)
 
         dirlist = os.listdir(srctree)
-        filterout = ['git.indirectionsymlink']
+        filterout = ['git.indirectionsymlink', 'source-date-epoch']
         dirlist = [x for x in dirlist if x not in filterout]
         logger.debug('Directory listing (excluding filtered out):\n  %s' % '\n  '.join(dirlist))
         if len(dirlist) == 1:
Signature · 1 line
2.20.1