All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings
@ 2016-11-15 20:11 Paul Eggleton
  2016-11-15 20:11 ` [PATCH 1/1] " Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2016-11-15 20:11 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit 91c3b34625fac2a0f093a4b46a46e89f813e7972:

  lib/bb/cooker.py: fix for BBFILE_PATTERN = "" (2016-11-04 12:50:29 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib paule/bb-npm-warnings
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bb-npm-warnings

Paul Eggleton (1):
  fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings

 lib/bb/fetch2/npm.py | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

-- 
2.5.5



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings
  2016-11-15 20:11 [PATCH 0/1] fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings Paul Eggleton
@ 2016-11-15 20:11 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2016-11-15 20:11 UTC (permalink / raw)
  To: bitbake-devel

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].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/fetch2/npm.py | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index 699ae72..c3e02e4 100644
--- a/lib/bb/fetch2/npm.py
+++ b/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):
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-15 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-15 20:11 [PATCH 0/1] fetch2: npm: conditionally hide NPM_LOCKDOWN / NPM_SHRINKWRAP warnings Paul Eggleton
2016-11-15 20:11 ` [PATCH 1/1] " Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.