summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/npm.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: fetch2: fix import error for Python 3.6.5Tzu Hsiang Lin2018-05-291-1/+0
| | | | | | | | | | | | When running bitbake command with Python 3.6.5 always result in import error causing by the change of distutils module. This patch replaces the method to search executable in PATH by "/usr/bin/env <command>". (Bitbake rev: bd9a1b063633af2936ba1dd87b19202424900151) Signed-off-by: Tzu Hsiang Lin <t9360341@ntut.org.tw> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm.py: Fix inverted condition to prevent infinite loopBöszörményi Zoltán2018-02-141-3/+5
| | | | | | | | | | | | | | | At least the cli-color node module has dependencies that have cyclic dependency among themselves. npm.py is prepared to deal with such a case but the condition is handled only for downloading or not a dependency again, but then it goes checking the its dependency which causes an infinite loop in _getdependencies(). Make this function simply return when a dependency is already downloaded and only download and check its dependencies when not. (Bitbake rev: 545540420112992e53f4a83104af10452df168d0) Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: add noverify parameter to skip lockdown/shrinkwrapPaul Eggleton2017-08-311-20/+21
| | | | | | | | | | | | | | | | When fetching source for the first time within scripts such as OpenEmbedded's recipetool, we don't want to be showing warnings about NPM_SHRINKWRAP or NPM_LOCKDOWN not being set since there's no way we could have set them in advance. Previously we were using ud.ignore_checksums to suppress these but since we are now using a more standard task-based path to fetch the source, we need to disable these through the metadata. Look for a "noverify" parameter set on the npm URL and skip the checks if it is set to "1". (Bitbake rev: 8c4b35d1e4d31bae9fddd129d5ba230acb72c3bb) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: npm fetcher: fix unknown variable name.Ismo Puustinen2017-06-291-1/+1
| | | | | | | | | 'mirrortarball' is supposed to be a local variable to the function. (Bitbake rev: a457cbfb1f20a47db3978290921d0708cd96bd70) Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch: support multiple mirror tarball filenamesChristopher Larson2017-06-021-3/+4
| | | | | | | | | | | | Remove ud.mirrortarball in favor of ud.mirrortarballs. Each tarball will be attempted, in order, and the first available will be used. This is needed for git shallow mirror tarball support, as we want to be able to use either a shallow or full mirror tarball. (Bitbake rev: 02eebee6709e57b523862257f75929e64f16d6b0) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: remove last remaining usage of deprecated bb.data APIsAndre McCurdy2017-03-041-1/+0
| | | | | | | (Bitbake rev: 62dc3c3b40a95f9df31f5c917574c3822fb8bb64) Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/fetch2: rewrite / to - in package namesAnders Darander2017-03-011-2/+3
| | | | | | | | | | Most angular2 packages have names of the form @angular/xxx. The / obviously can't be used in a file name, replace it with -. (Bitbake rev: d3bd41d0ec9621307c362b394872b18b8b7ed8d6) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: fix handling of os fieldPaul Eggleton2017-02-071-1/+6
| | | | | | | | | | | | | | | | | When I originally added this check I didn't quite understand how the values in this field should be expressed - it seems from reading the documentation if there is an entry starting with '!' then the list is a blacklist and we shouldn't expect "linux" to be in the list, or we'll end up skipping important dependencies. This fixes fetching the "statsd" npm package. Fixes [YOCTO #10760]. (Bitbake rev: 7aa6d1586417e0e7d9925917a82caee5884957db) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: handle items only in optionalDependenciesPaul Eggleton2017-02-071-0/+1
| | | | | | | | | | | | | | | | An npm package.json file has two dependency fields: dependencies and optionalDependencies. An item in optionalDependencies *may* also be listed in dependencies, but this is not required (and not necessary since if it's in optionalDependencies it will be optional, adding it to dependencies won't do anything). The code here was assuming that an optional dependency would always be in both, that's probably because that was true of the examples I was looking at at the time. To fix it, just add the optional ones to the list we're iterating over. (Bitbake rev: c0c50d43266150a80be31ae2c6fcaf37f5ba231d) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: obey BB_ALLOWED_NETWORKS when checking network accessMarkus Lehtonen2016-11-301-1/+1
| | | | | | | | | [YOCTO #10508] (Bitbake rev: ddd3bc2d64d7240ecb6b6e4a1ae29b1faef6cc22) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: remove True option to getVar callsJoshua Lock2016-11-301-10/+10
| | | | | | | | | | | | 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\) (Bitbake rev: 3b45c479de8640f92dd1d9f147b02e1eecfaadc8) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb: Don't use deprecated bb.data.getVar/setVar APIRichard Purdie2016-11-231-1/+1
| | | | | | | | | | The old style bb.data.getVar/setVar API is obsolete. Most of bitbake doesn't use it but there were some pieces that escaped conversion. This patch fixes the remaining users mostly in the fetchers. (Bitbake rev: ff7892fa808116acc1ac50effa023a4cb031a5fc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warningsPaul Eggleton2016-11-231-8/+14
| | | | | | | | | | | | | | | | | | If ud.ignore_checksums is set (which we currently use to suppress the warnings for missing SRC_URI checksums when fetching files from scripts), then if we're fetching an npm package we should similarly suppress the warnings when NPM_LOCKDOWN and NPM_SHRINKWRAP aren't set. At the same time, make any errors reading either of these files actual errors since if the file is specified and could not be found, that should be an error - not the exact same warning. Fixes [YOCTO #10464]. (Bitbake rev: cefb8c93c8299e68352cf7ec5ad9ca50c0d499ed) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: don't download same URL multiple timesPaul Eggleton2016-09-151-4/+8
| | | | | | | | | | | If we've already fetched a particular URL then we do not need to do so again within in the same operation. Maintain an internal list of fetched URLs to avoid doing that. (Bitbake rev: b4705c80add1f618c11a9223cdd9578d763b50ec) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: clarify commentPaul Eggleton2016-09-081-1/+1
| | | | | | | | | | The correct name of the parameter is "version" not "ver" so ensure we aren't misleading the user by giving the latter in an example. (Bitbake rev: 14c045c6a20993d389b91ae2459d811a1430a7b2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: handle top-level shrinkwrap filePaul Eggleton2016-09-081-2/+9
| | | | | | | | | | | | | Allow using a top-level shrinkwrap file with one or more npm:// dependencies, i.e. if the module isn't found at the top level then look one level down. Part of the fix for [YOCTO #9537]. (Bitbake rev: f7de3f8b5f628dee043fe783148812914ab20813) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: support subdir= parameterPaul Eggleton2016-09-081-1/+6
| | | | | | | | | | | | | "npmpkg" can be a default, but it should respect the subdir parameter as with other FetchMethods. This allows us to have more than one npm:// entry in SRC_URI without nasty hacks. Fix required in order to support [YOCTO #9537]. (Bitbake rev: e6a94d2091ec5d42f25102334a8492a731b8dec3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: fix broken fetches if more than one npm URL fetchedPaul Eggleton2016-09-081-3/+3
| | | | | | | | | | | | | | | You cannot set a URL-specific value in an object-level variable on the FetchMethod in urldata_init() or the result is the value specific to the last URL will be the one that gets set. This prevented fetching more than one npm:// URL correctly - the other tarballs would not download to the correct location and do_unpack failed to find them as a result. Fix required in order to support [YOCTO #9537]. (Bitbake rev: 1435b49ea7d0f9d4cc4a665fb2aa83d1eea7900f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2/npm: explicitly specify workdirPaul Eggleton2016-09-081-1/+2
| | | | | | | | | | | | | We were downloading into the current directory here, which is fine if that current directory can be expected to be the right place - but that's not true when called from recipetool within OE. We should explicitly specify the directory to run the command in and then there won't be a problem. (Bitbake rev: 0ddaf725e5a0675b252b7f80b1706370e478175b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: preserve current working directoryMatt Madison2016-08-201-15/+7
| | | | | | | | | | | Fix the methods in all fetchers so they don't change the current working directory of the calling process, which could lead to "changed cwd" warnings from bitbake. (Bitbake rev: 6aa78bf3bd1f75728209e2d01faef31cb8887333) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Convert to python 3Richard Purdie2016-06-021-3/+3
| | | | | | | | | Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Update logger.warn() -> logger.warning()Richard Purdie2016-05-111-2/+2
| | | | | | | | | | python deprecated logger.warn() in favour of logger.warning(). This is only used in bitbake code so we may as well just translate everything to avoid warnings under python 3. Its safe for python 2.7. (Bitbake rev: 676a5f592e8507e81b8f748d58acfea7572f8796) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* 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>