summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-01-09 09:46:40 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commitebceecb7fd91714e8925c4fbcc05ccdf8012181d (patch)
treeb027ed88181657cb4a5cdc1acc955008b924dbf3
parentc183b360ff07673f00d0f4f224ced3c46fd87381 (diff)
downloadopenembedded-core-contrib-ebceecb7fd91714e8925c4fbcc05ccdf8012181d.tar.gz
openembedded-core-contrib-ebceecb7fd91714e8925c4fbcc05ccdf8012181d.tar.bz2
openembedded-core-contrib-ebceecb7fd91714e8925c4fbcc05ccdf8012181d.zip
Save recipe source URLs
Save each remote SRC_URI so we can use these for the recipe reporting system. This replaces an earlier implementation in the rrs branch where we simply stored SRC_URI verbatim. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--layerindex/admin.py4
-rw-r--r--layerindex/migrations/0011_source.py22
-rw-r--r--layerindex/models.py7
-rw-r--r--layerindex/update_layer.py15
4 files changed, 47 insertions, 1 deletions
diff --git a/layerindex/admin.py b/layerindex/admin.py
index aed9a5d961..e923d0c1fe 100644
--- a/layerindex/admin.py
+++ b/layerindex/admin.py
@@ -112,6 +112,9 @@ class DynamicBuildDepAdmin(admin.ModelAdmin):
search_fields = ['name']
filter_horizontal = ('package_configs',)
+class SourceAdmin(admin.ModelAdmin):
+ pass
+
class ClassicRecipeAdmin(admin.ModelAdmin):
search_fields = ['filename', 'pn']
list_filter = ['layerbranch__layer__name', 'layerbranch__branch__name']
@@ -184,6 +187,7 @@ admin.site.register(LayerUpdate, LayerUpdateAdmin)
admin.site.register(PackageConfig, PackageConfigAdmin)
admin.site.register(StaticBuildDep, StaticBuildDepAdmin)
admin.site.register(DynamicBuildDep, DynamicBuildDepAdmin)
+admin.site.register(Source, SourceAdmin)
admin.site.register(Recipe, RecipeAdmin)
admin.site.register(RecipeFileDependency)
admin.site.register(Machine, MachineAdmin)
diff --git a/layerindex/migrations/0011_source.py b/layerindex/migrations/0011_source.py
new file mode 100644
index 0000000000..515e71cf28
--- /dev/null
+++ b/layerindex/migrations/0011_source.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('layerindex', '0010_add_dependencies'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Source',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
+ ('url', models.CharField(max_length=255)),
+ ('recipe', models.ForeignKey(to='layerindex.Recipe')),
+ ],
+ ),
+ ]
diff --git a/layerindex/models.py b/layerindex/models.py
index 2b9601a299..84d2e09d6f 100644
--- a/layerindex/models.py
+++ b/layerindex/models.py
@@ -378,6 +378,13 @@ class Recipe(models.Model):
def __str__(self):
return os.path.join(self.filepath, self.filename)
+class Source(models.Model):
+ recipe = models.ForeignKey(Recipe)
+ url = models.CharField(max_length=255)
+
+ def __str__(self):
+ return '%s - %s' % (self.recipe.pn, self.url)
+
class PackageConfig(models.Model):
recipe = models.ForeignKey(Recipe)
feature = models.CharField(max_length=255)
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index 69ca3c64ce..ecb7cbf9d7 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -59,7 +59,7 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir):
from django.db import DatabaseError
fn = str(os.path.join(path, recipe.filename))
- from layerindex.models import PackageConfig, StaticBuildDep, DynamicBuildDep
+ from layerindex.models import PackageConfig, StaticBuildDep, DynamicBuildDep, Source
try:
logger.debug('Updating recipe %s' % fn)
if hasattr(tinfoil, 'parse_recipe_file'):
@@ -92,6 +92,19 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir):
static_build_dependency.save()
static_build_dependency.recipes.add(recipe)
+ # Handle sources
+ old_urls = list(recipe.source_set.values_list('url', flat=True))
+ for url in (envdata.getVar('SRC_URI', True) or '').split():
+ if not url.startswith('file://'):
+ url = url.split(';')[0]
+ if url in old_urls:
+ old_urls.remove(url)
+ else:
+ src = Source(recipe=recipe, url=url)
+ src.save()
+ for url in old_urls:
+ recipe.source_set.filter(url=url).delete()
+
# Handle the PACKAGECONFIG variables for this recipe
PackageConfig.objects.filter(recipe=recipe).delete()
package_config_VarFlags = envdata.getVarFlags("PACKAGECONFIG")