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.

(From OE-Core rev: a08d12ad867c292f7474731a0fe5e51e712446d6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2016-03-09 17:48:53 +13:00 committed by Richard Purdie
parent 91455005b6
commit 2279eb2a4c
1 changed files with 6 additions and 0 deletions

View 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)