diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-03-07 17:27:36 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-07 17:23:03 +0000 |
commit | 0cd1be1f09cd5c4e02f1d57c910c5448510135ee (patch) | |
tree | 4490b829d66141477e6a245342e03c7c67b82883 | |
parent | d9999279d97daa0c39f2d04a22c41324dd3aff63 (diff) | |
download | poky-0cd1be1f09cd5c4e02f1d57c910c5448510135ee.tar.gz |
bitbake: fetch2/npm: handle alternative dependency syntax
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>
-rw-r--r-- | bitbake/lib/bb/fetch2/npm.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py index 59312f4f01..761c2e0e73 100644 --- a/bitbake/lib/bb/fetch2/npm.py +++ b/bitbake/lib/bb/fetch2/npm.py | |||
@@ -144,13 +144,15 @@ class Npm(FetchMethod): | |||
144 | 144 | ||
145 | def _getdependencies(self, pkg, data, version, d, ud): | 145 | def _getdependencies(self, pkg, data, version, d, ud): |
146 | pkgfullname = pkg | 146 | pkgfullname = pkg |
147 | if version: | 147 | if version != '*' and not '/' in version: |
148 | pkgfullname += "@%s" % version | 148 | pkgfullname += "@%s" % version |
149 | logger.debug(2, "Calling getdeps on %s" % pkg) | 149 | logger.debug(2, "Calling getdeps on %s" % pkg) |
150 | fetchcmd = "npm view %s dist.tarball --registry %s" % (pkgfullname, ud.registry) | 150 | fetchcmd = "npm view %s dist.tarball --registry %s" % (pkgfullname, ud.registry) |
151 | output = runfetchcmd(fetchcmd, d, True) | 151 | output = runfetchcmd(fetchcmd, d, True) |
152 | # npm may resolve multiple versions | 152 | # npm may resolve multiple versions |
153 | outputarray = output.strip().splitlines() | 153 | outputarray = output.strip().splitlines() |
154 | if not outputarray: | ||
155 | raise FetchError("The command '%s' returned no output" % fetchcmd) | ||
154 | # we just take the latest version npm resolved | 156 | # we just take the latest version npm resolved |
155 | #logger.debug(2, "Output URL is %s - %s - %s" % (ud.basepath, ud.basename, ud.localfile)) | 157 | #logger.debug(2, "Output URL is %s - %s - %s" % (ud.basepath, ud.basename, ud.localfile)) |
156 | outputurl = outputarray[len(outputarray)-1].rstrip() | 158 | outputurl = outputarray[len(outputarray)-1].rstrip() |