RRS: ensure upgrades recorded at exact same time are correctly ordered

In meta-oe there are two commits (d91f92cf04 and 57492d40b5) which have
the same commit date and thus don't deterministically order; the result
was that the mercurial-native recipe might or might not show up. Add id
to the order_by to make it deterministic.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-09-03 10:25:47 +12:00
parent 559753d570
commit 29741015d1

View File

@ -197,7 +197,7 @@ class Raw():
cur.execute("""SELECT rs.id, rs.pn, rs.summary, te.version, rownum FROM (
SELECT recipesymbol_id, version, commit_date, upgrade_type, ROW_NUMBER() OVER(
PARTITION BY recipesymbol_id
ORDER BY commit_date DESC
ORDER BY commit_date DESC, id DESC
) AS rownum
FROM rrs_recipeupgrade
WHERE commit_date <= %s
@ -735,7 +735,7 @@ class RecipeDetailView(DetailView):
context['maintainer_name'] = 'No maintainer'
details = []
for ru in RecipeUpgrade.objects.filter(recipesymbol=recipesymbol).exclude(upgrade_type='M').order_by('group', '-commit_date'):
for ru in RecipeUpgrade.objects.filter(recipesymbol=recipesymbol).exclude(upgrade_type='M').order_by('group', '-commit_date', '-id'):
details.append(_get_recipe_upgrade_detail(maintplan, ru))
details.sort(key=lambda s: list(map(int, s.group.title.split('.') if s.group else [])), reverse=True)
context['recipe_upgrade_details'] = details
@ -743,7 +743,7 @@ class RecipeDetailView(DetailView):
if not recipe:
ru = RecipeUpgrade.objects.filter(recipesymbol=recipesymbol).order_by('-commit_date').first()
ru = RecipeUpgrade.objects.filter(recipesymbol=recipesymbol).order_by('-commit_date', '-id').first()
if ru:
context['last_filepath'] = ru.filepath