From 73656432b21dae2fce914c1649421036b2e54d2b Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 21 Oct 2019 10:15:22 +1300 Subject: [PATCH] Track SRCREV for each recipe For the purposes of the branch comparison function I'm about to add it would be useful to track the value of SRCREV, so we can see if it has changed even if PV hasn't. Signed-off-by: Paul Eggleton --- layerindex/migrations/0043_recipe_srcrev.py | 20 ++++++++++++++++++++ layerindex/models.py | 1 + layerindex/update_layer.py | 4 ++++ templates/layerindex/recipedetail.html | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 layerindex/migrations/0043_recipe_srcrev.py diff --git a/layerindex/migrations/0043_recipe_srcrev.py b/layerindex/migrations/0043_recipe_srcrev.py new file mode 100644 index 0000000..6429376 --- /dev/null +++ b/layerindex/migrations/0043_recipe_srcrev.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.22 on 2019-10-20 22:15 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('layerindex', '0042_recipe_pe_pr'), + ] + + operations = [ + migrations.AddField( + model_name='recipe', + name='srcrev', + field=models.CharField(blank=True, max_length=64), + ), + ] diff --git a/layerindex/models.py b/layerindex/models.py index 332ba39..253c725 100644 --- a/layerindex/models.py +++ b/layerindex/models.py @@ -475,6 +475,7 @@ class Recipe(models.Model): updated = models.DateTimeField(auto_now=True) blacklisted = models.CharField(max_length=255, blank=True) configopts = models.CharField(max_length=4096, blank=True) + srcrev = models.CharField(max_length=64, blank=True) def vcs_web_url(self): url = self.layerbranch.file_url(os.path.join(self.filepath, self.filename)) diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py index fcae54f..1709837 100644 --- a/layerindex/update_layer.py +++ b/layerindex/update_layer.py @@ -110,6 +110,10 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir, sto recipe.pv = envdata.getVar("PV", True) recipe.pr = envdata.getVar("PR", True) or "" recipe.pe = envdata.getVar("PE", True) or "" + recipe.srcrev = envdata.getVar('SRCREV', True) or '' + if recipe.srcrev == 'INVALID': + # INVALID is the default from bitbake.conf, but we don't want to see it + recipe.srcrev = '' recipe.summary = envdata.getVar("SUMMARY", True) recipe.description = envdata.getVar("DESCRIPTION", True) recipe.section = envdata.getVar("SECTION", True) diff --git a/templates/layerindex/recipedetail.html b/templates/layerindex/recipedetail.html index b3ba65e..6446386 100644 --- a/templates/layerindex/recipedetail.html +++ b/templates/layerindex/recipedetail.html @@ -54,7 +54,7 @@ Version - {{ recipe.pv }} + {{ recipe.pv }}{% if recipe.srcrev %} ({{ recipe.srcrev }}){% endif %} Summary