[oe-commits] [bitbake] 02/17: fetch2/npm: handle alternative dependency syntax

git at git.openembedded.org git at git.openembedded.org
Mon Mar 7 17:23:54 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit 7b7a65c44dbdd5ba9366d4e2093f76df8758d546
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Mon Mar 7 17:27:36 2016 +1300

    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.
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/npm.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index 59312f4..761c2e0 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -144,13 +144,15 @@ class Npm(FetchMethod):
 
     def _getdependencies(self, pkg, data, version, d, ud):
         pkgfullname = pkg
-        if version:
+        if version != '*' and not '/' in version:
             pkgfullname += "@%s" % version
         logger.debug(2, "Calling getdeps on %s" % pkg)
         fetchcmd = "npm view %s dist.tarball --registry %s" % (pkgfullname, ud.registry)
         output = runfetchcmd(fetchcmd, d, True)
         # npm may resolve multiple versions
         outputarray = output.strip().splitlines()
+        if not outputarray:
+            raise FetchError("The command '%s' returned no output" % fetchcmd)
         # we just take the latest version npm resolved
         #logger.debug(2, "Output URL is %s - %s - %s" % (ud.basepath, ud.basename, ud.localfile))
         outputurl = outputarray[len(outputarray)-1].rstrip()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list