Patchwork [PATCHv2] insane.bbclass: add qa package name check

login
register
mail settings
Submitter Constantin Musca
Date Nov. 13, 2012, 3:51 p.m.
Message ID <1352821860-2263-1-git-send-email-constantinx.musca@intel.com>
Download mbox | patch
Permalink /patch/38933/
State Accepted
Commit 86204fbc69197ac113a5c8429a6c330bad560cee
Headers show

Comments

Constantin Musca - Nov. 13, 2012, 3:51 p.m.
Check if package names match the [a-z0-9.+-]+ regular
expression

[YOCTO #3139]

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/classes/insane.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 2dc9ba3..57a6efd 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -757,6 +757,9 @@  python do_package_qa () {
         return
 
     testmatrix = d.getVarFlags("QAPATHTEST")
+    import re
+    # The package name matches the [a-z0-9.+-]+ regular expression
+    pkgname_pattern = re.compile("^[a-z0-9.+-]+$")
 
     g = globals()
     walk_sane = True
@@ -780,6 +783,11 @@  python do_package_qa () {
                 errorchecks.append(g[testmatrix[e]])
 
         bb.note("Checking Package: %s" % package)
+        # Check package name
+        if not pkgname_pattern.match(package):
+            package_qa_handle_error("pkgname",
+                    "%s doesn't match the [a-z0-9.+-]+ regex\n" % package, d)
+
         path = "%s/%s" % (pkgdest, package)
         if not package_qa_walk(path, warnchecks, errorchecks, skip, package, d):
             walk_sane  = False