]> code.ossystems Code Review - openembedded-core.git/commitdiff
npm.bbclass: Stop packagenames containing underscores from being generated
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 12 Apr 2016 09:58:39 +0000 (10:58 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Apr 2016 09:58:27 +0000 (10:58 +0100)
Package names cannot contain underscores yet some npm modules use them as part
of the name, replace them with hyphens in the package name.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/npm.bbclass
meta/lib/oe/package.py

index 33ff5e3f45b11f4c8d95a760e6fe2c21634e71f4..9843e87350aa7d079e2bc32cca36408e3367fb5d 100644 (file)
@@ -28,7 +28,9 @@ python populate_packages_prepend () {
     for pkgname in pkgnames:
         pkgrelpath, pdata = extrapackages[pkgname]
         pkgpath = '${libdir}/node_modules/${PN}/' + pkgrelpath
-        expanded_pkgname = d.expand(pkgname)
+        # package names can't have underscores but npm packages sometimes use them
+        oe_pkg_name = pkgname.replace('_', '-')
+        expanded_pkgname = d.expand(oe_pkg_name)
         d.setVar('FILES_%s' % expanded_pkgname, pkgpath)
         if pdata:
             version = pdata.get('version', None)
@@ -37,7 +39,7 @@ python populate_packages_prepend () {
             description = pdata.get('description', None)
             if description:
                 d.setVar('SUMMARY_%s' % expanded_pkgname, description.replace(u"\u2018", "'").replace(u"\u2019", "'").encode("utf8"))
-    d.appendVar('RDEPENDS_%s' % d.getVar('PN', True), ' %s' % ' '.join(pkgnames))
+    d.appendVar('RDEPENDS_%s' % d.getVar('PN', True), ' %s' % ' '.join(pkgnames).replace('_', '-'))
 }
 
 FILES_${PN} += " \
index dea443d658401c18ec0c63f4f069df10684a3326..2887689541e0dc125db5c9ee307fc0760206e6e6 100644 (file)
@@ -143,7 +143,7 @@ def npm_split_package_dirs(pkgdir):
                     if pathitem == 'node_modules':
                         continue
                     pkgitems.append(pathitem)
-                pkgname = '-'.join(pkgitems)
+                pkgname = '-'.join(pkgitems).replace('_', '-')
                 pkgfile = os.path.join(root, dn, 'package.json')
                 data = None
                 if os.path.exists(pkgfile):