aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-03-01 10:37:49 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit4ea3834033fb502e7e10ff54d883ea9179eac99c (patch)
tree0867b1e02bdcfb803b0f7b1eb015f0bd26250a20
parent97a6b7eaf97e97805da27ab27ea06d3cb5cf74f7 (diff)
downloadopenembedded-core-contrib-4ea3834033fb502e7e10ff54d883ea9179eac99c.tar.gz
rrs_upstream_history: properly handle missing Recipe
If the Recipe object doesn't exist here then an exception will be raised rather than None being returned, and this will also trigger if multiple recipes match. This may have never triggered in the past because this would have been run right after updating all the recipes in the layer and clearing out duplicates (which we were doing earlier), and thus what is in the database would match the recipe files in the repository, assuming no errors occurred during parsing). We can't remove duplicates though so we need to switch over to using filter() and taking the first recipe. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xrrs/tools/rrs_upstream_history.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py
index 6aa56319a5..f5e0029bfd 100755
--- a/rrs/tools/rrs_upstream_history.py
+++ b/rrs/tools/rrs_upstream_history.py
@@ -21,6 +21,7 @@ from layerindex import utils
utils.setup_django()
from django.db import transaction
+from django.core.exceptions import ObjectDoesNotExist
import settings
logger = get_logger("UpstreamHistory", settings)
@@ -85,11 +86,12 @@ def get_upstream_info(layerbranch, recipe_data, result):
get_recipe_pv_without_srcpv
pn = recipe_data.getVar('PN', True)
- recipe = Recipe.objects.get(layerbranch=layerbranch, pn=pn)
- if not recipe:
- logger.info("%s: in layer branch %s not found." % \
+ recipes = Recipe.objects.filter(layerbranch=layerbranch, pn=pn)
+ if not recipes:
+ logger.warning("%s: in layer branch %s not found." % \
(pn, str(layerbranch)))
return
+ recipe = recipes[0]
ru = RecipeUpstream()
ru.recipe = recipe