]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: create: hide missing npm error when called from devtool
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 12 Apr 2017 10:41:29 +0000 (22:41 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 12 Apr 2017 21:16:55 +0000 (22:16 +0100)
If devtool is called with a URL to a source repository containing a
node.js module, we don't know that until recipetool has fetched it, and
due to the structure of the code we have to exit with a special code in
order to let devtool know it needs to build nodejs-native. We also want
to suppress the error message that recipetool would normally print under
these circumstances; there is already a mechanism for this but it wasn't
operative in the case where we're pointed to a source repository rather
than an npm:// URL, so create some plumbing so that we know to hide the
message.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/recipetool/create.py
scripts/lib/recipetool/create_npm.py

index 439dca0fcc8b896a09013da8a6473844f0416a81..5af58a12f70baf260f1e06525813b261125ba258 100644 (file)
@@ -59,6 +59,9 @@ class RecipeHandler(object):
     recipecmakefilemap = {}
     recipebinmap = {}
 
+    def __init__(self):
+        self._devtool = False
+
     @staticmethod
     def load_libmap(d):
         '''Load library->recipe mapping'''
@@ -622,6 +625,7 @@ def create_recipe(args):
     handlers.sort(key=lambda item: (item[1], -item[2]), reverse=True)
     for handler, priority, _ in handlers:
         logger.debug('Handler: %s (priority %d)' % (handler.__class__.__name__, priority))
+        setattr(handler, '_devtool', args.devtool)
     handlers = [item[0] for item in handlers]
 
     # Apply the handlers
index a79a9afbb108116b13bb093adb9da3951b89cee8..cb8f338b8b3e3726f1283efbaad4d202c417c645 100644 (file)
@@ -189,7 +189,7 @@ class NpmRecipeHandler(RecipeHandler):
         files = RecipeHandler.checkfiles(srctree, ['package.json'])
         if files:
             d = bb.data.createCopy(tinfoil.config_data)
-            npm_bindir = check_npm(tinfoil)
+            npm_bindir = check_npm(tinfoil, self._devtool)
             d.prependVar('PATH', '%s:' % npm_bindir)
 
             data = read_package_json(files[0])