[oe-commits] [openembedded-core] 09/23: npm.bbclass: Stop packagenames containing underscores from being generated

git at git.openembedded.org git at git.openembedded.org
Thu Apr 14 09:59:15 UTC 2016


rpurdie pushed a commit to branch krogoth
in repository openembedded-core.

commit fea932c79c8201e3e7649f4443874ea540e33461
Author: Brendan Le Foll <brendan.le.foll at intel.com>
AuthorDate: Tue Apr 12 10:58:39 2016 +0100

    npm.bbclass: Stop packagenames containing underscores from being generated
    
    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 at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/npm.bbclass | 6 ++++--
 meta/lib/oe/package.py   | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 33ff5e3..9843e87 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -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} += " \
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index dea443d..2887689 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -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):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list