summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/models.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-06-09 12:55:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-06-13 11:55:33 +0100
commit3bd8e9adc82e81fbf387446c5ac93c7eca01157b (patch)
tree52b6a69b401e5ccf5c746c4a7eec1689d91b0668 /bitbake/lib/toaster/bldcontrol/models.py
parente09cb4017a6c8dcb94d38c154f5bf77225e25445 (diff)
downloadpoky-3bd8e9adc82e81fbf387446c5ac93c7eca01157b.tar.gz
bitbake: toaster: create models for bldcontrol and enable it
We create the model classes that store information about triggering builds, and the available build environments. We add a fixture with a default build environment for build control, using a "build/" directory under the poky checkout directory. We enable the bldcontrol in toaster starting script and in the toaster settings as to allow the actual database to be kept in sync with the source code. (Bitbake rev: d4bfe9059f765f11244b97e324c0131f32f8e400) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/models.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/models.py80
1 files changed, 79 insertions, 1 deletions
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.