Skip to contentSkip to conversation

Constantin Musca : insane.bbclass: add qa package name check

oe-commits Andrei Gherzan 1 participant 1 message Nov 14, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20121114145142.752ED10340@opal

#1 lore raw
Quoted 39 lines · On Wed, Nov 14, 2012 at 4:51 PM, <[email protected]> wrote:

Module: openembedded-core.git
Branch: master-next
Commit: da8cdf4c170314b6c317a69cc0a6c22730c9ff13
URL:
http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=da8cdf4c170314b6c317a69cc0a6c22730c9ff13

Author: Constantin Musca <[email protected]>
Date:   Tue Nov 13 17:51:00 2012 +0200

insane.bbclass: add qa package name check

Check if package names match the [a-z0-9.+-]+ regular expression

[YOCTO #3139]

---

 meta/classes/insane.bbclass |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
meta/classes/insane.bbclass +3 -0
index 34bcd98..237ee82 100644
@@ -781,6 +781,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

meta/classes/insane.bbclass python do_package_qa () { · line 815

Quoted 9 lines
meta/classes/insane.bbclass +5 -0
@@ -804,6 +807,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)
+

Maybe we should do this check only in ipk builds?

ag