From: Alex Kiernan Date: Sun, 5 May 2019 05:24:27 +0000 (+0100) Subject: recipetool: fix unbound variable when fixed SRCREV can't be found X-Git-Tag: 2019-04.2-warrior~197 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=326188e1e2424bdabe9cf83a8087b5ee046aa7f6;p=openembedded-core.git recipetool: fix unbound variable when fixed SRCREV can't be found If attempting to find a fixed SRCREV fails because the directory doesn't exit, avoid failing with: Traceback (most recent call last): File "/home/vagrant/poky/scripts/recipetool", line 121, in ret = main() File "/home/vagrant/poky/scripts/recipetool", line 110, in main ret = args.func(args) File "/home/vagrant/poky/scripts/lib/recipetool/create.py", line 707, in create_recipe srcrev = stdout.rstrip() UnboundLocalError: local variable 'stdout' referenced before assignment Fixes: 000480c42797 ("recipetool / devtool: set a fixed SRCREV by default when fetching from git") Signed-off-by: Alex Kiernan Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster --- diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 1810c70ae2..dbd74a1ca3 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -704,7 +704,7 @@ def create_recipe(args): if not args.autorev and srcrev == '${AUTOREV}': if os.path.exists(os.path.join(srctree, '.git')): (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) - srcrev = stdout.rstrip() + srcrev = stdout.rstrip() lines_before.append('SRCREV = "%s"' % srcrev) if args.provides: lines_before.append('PROVIDES = "%s"' % args.provides)