bitbake: toaster: checksettings: fix TEMPLATECONF detection

Improving the TEMPLATECONF detection by verifying the return
code and dumping extra debug information in case of exception.

(Bitbake rev: bdc00755993aa37e7669c3859ef4ea9b1fc3e680)

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN
2015-08-18 17:28:49 +01:00
committed by Richard Purdie
parent 3a1af07177
commit 99730d64d4

View File

@@ -166,7 +166,12 @@ class Command(NoArgsCommand):
for dirname in self._recursive_list_directories(be.sourcedir,2):
if os.path.exists(os.path.join(dirname, ".templateconf")):
import subprocess
conffilepath, error = subprocess.Popen('bash -c ". '+os.path.join(dirname, ".templateconf")+'; echo \"\$TEMPLATECONF\""', shell=True, stdout=subprocess.PIPE).communicate()
proc = subprocess.Popen('bash -c ". '+os.path.join(dirname, ".templateconf")+'; echo \"\$TEMPLATECONF\""', shell=True, stdout=subprocess.PIPE)
conffilepath, stderroroutput = proc.communicate()
proc.wait()
if proc.returncode != 0:
raise Exception("Failed to source TEMPLATECONF: %s" % stderroroutput)
conffilepath = os.path.join(conffilepath.strip(), "toasterconf.json")
candidatefilepath = os.path.join(dirname, conffilepath)
if "toaster_cloned" in candidatefilepath:
@@ -195,6 +200,7 @@ class Command(NoArgsCommand):
return is_changed
except Exception as e:
print "Failure while trying to import the toaster config file: %s" % e
traceback.print_exc(e)
else:
print "\n Toaster could not find a configuration file. You need to configure Toaster manually using the web interface, or create a configuration file and use\n bitbake/lib/toaster/managepy.py loadconf [filename]\n command to load it. You can use https://wiki.yoctoproject.org/wiki/File:Toasterconf.json.txt.patch as a starting point."