From a08d12ad867c292f7474731a0fe5e51e712446d6 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Wed, 9 Mar 2016 17:48:53 +1300 Subject: recipetool: create: check if npm available if npm:// URL specified 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 Signed-off-by: Richard Purdie --- scripts/lib/recipetool/create.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/lib/recipetool') diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 43c07848c2..1d48e36462 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -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) -- cgit v1.2.3