summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorBrendan Le Foll <brendan.le.foll@intel.com>2016-04-12 10:58:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-14 10:58:33 +0100
commit69e20cade69af6b7563581a6f03e95667ab09c43 (patch)
tree1bfb85166c5756b92fe94ddcd19cc73be66f767c /meta
parentc3c55478f5d346c65bd6f1e0a188da49e5a1369e (diff)
downloadpoky-69e20cade69af6b7563581a6f03e95667ab09c43.tar.gz
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. (From OE-Core rev: fea932c79c8201e3e7649f4443874ea540e33461) Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/npm.bbclass6
-rw-r--r--meta/lib/oe/package.py2
2 files changed, 5 insertions, 3 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 33ff5e3f45..9843e87350 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -28,7 +28,9 @@ python populate_packages_prepend () {
28 for pkgname in pkgnames: 28 for pkgname in pkgnames:
29 pkgrelpath, pdata = extrapackages[pkgname] 29 pkgrelpath, pdata = extrapackages[pkgname]
30 pkgpath = '${libdir}/node_modules/${PN}/' + pkgrelpath 30 pkgpath = '${libdir}/node_modules/${PN}/' + pkgrelpath
31 expanded_pkgname = d.expand(pkgname) 31 # package names can't have underscores but npm packages sometimes use them
32 oe_pkg_name = pkgname.replace('_', '-')
33 expanded_pkgname = d.expand(oe_pkg_name)
32 d.setVar('FILES_%s' % expanded_pkgname, pkgpath) 34 d.setVar('FILES_%s' % expanded_pkgname, pkgpath)
33 if pdata: 35 if pdata:
34 version = pdata.get('version', None) 36 version = pdata.get('version', None)
@@ -37,7 +39,7 @@ python populate_packages_prepend () {
37 description = pdata.get('description', None) 39 description = pdata.get('description', None)
38 if description: 40 if description:
39 d.setVar('SUMMARY_%s' % expanded_pkgname, description.replace(u"\u2018", "'").replace(u"\u2019", "'").encode("utf8")) 41 d.setVar('SUMMARY_%s' % expanded_pkgname, description.replace(u"\u2018", "'").replace(u"\u2019", "'").encode("utf8"))
40 d.appendVar('RDEPENDS_%s' % d.getVar('PN', True), ' %s' % ' '.join(pkgnames)) 42 d.appendVar('RDEPENDS_%s' % d.getVar('PN', True), ' %s' % ' '.join(pkgnames).replace('_', '-'))
41} 43}
42 44
43FILES_${PN} += " \ 45FILES_${PN} += " \
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index dea443d658..2887689541 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -143,7 +143,7 @@ def npm_split_package_dirs(pkgdir):
143 if pathitem == 'node_modules': 143 if pathitem == 'node_modules':
144 continue 144 continue
145 pkgitems.append(pathitem) 145 pkgitems.append(pathitem)
146 pkgname = '-'.join(pkgitems) 146 pkgname = '-'.join(pkgitems).replace('_', '-')
147 pkgfile = os.path.join(root, dn, 'package.json') 147 pkgfile = os.path.join(root, dn, 'package.json')
148 data = None 148 data = None
149 if os.path.exists(pkgfile): 149 if os.path.exists(pkgfile):