]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: create: check if npm available if npm:// URL specified
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 9 Mar 2016 04:48:53 +0000 (17:48 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 9 Mar 2016 16:59:56 +0000 (16:59 +0000)
If the user specifies an npm:// URL then the fetcher needs npm to be
available to run, so check if it's available early rather than failing
later.

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

index 43c07848c2cd041868fc0383ad7abffa101af340..1d48e3646219d73419e6d7283efdec0377f7660c 100644 (file)
@@ -355,6 +355,12 @@ def create_recipe(args):
             srcuri = rev_re.sub('', srcuri)
         tempsrc = tempfile.mkdtemp(prefix='recipetool-')
         srctree = tempsrc
+        if fetchuri.startswith('npm://'):
+            # Check if npm is available
+            npm = bb.utils.which(tinfoil.config_data.getVar('PATH', True), 'npm')
+            if not npm:
+                logger.error('npm:// URL requested but npm is not available - you need to either build nodejs-native or install npm using your package manager')
+                sys.exit(1)
         logger.info('Fetching %s...' % srcuri)
         try:
             checksums = scriptutils.fetch_uri(tinfoil.config_data, fetchuri, srctree, srcrev)