mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
RRS: record previous version
Record the previous version in RecipeUpgrades, and use it to more accurately record upgrades where there are multiple versions present at a given time (common with e.g. kernel recipes). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
d8011bc305
commit
cea8a64517
20
rrs/migrations/0027_recipeupgrade_prev_version.py
Normal file
20
rrs/migrations/0027_recipeupgrade_prev_version.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.22 on 2019-08-20 02:24
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('rrs', '0026_recipeupgrade_grouping'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recipeupgrade',
|
||||||
|
name='prev_version',
|
||||||
|
field=models.CharField(blank=True, max_length=100),
|
||||||
|
),
|
||||||
|
]
|
|
@ -481,6 +481,7 @@ class RecipeUpgrade(models.Model):
|
||||||
filepath = models.CharField(max_length=512, blank=True)
|
filepath = models.CharField(max_length=512, blank=True)
|
||||||
orig_filepath = models.CharField(max_length=512, blank=True)
|
orig_filepath = models.CharField(max_length=512, blank=True)
|
||||||
group = models.ForeignKey(RecipeUpgradeGroup, blank=True, null=True, on_delete=models.SET_NULL)
|
group = models.ForeignKey(RecipeUpgradeGroup, blank=True, null=True, on_delete=models.SET_NULL)
|
||||||
|
prev_version = models.CharField(max_length=100, blank=True)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_by_recipe_and_date(recipe, end_date):
|
def get_by_recipe_and_date(recipe, end_date):
|
||||||
|
|
|
@ -121,7 +121,7 @@ oecore_bad_revs = {
|
||||||
"""
|
"""
|
||||||
Store upgrade into RecipeUpgrade model.
|
Store upgrade into RecipeUpgrade model.
|
||||||
"""
|
"""
|
||||||
def _save_upgrade(recipesymbol, layerbranch, pv, commit, title, info, filepath, logger, upgrade_type=None, orig_filepath=None):
|
def _save_upgrade(recipesymbol, layerbranch, pv, commit, title, info, filepath, logger, upgrade_type=None, orig_filepath=None, prev_version=None):
|
||||||
from rrs.models import Maintainer, RecipeUpgrade
|
from rrs.models import Maintainer, RecipeUpgrade
|
||||||
|
|
||||||
maintainer_name = info.split(';')[0]
|
maintainer_name = info.split(';')[0]
|
||||||
|
@ -144,13 +144,15 @@ def _save_upgrade(recipesymbol, layerbranch, pv, commit, title, info, filepath,
|
||||||
upgrade.upgrade_type = upgrade_type
|
upgrade.upgrade_type = upgrade_type
|
||||||
if orig_filepath:
|
if orig_filepath:
|
||||||
upgrade.orig_filepath = orig_filepath
|
upgrade.orig_filepath = orig_filepath
|
||||||
|
if prev_version:
|
||||||
|
upgrade.prev_version = prev_version
|
||||||
upgrade.regroup()
|
upgrade.regroup()
|
||||||
upgrade.save()
|
upgrade.save()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Create upgrade receives new recipe_data and cmp versions.
|
Create upgrade receives new recipe_data and cmp versions.
|
||||||
"""
|
"""
|
||||||
def _create_upgrade(recipe_data, layerbranch, ct, title, info, filepath, logger, pn_recipes, initial=False, orig_filepath=None):
|
def _create_upgrade(recipe_data, layerbranch, ct, title, info, filepath, logger, initial=False, orig_filepath=None):
|
||||||
from rrs.models import RecipeUpgrade, RecipeSymbol, RecipeUpgradeGroupRule
|
from rrs.models import RecipeUpgrade, RecipeSymbol, RecipeUpgradeGroupRule
|
||||||
from bb.utils import vercmp_string
|
from bb.utils import vercmp_string
|
||||||
|
|
||||||
|
@ -201,29 +203,22 @@ def _create_upgrade(recipe_data, layerbranch, ct, title, info, filepath, logger,
|
||||||
latest_upgrade.version = pv
|
latest_upgrade.version = pv
|
||||||
latest_upgrade.save()
|
latest_upgrade.save()
|
||||||
else:
|
else:
|
||||||
if len(pn_recipes) > 1:
|
|
||||||
# Check if the "new" version is already in the database
|
# Check if the "new" version is already in the database
|
||||||
if RecipeUpgrade.objects.filter(recipesymbol=recipesymbol, version=pv).exists():
|
same_pv_upgrade = all_rupgrades.filter(version=pv).order_by('-commit_date').last()
|
||||||
for prd in pn_recipes:
|
if same_pv_upgrade and \
|
||||||
if prd.getVar('FILE', True) != recipe_data.getVar('FILE', True):
|
not all_rupgrades.filter(prev_version=pv, commit_date__gt=same_pv_upgrade.commit_date).exists() \
|
||||||
lpv = prd.getVar('PV', True)
|
and \
|
||||||
(lpvw, _, _) = get_recipe_pv_without_srcpv(lpv,
|
not all_rupgrades.filter(upgrade_type__in=['R', 'N'], commit_date__gt=same_pv_upgrade.commit_date).exists():
|
||||||
get_pv_type(lpv))
|
|
||||||
if lpvw == ppv:
|
|
||||||
# The "previous" recipe is still present, we won't call this an upgrade
|
# The "previous" recipe is still present, we won't call this an upgrade
|
||||||
logger.debug('Multiple %s recipes, ignoring apparent version change' % pn)
|
logger.debug('%s: new version %s already exists' % (pn, pv))
|
||||||
return
|
return
|
||||||
upgrade_type = 'U'
|
upgrade_type = 'U'
|
||||||
if vercmp_result == 1:
|
if vercmp_result == 1:
|
||||||
if len(pn_recipes) > 1:
|
|
||||||
logger.debug('Multiple %s recipes, ignoring apparent downgrade' % pn)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
upgrade_type = 'D'
|
upgrade_type = 'D'
|
||||||
op = {'U': 'upgrade', 'D': 'downgrade'}[upgrade_type]
|
op = {'U': 'upgrade', 'D': 'downgrade'}[upgrade_type]
|
||||||
logger.debug("%s: detected %s (%s -> %s)" \
|
logger.debug("%s: detected %s (%s -> %s)" \
|
||||||
" in ct %s." % (pn, op, prev_pv, pv, ct))
|
" in ct %s." % (pn, op, prev_pv, pv, ct))
|
||||||
_save_upgrade(recipesymbol, layerbranch, pv, ct, title, info, filepath, logger, upgrade_type=upgrade_type, orig_filepath=orig_filepath)
|
_save_upgrade(recipesymbol, layerbranch, pv, ct, title, info, filepath, logger, upgrade_type=upgrade_type, orig_filepath=orig_filepath, prev_version=prev_pv)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -385,15 +380,9 @@ def generate_history(options, layerbranch_id, commit, logger):
|
||||||
recordcommit = commit
|
recordcommit = commit
|
||||||
|
|
||||||
fn_data = {}
|
fn_data = {}
|
||||||
pn_data = {}
|
|
||||||
for recipe_data in recipes:
|
for recipe_data in recipes:
|
||||||
fn = os.path.relpath(recipe_data.getVar('FILE', True), repodir)
|
fn = os.path.relpath(recipe_data.getVar('FILE', True), repodir)
|
||||||
fn_data[fn] = recipe_data
|
fn_data[fn] = recipe_data
|
||||||
pn = recipe_data.getVar('PN', True)
|
|
||||||
if pn in pn_data:
|
|
||||||
pn_data[pn].append(recipe_data)
|
|
||||||
else:
|
|
||||||
pn_data[pn] = [recipe_data]
|
|
||||||
|
|
||||||
seen_pns = []
|
seen_pns = []
|
||||||
try:
|
try:
|
||||||
|
@ -432,7 +421,7 @@ def generate_history(options, layerbranch_id, commit, logger):
|
||||||
orig_filepath = a
|
orig_filepath = a
|
||||||
break
|
break
|
||||||
_create_upgrade(recipe_data, layerbranch, recordcommit, title,
|
_create_upgrade(recipe_data, layerbranch, recordcommit, title,
|
||||||
info, filepath, logger, pn_data[pn], initial=options.initial, orig_filepath=orig_filepath)
|
info, filepath, logger, initial=options.initial, orig_filepath=orig_filepath)
|
||||||
seen_pns.append(pn)
|
seen_pns.append(pn)
|
||||||
|
|
||||||
# Handle recipes that have been moved without it being an upgrade/delete
|
# Handle recipes that have been moved without it being an upgrade/delete
|
||||||
|
|
Loading…
Reference in New Issue
Block a user