summaryrefslogtreecommitdiffstats
path: root/meta/classes/npm.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* npm.bbclass: Node module name and recipe name can be differentBöszörményi Zoltán2018-02-061-5/+13
| | | | | | | | | | | | Some NPM modules have the same name as their low level dependencies. To prevent recipe naming conflicts, allow node module recipe names to start with the "node-" prefix. (From OE-Core rev: 6b417c7c3a38463c64756beae9817fa2a80fd09e) Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* npm.bbclass: Fix building node modules with npm@5Böszörményi Zoltán2018-02-061-2/+3
| | | | | | | | | | | | | | | | | | | | npm cache clear throws an error with npm@5 and suggests to use npm cache verify instead. But our cache is actually empty, so use npm cache clear --force. npm install in the source directory creates symlinks with npm@5. Use a combination of npm pack and npm install module-version.tgz that works the same way with older and new npm versions and is guaranteed to create actual copies instead of directory symlinks. This change allows using nodejs 8.x LTS, tested with 8.9.4. (From OE-Core rev: 2d7d2a460842c8747df17990970f22f4a11f36f6) Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/npm: allow installation of devDependenciesAnders Darander2017-03-221-2/+11
| | | | | | | | | | | | | | Often, eg when using angular2, there's a need to install also the devDependencies. The default is to keep the old behaviour, to not install devDependencies. (From OE-Core rev: 9377d16751aeff0a913e754d711bca6e4e4d9df1) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/npm: set HOME during do_installPaul Eggleton2017-02-071-0/+3
| | | | | | | | | | | In do_compile we set HOME so that ~/.npm* only get created in the work directory; we need to do the same in do_install as well or they'll go into the user's home directory which we do not want. (From OE-Core rev: a667cb9ed2dceb804b85d1a024e2619bc34d2681) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: remove True option to getVar callsJoshua Lock2016-12-161-2/+2
| | | | | | | | | | | | | getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/npm: use npm install to do installationPaul Eggleton2016-11-061-1/+5
| | | | | | | | | | | | | | | Using "npm install" instead of "cp -a" is the more correct thing to be doing here, and ensures that symlinks for executable scripts are put into ${prefix}/bin. (I'd prefer ${bindir}, but npm does not allow specifying paths at that level - only a prefix.) Fixes [YOCTO #10460]. (From OE-Core rev: 90cb980a1c49de99a0aec00c0cd5fc1e165490a7) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: support node.js code outside of npmPaul Eggleton2016-09-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | If you have your own node.js application you may not publish it (or at least not immediately) in an npm registry - it might just be in a repository on github or on your local machine. Add support to recipetool create for creating recipes to build such applications - extract their dependencies, fetch them, and add corresponding npm:// URLs to SRC_URI, and ensure that LICENSE / LIC_FILES_CHKSUM are updated to match. For example, you can now run: recipetool create https://github.com/diversario/node-ssdp (I had to borrow some code from bitbake/lib/bb/fetch2/npm.py to implement this functionality; this should be refactored out but now isn't the time to do that refactoring.) Part of the fix for [YOCTO #9537]. (From OE-Core rev: 4fb8b399c05a1b66986fc76e13525f6c5e0d9b58) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* npm: npm.bbclass now adds nodejs to RDEPENDSHenry Bruce2016-08-171-0/+1
| | | | | | | | | | | We expect that any package that uses the npm bbclass will have a runtime dependency on node.js (From OE-Core rev: 769fae0b74d7c7992aa593907f446fab98ef5128) Signed-off-by: Henry Bruce <henry.bruce@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* npm.bbclass: avoid str/byte conversion problems for PKGV and SUMMARYPatrick Ohly2016-06-121-2/+2
| | | | | | | | | | | | | | | | | In Python3, str.encode() returns byte strings, which later are not converted back to strings automatically, leading to "TypeError: Can't convert 'bytes' object to str implicitly" in code which reads PKGV and SUMMARY and expects to find strings there. The npm.bbclass must use values for d.setVar() that meet that expectation, and thus the redundant (and in Python3, harmful) .encode() gets removed. (From OE-Core rev: 241e094bcd9212204350f9855257474908f82a3c) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* npm: add target_arch flag to npmBrendan Le Foll2016-05-301-1/+12
| | | | | | | | | | | | | npm takes a target_arch flag which needs to be set to do some gyp compilations correctly. It also doesn't use the same mapping as OE for target arch so a small function is required to make the mapping work. Function is taken from meta-nodejs (From OE-Core rev: f402225311e4bbb62ba9781ab274420abaac0fb4) 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>
* npm.bbclass: Stop packagenames containing underscores from being generatedBrendan Le Foll2016-04-141-2/+4
| | | | | | | | | | | 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>
* devtool: add: delete externalsrc files on npm recipe do_installPaul Eggleton2016-03-251-2/+4
| | | | | | | | | | | | | | The npm class just installs whatever is in ${S}; if you're using externalsrc in conjunction with it the symlinks (oe-workdir and oe-logs by default) plus singletask.lock will end up in the final package, which isn't really right. Introduce a variable so we know the path the files will be installed into within npm.bbclass, and append to do_install within the workspace bbappend to delete the files. (From OE-Core rev: 766845e06db9d7d595e836ea1364c16fa132a413) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: split npm module dependencies into packagesPaul Eggleton2016-03-091-0/+20
| | | | | | | | | | | | | | | | | | | | Rather than rolling all of an npm module's dependencies into the same package, split them into one module per package, setting the SUMMARY and PKGV values from the package.json file for each package. Additionally, mark each package with the appropriate license using the license scanning we already do, falling back to the license stated in the package.json file for the module if unknown. All of this is mostly in aid of ensuring all modules and their licenses now show up in the manifests for the image. Additionally we set the main LICENSE value more concretely once we've calculated the per-package licenses, since we have more information at that point. (From OE-Core rev: 8226805f83d21e7c1d2ba21969f3e8ee4b137496) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* npm.bbclass: Add npm class to match fetcherBrendan Le Foll2016-02-281-0/+25
npm class supports the npm fetcher, helping doing the basic compile/install stages of an npm package (From OE-Core rev: 4d2ad3e39242c947612023f4429bc8fb430551b5) 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>