[yocto] [layerindex-web][PATCH 1/3] Track SRCREV for each recipe

Paul Eggleton paul.eggleton at linux.intel.com
Sun Oct 20 15:49:50 PDT 2019


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 <paul.eggleton at linux.intel.com>
---
 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 00000000..64293767
--- /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 332ba39e..253c725c 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 fcae54f8..17098379 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 b3ba65eb..64463863 100644
--- a/templates/layerindex/recipedetail.html
+++ b/templates/layerindex/recipedetail.html
@@ -54,7 +54,7 @@
                         </tr>
                         <tr>
                             <th>Version</th>
-                            <td>{{ recipe.pv }}</td>
+                            <td>{{ recipe.pv }}{% if recipe.srcrev %} ({{ recipe.srcrev }}){% endif %}</td>
                         </tr>
                         <tr>
                             <th>Summary</th>
-- 
2.20.1



More information about the yocto mailing list