[gnome-continuous-yocto/gnomeostree-3.28-rocko: 3360/8267] bitbake: fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 3360/8267] bitbake: fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings
- Date: Sun, 17 Dec 2017 00:31:26 +0000 (UTC)
commit 4d8ee55164303544c9cf9c9356448cbc79885815
Author: Paul Eggleton <paul eggleton linux intel com>
Date: Wed Nov 16 09:11:03 2016 +1300
bitbake: fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings
If ud.ignore_checksums is set (which we currently use to suppress the
warnings for missing SRC_URI checksums when fetching files from
scripts), then if we're fetching an npm package we should similarly
suppress the warnings when NPM_LOCKDOWN and NPM_SHRINKWRAP aren't set.
At the same time, make any errors reading either of these files actual
errors since if the file is specified and could not be found, that
should be an error - not the exact same warning.
Fixes [YOCTO #10464].
(Bitbake rev: cefb8c93c8299e68352cf7ec5ad9ca50c0d499ed)
Signed-off-by: Paul Eggleton <paul eggleton linux intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/bb/fetch2/npm.py | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index 699ae72..c3e02e4 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -258,17 +258,23 @@ class Npm(FetchMethod):
shwrf = d.getVar('NPM_SHRINKWRAP', True)
logger.debug(2, "NPM shrinkwrap file is %s" % shwrf)
- try:
- with open(shwrf) as datafile:
- shrinkobj = json.load(datafile)
- except:
+ if shwrf:
+ try:
+ with open(shwrf) as datafile:
+ shrinkobj = json.load(datafile)
+ except Exception as e:
+ raise FetchError('Error loading NPM_SHRINKWRAP file "%s" for %s: %s' % (shwrf, ud.pkgname,
str(e)))
+ elif not ud.ignore_checksums:
logger.warning('Missing shrinkwrap file in NPM_SHRINKWRAP for %s, this will lead to unreliable
builds!' % ud.pkgname)
lckdf = d.getVar('NPM_LOCKDOWN', True)
logger.debug(2, "NPM lockdown file is %s" % lckdf)
- try:
- with open(lckdf) as datafile:
- lockdown = json.load(datafile)
- except:
+ if lckdf:
+ try:
+ with open(lckdf) as datafile:
+ lockdown = json.load(datafile)
+ except Exception as e:
+ raise FetchError('Error loading NPM_LOCKDOWN file "%s" for %s: %s' % (lckdf, ud.pkgname,
str(e)))
+ elif not ud.ignore_checksums:
logger.warning('Missing lockdown file in NPM_LOCKDOWN for %s, this will lead to unreproducible
builds!' % ud.pkgname)
if ('name' not in shrinkobj):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]