summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/npm.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: fetch2/npm: fix ud.registry so that alternative registries can be ↵Brendan Le Foll2016-03-121-1/+1
| | | | | | | | | | | | | | | handled Fixes [YOCTO #9231] npm when given an invalid registry URL with --registry actually goes and fetches from the default registry, but this commit makes sure it goes to the specified one. (Bitbake rev: 7c849be7c70a5db4f66fe3041486abb923b5e4ee) Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: add missing URL argument to ParameterErrorPaul Eggleton2016-03-091-2/+2
| | | | | | | | | | Without this you get a rather odd traceback instead of the proper exception message. (Bitbake rev: 2fe1826d3077eeda6cde433d3a1e6620f74e08dd) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: properly handle npm dependenciesPaul Eggleton2016-03-091-19/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of "npm view dependencies" isn't entirely JSON if there are multiple results, but the code here was just discarding the output if the entire thing didn't parse as JSON. Split the output into lines and iterate over it, parsing JSON fragments as we find them; this way we end up with the last package's dependencies since it'll be last in the output. Digging further, it seems that the dependencies field reported by "npm view" also includes optional dependencies. That wouldn't be a problem except some of these optional dependencies may be OS-specific; for example the "chokidar" module has "fsevents" in its optional dependencies, but fsevents only works on MacOS X (and is only needed there). If we erroneously pull in fsevents, not only is it unnecessary but it causes "npm shrinkwrap" to throw a tantrum. In the absence of a better approach, look at the os field and discard the module (along with any of its dependencies) if it isn't for Linux. As part of this, we can reduce the calls to npm view to one per package since we get the entire json output rather than querying twice for two separate fields. Overall the time taken has probably increased since we are being more thorough about dependencies, but it's not quite as bad as it could have been. (Bitbake rev: 436d67fe7af89ecfbd11749a6ae1bc20e81f2cc8) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: fix errors with some version specificationsPaul Eggleton2016-03-091-1/+1
| | | | | | | | | | | "2 || 3" is a valid version specification for a dependency in an npm package.json file, but of course that looks like something else when sent to a shell. Quote the version value to avoid this. (Bitbake rev: bea0246831a46d943d2e27d6b38f6e498bd3413c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: ignore unknown headers in tarballsPaul Eggleton2016-03-071-1/+1
| | | | | | | | | | | Tarballs that are fetched down via npm repositories seem to often have unknown headers. This doesn't affect our ability to extract the contents though so we don't really care to see those warnings. (Bitbake rev: b38975103e52a0c25e9ad9032c8cca1c47cbdcc2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: handle alternative dependency syntaxPaul Eggleton2016-03-071-1/+3
| | | | | | | | | | | | | npm allows you to specify a dependency as a Github username+path, or omit the version entirely. You can hit these if you don't use a shrinkwrap file, with the result that the code later fails due to the output of "npm view" being empty; so handle this lazily by just ignoring this part of the dependency if it's not really a version. (Bitbake rev: 7b7a65c44dbdd5ba9366d4e2093f76df8758d546) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: fix indentationPaul Eggleton2016-03-071-22/+22
| | | | | | | | | No code changes, just fix to use four spaces. (Bitbake rev: 66a9ee7d54ca9c25209f72da079f260ccdcc872a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: Add missing ParameterError importBrendan Le Foll2016-03-021-0/+1
| | | | | | | (Bitbake rev: b583a40c9086b3587065995d8cee45b7ea36c1b3) Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: npm: in cases where shrinkwrap resolved a git URL, ignore it and ↵Brendan Le Foll2016-03-021-1/+1
| | | | | | | | | | | | | grab dist.tarball npm-shrinkwrap will sometimes resolve a git URL which instead of a http url, in this case go and grab the dist.tarball via npm instead of using the resolved URL. (Bitbake rev: eb53b927ff59aa19cf28bc46beb9f9a185a59990) Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: Add mirroring support for npm fetcherRichard Purdie2016-02-261-1/+30
| | | | | | (Bitbake rev: bff46c614d3f9cc18a1c8908c47842712e0e3a8c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: Add npm fetcherBrendan Le Foll2016-02-261-0/+226
npm fetcher with support for shrinkwrap files and lockdown files to easily download and install an npm package with strict dependency resolution. The SRC_URI should be in the format of: SRC_URI = "npm://registry.npmjs.org/;name=${PN};version=${PV}" To add a shrinkwrap and lockdown file use: NPM_SHRINKWRAP := "${THISDIR}/${PN}/npm-shrinkwrap.json" NPM_LOCKDOWN := "${THISDIR}/${PN}/lockdown.json" (Bitbake rev: dec75bbc5d075acb322dad8b1c40d6bd518dc9fd) Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>