aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-02-27 17:15:32 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:52 +1200
commit1f49943aee6164ffd734fa1e46d38d2b3d635e31 (patch)
tree1711612d561f30cda92f8d3f832c0d2cdbe13a8d
parent8a9a846d1e601db7fa329540f9b883151b285270 (diff)
downloadopenembedded-core-contrib-1f49943aee6164ffd734fa1e46d38d2b3d635e31.tar.gz
rrs: add maintenance plans
The MaintenancePlan will provide some context for the RRS records so we can effectively enable RRS functionality only on certain layers where we want it. You can also consider the maintenance of multiple layers together under a single plan if desired. Here we add just the MaintenancePlan and the corresponding migration; a non-null link from the Release requires a separate migration and thus that will be done in a separate commit. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--rrs/admin.py14
-rw-r--r--rrs/migrations/0002_maintenanceplan.py33
-rw-r--r--rrs/models.py18
3 files changed, 63 insertions, 2 deletions
diff --git a/rrs/admin.py b/rrs/admin.py
index cef0b8bf25..3f4178f3d5 100644
--- a/rrs/admin.py
+++ b/rrs/admin.py
@@ -9,7 +9,18 @@ from django.contrib.admin import DateFieldListFilter
from rrs.models import Release, Milestone, Maintainer, RecipeMaintainerHistory, \
RecipeMaintainer, RecipeDistro, RecipeUpgrade, RecipeUpstream, \
- RecipeUpstreamHistory
+ RecipeUpstreamHistory, MaintenancePlan, MaintenancePlanLayerBranch
+
+class MaintenancePlanLayerBranchInline(admin.StackedInline):
+ model = MaintenancePlanLayerBranch
+ min_num = 1
+ extra = 0
+
+class MaintenancePlanAdmin(admin.ModelAdmin):
+ model = MaintenancePlan
+ inlines = [
+ MaintenancePlanLayerBranchInline,
+ ]
class ReleaseAdmin(admin.ModelAdmin):
search_fields = ['name']
@@ -58,6 +69,7 @@ class RecipeUpstreamAdmin(admin.ModelAdmin):
'type', ('date', DateFieldListFilter), 'history']
model = RecipeUpstream
+admin.site.register(MaintenancePlan, MaintenancePlanAdmin)
admin.site.register(Release, ReleaseAdmin)
admin.site.register(Milestone, MilestoneAdmin)
admin.site.register(Maintainer, MaintainerAdmin)
diff --git a/rrs/migrations/0002_maintenanceplan.py b/rrs/migrations/0002_maintenanceplan.py
new file mode 100644
index 0000000000..b6718dc7f8
--- /dev/null
+++ b/rrs/migrations/0002_maintenanceplan.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('layerindex', '0010_add_dependencies'),
+ ('rrs', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='MaintenancePlan',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
+ ('name', models.CharField(max_length=50, unique=True)),
+ ('description', models.TextField(blank=True)),
+ ('updates_enabled', models.BooleanField(verbose_name='Enable updates', default=True, help_text='Enable automatically updating metadata for this plan via the update scripts')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='MaintenancePlanLayerBranch',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
+ ('layerbranch', models.ForeignKey(to='layerindex.LayerBranch')),
+ ('plan', models.ForeignKey(to='rrs.MaintenancePlan')),
+ ],
+ options={'verbose_name_plural': 'Maintenance plan layer branches'},
+ ),
+ ]
diff --git a/rrs/models.py b/rrs/models.py
index 7c327fb6ba..ebce4c3b53 100644
--- a/rrs/models.py
+++ b/rrs/models.py
@@ -12,7 +12,23 @@ sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '../
from datetime import date
from django.db import models
-from layerindex.models import Recipe
+from layerindex.models import Recipe, LayerBranch
+
+
+class MaintenancePlan(models.Model):
+ name = models.CharField(max_length=50, unique=True)
+ description = models.TextField(blank=True)
+ updates_enabled = models.BooleanField('Enable updates', default=True, help_text='Enable automatically updating metadata for this plan via the update scripts')
+
+ def __str__(self):
+ return '%s' % (self.name)
+
+class MaintenancePlanLayerBranch(models.Model):
+ plan = models.ForeignKey(MaintenancePlan)
+ layerbranch = models.ForeignKey(LayerBranch)
+
+ class Meta:
+ verbose_name_plural = "Maintenance plan layer branches"
class Release(models.Model):
name = models.CharField(max_length=100, unique=True)