summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json1
-rw-r--r--bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py154
-rw-r--r--bitbake/lib/toaster/bldcontrol/migrations/__init__.py0
-rw-r--r--bitbake/lib/toaster/bldcontrol/models.py80
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py1
5 files changed, 235 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json b/bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json
new file mode 100644
index 0000000000..21883abd5c
--- /dev/null
+++ b/bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json
@@ -0,0 +1 @@
[{"pk": 1, "model": "bldcontrol.buildenvironment", "fields": {"updated": "2014-05-20T12:17:30Z", "created": "2014-05-20T12:17:30Z", "lock": 0, "bbstate": 0, "bbaddress": "", "betype": 0, "bbtoken": "", "address": "localhost", "bbport": -1}}]
diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py b/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py
new file mode 100644
index 0000000000..9f13d14b2a
--- /dev/null
+++ b/bitbake/lib/toaster/bldcontrol/migrations/0001_initial.py
@@ -0,0 +1,154 @@
1# -*- coding: utf-8 -*-
2from south.utils import datetime_utils as datetime
3from south.db import db
4from south.v2 import SchemaMigration
5from django.db import models
6
7
8class Migration(SchemaMigration):
9
10 def forwards(self, orm):
11 # Adding model 'BuildEnvironment'
12 db.create_table(u'bldcontrol_buildenvironment', (
13 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('address', self.gf('django.db.models.fields.CharField')(max_length=254)),
15 ('betype', self.gf('django.db.models.fields.IntegerField')()),
16 ('bbaddress', self.gf('django.db.models.fields.CharField')(max_length=254, blank=True)),
17 ('bbport', self.gf('django.db.models.fields.IntegerField')(default=-1)),
18 ('bbtoken', self.gf('django.db.models.fields.CharField')(max_length=126, blank=True)),
19 ('bbstate', self.gf('django.db.models.fields.IntegerField')(default=0)),
20 ('lock', self.gf('django.db.models.fields.IntegerField')(default=0)),
21 ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
22 ('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
23 ))
24 db.send_create_signal(u'bldcontrol', ['BuildEnvironment'])
25
26 # Adding model 'BuildRequest'
27 db.create_table(u'bldcontrol_buildrequest', (
28 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
29 ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Project'])),
30 ('build', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Build'], null=True)),
31 ('state', self.gf('django.db.models.fields.IntegerField')(default=0)),
32 ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
33 ('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
34 ))
35 db.send_create_signal(u'bldcontrol', ['BuildRequest'])
36
37 # Adding model 'BRLayer'
38 db.create_table(u'bldcontrol_brlayer', (
39 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
40 ('req', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['bldcontrol.BuildRequest'])),
41 ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
42 ('giturl', self.gf('django.db.models.fields.CharField')(max_length=254)),
43 ('commit', self.gf('django.db.models.fields.CharField')(max_length=254)),
44 ))
45 db.send_create_signal(u'bldcontrol', ['BRLayer'])
46
47 # Adding model 'BRVariable'
48 db.create_table(u'bldcontrol_brvariable', (
49 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
50 ('req', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['bldcontrol.BuildRequest'])),
51 ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
52 ('value', self.gf('django.db.models.fields.TextField')(blank=True)),
53 ))
54 db.send_create_signal(u'bldcontrol', ['BRVariable'])
55
56 # Adding model 'BRTarget'
57 db.create_table(u'bldcontrol_brtarget', (
58 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
59 ('req', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['bldcontrol.BuildRequest'])),
60 ('target', self.gf('django.db.models.fields.CharField')(max_length=100)),
61 ('task', self.gf('django.db.models.fields.CharField')(max_length=100, null=True)),
62 ))
63 db.send_create_signal(u'bldcontrol', ['BRTarget'])
64
65
66 def backwards(self, orm):
67 # Deleting model 'BuildEnvironment'
68 db.delete_table(u'bldcontrol_buildenvironment')
69
70 # Deleting model 'BuildRequest'
71 db.delete_table(u'bldcontrol_buildrequest')
72
73 # Deleting model 'BRLayer'
74 db.delete_table(u'bldcontrol_brlayer')
75
76 # Deleting model 'BRVariable'
77 db.delete_table(u'bldcontrol_brvariable')
78
79 # Deleting model 'BRTarget'
80 db.delete_table(u'bldcontrol_brtarget')
81
82
83 models = {
84 u'bldcontrol.brlayer': {
85 'Meta': {'object_name': 'BRLayer'},
86 'commit': ('django.db.models.fields.CharField', [], {'max_length': '254'}),
87 'giturl': ('django.db.models.fields.CharField', [], {'max_length': '254'}),
88 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
89 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
90 'req': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['bldcontrol.BuildRequest']"})
91 },
92 u'bldcontrol.brtarget': {
93 'Meta': {'object_name': 'BRTarget'},
94 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
95 'req': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['bldcontrol.BuildRequest']"}),
96 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
97 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
98 },
99 u'bldcontrol.brvariable': {
100 'Meta': {'object_name': 'BRVariable'},
101 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
102 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
103 'req': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['bldcontrol.BuildRequest']"}),
104 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
105 },
106 u'bldcontrol.buildenvironment': {
107 'Meta': {'object_name': 'BuildEnvironment'},
108 'address': ('django.db.models.fields.CharField', [], {'max_length': '254'}),
109 'bbaddress': ('django.db.models.fields.CharField', [], {'max_length': '254', 'blank': 'True'}),
110 'bbport': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
111 'bbstate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
112 'bbtoken': ('django.db.models.fields.CharField', [], {'max_length': '126', 'blank': 'True'}),
113 'betype': ('django.db.models.fields.IntegerField', [], {}),
114 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
115 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116 'lock': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
117 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
118 },
119 u'bldcontrol.buildrequest': {
120 'Meta': {'object_name': 'BuildRequest'},
121 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']", 'null': 'True'}),
122 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
123 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
124 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
125 'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
126 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
127 },
128 u'orm.build': {
129 'Meta': {'object_name': 'Build'},
130 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
131 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
132 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
133 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
134 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
135 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
136 'errors_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
137 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
138 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
139 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
140 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']", 'null': 'True'}),
141 'started_on': ('django.db.models.fields.DateTimeField', [], {}),
142 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
143 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'})
144 },
145 u'orm.project': {
146 'Meta': {'object_name': 'Project'},
147 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
148 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
149 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
150 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
151 }
152 }
153
154 complete_apps = ['bldcontrol'] \ No newline at end of file
diff --git a/bitbake/lib/toaster/bldcontrol/migrations/__init__.py b/bitbake/lib/toaster/bldcontrol/migrations/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/bldcontrol/migrations/__init__.py
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py
index 71a8362390..11f487c9b6 100644
--- a/bitbake/lib/toaster/bldcontrol/models.py
+++ b/bitbake/lib/toaster/bldcontrol/models.py
@@ -1,3 +1,81 @@
1from django.db import models 1from django.db import models
2from django.core.validators import MaxValueValidator, MinValueValidator
3from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build
4
5# a BuildEnvironment is the equivalent of the "build/" directory on the localhost
6class BuildEnvironment(models.Model):
7 SERVER_STOPPED = 0
8 SERVER_STARTED = 1
9 SERVER_STATE = (
10 (SERVER_STOPPED, "stopped"),
11 (SERVER_STARTED, "started"),
12 )
13
14 TYPE_LOCAL = 0
15 TYPE_SSH = 1
16 TYPE = (
17 (TYPE_LOCAL, "local"),
18 (TYPE_SSH, "ssh"),
19 )
20
21 LOCK_FREE = 0
22 LOCK_LOCK = 1
23 LOCK_STATE = (
24 (LOCK_FREE, "free"),
25 (LOCK_LOCK, "lock"),
26 )
27
28 address = models.CharField(max_length = 254)
29 betype = models.IntegerField(choices = TYPE)
30 bbaddress = models.CharField(max_length = 254, blank = True)
31 bbport = models.IntegerField(default = -1)
32 bbtoken = models.CharField(max_length = 126, blank = True)
33 bbstate = models.IntegerField(choices = SERVER_STATE, default = SERVER_STOPPED)
34 lock = models.IntegerField(choices = LOCK_STATE, default = LOCK_FREE)
35 created = models.DateTimeField(auto_now_add = True)
36 updated = models.DateTimeField(auto_now = True)
37
38
39# a BuildRequest is a request that the scheduler will build using a BuildEnvironment
40# the build request queue is the table itself, ordered by state
41
42class BuildRequest(models.Model):
43 REQ_CREATED = 0
44 REQ_QUEUED = 1
45 REQ_INPROGRESS = 2
46 REQ_COMPLETED = 3
47
48 REQUEST_STATE = (
49 (REQ_CREATED, "created"),
50 (REQ_QUEUED, "queued"),
51 (REQ_INPROGRESS, "in progress"),
52 (REQ_COMPLETED, "completed"),
53 )
54
55 project = models.ForeignKey(Project)
56 build = models.ForeignKey(Build, null = True) # TODO: toasterui should set this when Build is created
57 state = models.IntegerField(choices = REQUEST_STATE, default = REQ_CREATED)
58 created = models.DateTimeField(auto_now_add = True)
59 updated = models.DateTimeField(auto_now = True)
60
61
62# These tables specify the settings for running an actual build.
63# They MUST be kept in sync with the tables in orm.models.Project*
64
65class BRLayer(models.Model):
66 req = models.ForeignKey(BuildRequest)
67 name = models.CharField(max_length = 100)
68 giturl = models.CharField(max_length = 254)
69 commit = models.CharField(max_length = 254)
70
71class BRVariable(models.Model):
72 req = models.ForeignKey(BuildRequest)
73 name = models.CharField(max_length=100)
74 value = models.TextField(blank = True)
75
76class BRTarget(models.Model):
77 req = models.ForeignKey(BuildRequest)
78 target = models.CharField(max_length=100)
79 task = models.CharField(max_length=100, null=True)
80
2 81
3# Create your models here.
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index adaa56ca17..2c52b6888b 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -221,6 +221,7 @@ INSTALLED_APPS = (
221 'toastergui', 221 'toastergui',
222 'bldviewer', 222 'bldviewer',
223 'south', 223 'south',
224 'bldcontrol',
224) 225)
225 226
226# A sample logging configuration. The only tangible logging 227# A sample logging configuration. The only tangible logging