[bitbake-devel,3/3] fetch2/npm: fix handling of os field

Submitted by Paul Eggleton on Feb. 6, 2017, 8:08 p.m. | Patch ID: 136804


Message ID c87951820de6cf7b1066e222e59cfaee551824ee.1486411669.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton Feb. 6, 2017, 8:08 p.m.
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].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
 lib/bb/fetch2/npm.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index 8c32f81..15b281f 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -182,7 +182,12 @@  class Npm(FetchMethod):
             if pkg_os:
                 if not isinstance(pkg_os, list):
                     pkg_os = [pkg_os]
-                if 'linux' not in pkg_os or '!linux' in pkg_os:
+                blacklist = False
+                for item in pkg_os:
+                    if item.startswith('!'):
+                        blacklist = True
+                        break
+                if (not blacklist and 'linux' not in pkg_os) or '!linux' in pkg_os:
                     logger.debug(2, "Skipping %s since it's incompatible with Linux" % pkg)
         #logger.debug(2, "Output URL is %s - %s - %s" % (ud.basepath, ud.basename, ud.localfile))