[oe-commits] Phil Blundell : insane, license: Trap MalformedUrl exceptions when parsing LIC_FILES_CHKSUM
git at git.openembedded.org
git at git.openembedded.org
Tue Nov 12 16:09:29 UTC 2013
Module: openembedded-core.git
Branch: master
Commit: ef35e164c62d89806367b822e3baeff482ec237f
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=ef35e164c62d89806367b822e3baeff482ec237f
Author: Phil Blundell <pb at pbcl.net>
Date: Tue Nov 12 13:29:24 2013 +0000
insane, license: Trap MalformedUrl exceptions when parsing LIC_FILES_CHKSUM
bb.fetch.decodeurl() will throw if it doesn't like the look of the URL that
it's given. (Bitbake's idea of what constitutes a valid URL is somewhat
idiosyncratic so it is fairly easy to trip over this by mistake when writing
a recipe.)
If these exceptions are allowed to propagate all the way up to better_exec()
then we will get a large amount of python stack trace spew when they are
finally caught. Avoid that by catching them locally and throwing
bb.build.FuncFailed() with a suitable explanation instead.
Signed-off-by: Phil Blundell <philb at gnu.org>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/insane.bbclass | 5 ++++-
meta/classes/license.bbclass | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index eb440c2..3558dee 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -594,7 +594,10 @@ def package_qa_check_license(workdir, d):
srcdir = d.getVar('S', True)
for url in lic_files.split():
- (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
+ try:
+ (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
+ except bb.fetch.MalformedUrl:
+ raise bb.build.FuncFailed( pn + ": LIC_FILES_CHKSUM contains an invalid URL: " + url)
srclicfile = os.path.join(srcdir, path)
if not os.path.isfile(srclicfile):
raise bb.build.FuncFailed( pn + ": LIC_FILES_CHKSUM points to an invalid file: " + srclicfile)
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 6abdae4..1c1b679 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -228,7 +228,10 @@ def find_license_files(d):
return lic_files_paths
for url in lic_files.split():
- (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
+ try:
+ (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
+ except bb.fetch.MalformedUrl:
+ raise bb.build.FuncFailed("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF', True), url))
# We want the license filename and path
srclicfile = os.path.join(srcdir, path)
lic_files_paths.append((os.path.basename(path), srclicfile))
More information about the Openembedded-commits
mailing list