All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] runqueue: Only attempt to print closest matching task if there is a match
@ 2014-01-21 22:31 Richard Purdie
  2014-01-22 16:16 ` Chris Larson
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2014-01-21 22:31 UTC (permalink / raw)
  To: bitbake-devel

This avoids backtraces some people have been seeing.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 4577236..bf2dc54 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -1224,12 +1224,11 @@ class RunQueue:
             if match is None:
                 bb.fatal("Can't find a task we're supposed to have written out? (hash: %s)?" % h)
             matches = {k : v for k, v in matches.iteritems() if h not in k}
-            latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1]
-            prevh = __find_md5__.search(latestmatch).group(0)
-            output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb)
-            bb.plain("\nTask %s:%s couldn't be used from the cache because:\n  We need hash %s, closest matching task was %s\n  " % (pn, taskname, h, prevh) + '\n  '.join(output))
-             
-
+            if len(matches):
+                latestmatch = sorted(matches.keys(), key=lambda f: matches[f])[-1]
+                prevh = __find_md5__.search(latestmatch).group(0)
+                output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb)
+                bb.plain("\nTask %s:%s couldn't be used from the cache because:\n  We need hash %s, closest matching task was %s\n  " % (pn, taskname, h, prevh) + '\n  '.join(output))
 
 class RunQueueExecute:
 




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

* Re: [PATCH] runqueue: Only attempt to print closest matching task if there is a match
  2014-01-21 22:31 [PATCH] runqueue: Only attempt to print closest matching task if there is a match Richard Purdie
@ 2014-01-22 16:16 ` Chris Larson
  2014-01-22 18:05   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Larson @ 2014-01-22 16:16 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Tue, Jan 21, 2014 at 3:31 PM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> +            if len(matches):


Minor quibble, this could almost be considered an antipattern in python :)
Whenever you see yourself doing this, you're almost always better off
removing the len(). Python can test if a container is empty.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 827 bytes --]

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

* Re: [PATCH] runqueue: Only attempt to print closest matching task if there is a match
  2014-01-22 16:16 ` Chris Larson
@ 2014-01-22 18:05   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2014-01-22 18:05 UTC (permalink / raw)
  To: Chris Larson; +Cc: bitbake-devel

On Wed, 2014-01-22 at 09:16 -0700, Chris Larson wrote:
> On Tue, Jan 21, 2014 at 3:31 PM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
>         +            if len(matches):
> 
> Minor quibble, this could almost be considered an antipattern in
> python :) Whenever you see yourself doing this, you're almost always
> better off removing the len(). Python can test if a container is
> empty.

Sorry, I do know this too :/.

It started life as a len(x) > 1, then when I fixed something else I
didn't properly simplify it.

Cheers,

Richard




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

end of thread, other threads:[~2014-01-22 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-21 22:31 [PATCH] runqueue: Only attempt to print closest matching task if there is a match Richard Purdie
2014-01-22 16:16 ` Chris Larson
2014-01-22 18:05   ` Richard Purdie

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.