summaryrefslogtreecommitdiffstats
path: root/lib/bb/server/xmlrpc.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-03-09 17:22:13 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-09 22:37:27 +0000
commit436d67fe7af89ecfbd11749a6ae1bc20e81f2cc8 (patch)
treea6fa0a715175a9147b49e9c7aad314570b69ef44 /lib/bb/server/xmlrpc.py
parentbea0246831a46d943d2e27d6b38f6e498bd3413c (diff)
downloadopenembedded-core-contrib-436d67fe7af89ecfbd11749a6ae1bc20e81f2cc8.tar.gz
fetch2/npm: properly handle npm dependencies
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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server/xmlrpc.py')
0 files changed, 0 insertions, 0 deletions