aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-03-24 01:10:39 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commitc607ba6945c12dc8559919aefd136e9dc43da123 (patch)
treec5d874cc4376fc029a6cf67832a49636de5165c1
parentfdec9d1d6388fac48bba797493be63eabb7c5b19 (diff)
downloadopenembedded-core-contrib-c607ba6945c12dc8559919aefd136e9dc43da123.tar.gz
rrs_upgrade_history: handle multiple recipes with same pn per layer
We should expect multiple matches for layerbranch + pn, so use filter() instead of get() and take the first id that matches. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--rrs/tools/upgrade_history_internal.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/rrs/tools/upgrade_history_internal.py b/rrs/tools/upgrade_history_internal.py
index 82fbe1aff5..783e893619 100644
--- a/rrs/tools/upgrade_history_internal.py
+++ b/rrs/tools/upgrade_history_internal.py
@@ -62,12 +62,12 @@ def _create_upgrade(recipe_data, layerbranch, ct, title, info, logger, initial=F
pn = recipe_data.getVar('PN', True)
pv = recipe_data.getVar('PV', True)
- try:
- recipe = Recipe.objects.get(pn=pn, layerbranch=layerbranch)
- except Exception as e:
+ recipes = Recipe.objects.filter(pn=pn, layerbranch=layerbranch).order_by('id')
+ if not recipes:
logger.warn("%s: Not found in Layer branch %s." %
(pn, str(layerbranch)))
return
+ recipe = recipes[0]
try:
latest_upgrade = RecipeUpgrade.objects.filter(