aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/recipetool')
-rw-r--r--scripts/lib/recipetool/create.py10
-rw-r--r--scripts/lib/recipetool/create_npm.py4
2 files changed, 9 insertions, 5 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 9b31fe92d7..d427d32062 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -406,10 +406,7 @@ def create_recipe(args):
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)
+ check_npm(tinfoil.config_data)
logger.info('Fetching %s...' % srcuri)
try:
checksums = scriptutils.fetch_uri(tinfoil.config_data, fetchuri, srctree, srcrev)
@@ -1076,6 +1073,11 @@ def convert_rpm_xml(xmlfile):
return values
+def check_npm(d):
+ if not os.path.exists(os.path.join(d.getVar('STAGING_BINDIR_NATIVE', True), 'npm')):
+ logger.error('npm required to process specified source, but npm is not available - you need to build nodejs-native first')
+ sys.exit(14)
+
def register_commands(subparsers):
parser_create = subparsers.add_parser('create',
help='Create a new recipe',
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index e794614978..7bb844cb0c 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -21,7 +21,7 @@ import subprocess
import tempfile
import shutil
import json
-from recipetool.create import RecipeHandler, split_pkg_licenses, handle_license_vars
+from recipetool.create import RecipeHandler, split_pkg_licenses, handle_license_vars, check_npm
logger = logging.getLogger('recipetool')
@@ -157,6 +157,8 @@ class NpmRecipeHandler(RecipeHandler):
files = RecipeHandler.checkfiles(srctree, ['package.json'])
if files:
+ check_npm(tinfoil.config_data)
+
data = read_package_json(files[0])
if 'name' in data and 'version' in data:
extravalues['PN'] = data['name']