Patchwork [4/4] base.bbclass: fix substring matching in COMMERCIAL_LICENSE

login
register
mail settings
Submitter Paul Eggleton
Date Sept. 7, 2011, 4:05 p.m.
Message ID <0c4d59106cfe15e76b9e419798feb90c7b1bf15b.1315411460.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/11193/
State New, archived
Headers show

Comments

Paul Eggleton - Sept. 7, 2011, 4:05 p.m.
Previously, if for example you had a package called "mx", and a second
package called "libomxil" listed in COMMERCIAL_LICENSE (without mx being
listed there), it would match mx as being commercially licensed because
mx is a substring of libomxil. Fix the search to ensure it only matches
the listed package name exactly.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/base.bbclass |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 3501f4b..104bec8 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -340,9 +340,9 @@  python () {
     if license == "INVALID":
         bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
 
-    commercial_license = bb.data.getVar('COMMERCIAL_LICENSE', d, 1)
+    commercial_license = " %s " % bb.data.getVar('COMMERCIAL_LICENSE', d, 1)
     import re
-    pnr = pn.replace('+', "\+")
+    pnr = "[ \t]%s[ \t]" % pn.replace('+', "\+")
     if commercial_license and re.search(pnr, commercial_license):
         bb.debug(1, "Skipping %s because it's commercially licensed" % pn)
         raise bb.parse.SkipPackage("because it may require a commercial license to ship in a product (listed in COMMERCIAL_LICENSE)")