Skip to contentSkip to conversation

tinfoil: fixes for get_recipe_file()

PATCH New Paul Eggleton 1 participant 3 messages Mar 30, 2017

lore
Share & tools
lore
#0 lore raw

cover tinfoil: fixes for get_recipe_file()

The following changes since commit 968a77388dd1a24c1dadec6ce49bf53ebb5b643f:

lib/bb/codeparser: ensure BufferedLogger respects target logging level (2017-03-28 23:07:15 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib paule/tinfoil-noprovider
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/tinfoil-noprovider

Paul Eggleton (2):
tinfoil: fix get_recipe_file() to return an error on invalid recipe
tinfoil: improve get_recipe_file() exception text

 lib/bb/tinfoil.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/2 tinfoil: fix get_recipe_file() to return an error on invalid recipe

This function calls cooker.findBestProvider() but didn't handle the fact that that function returns a tuple (None, None, None, None) when there is no matching recipe. (This fixes devtool in OpenEmbedded showing a traceback when an invalid recipe is specified instead of a proper error message.)

---
 lib/bb/tinfoil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/tinfoil.py +1 -1
index c2ee707..14a2271 100644
@@ -363,7 +363,7 @@ class Tinfoil:
         skipped.
         """
         best = self.find_best_provider(pn)
-        if not best:
+        if not best or (len(best) > 3 and not best[3]):
             skiplist = self.get_skipped_recipes()
             taskdata = bb.taskdata.TaskData(None, skiplist=skiplist)
             skipreasons = taskdata.get_reasons(pn)
Signature · 1 line
2.9.3
#2 lore raw

PATCH 2/2 tinfoil: improve get_recipe_file() exception text

In reply to Paul Eggleton

* Turn reasons from a list into a string (usually there will be only one reason, but the interface provides for more than one) and state up front that the recipe is unavailable for clarity
* Use quotes around invalid recipe name

---
 lib/bb/tinfoil.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/tinfoil.py +2 -2
index 14a2271..928333a 100644
@@ -368,9 +368,9 @@ class Tinfoil:
             taskdata = bb.taskdata.TaskData(None, skiplist=skiplist)
             skipreasons = taskdata.get_reasons(pn)
             if skipreasons:
-                raise bb.providers.NoProvider(skipreasons)
+                raise bb.providers.NoProvider('%s is unavailable:\n  %s' % (pn, '  \n'.join(skipreasons)))
             else:
-                raise bb.providers.NoProvider('Unable to find any recipe file matching %s' % pn)
+                raise bb.providers.NoProvider('Unable to find any recipe file matching "%s"' % pn)
         return best[3]
 
     def get_file_appends(self, fn):
Signature · 1 line
2.9.3