summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/models.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/models.py98
1 files changed, 98 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py
new file mode 100644
index 0000000000..4c54a59b1a
--- /dev/null
+++ b/bitbake/lib/toaster/bldcontrol/models.py
@@ -0,0 +1,98 @@
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_RUNNING = 2
24 LOCK_STATE = (
25 (LOCK_FREE, "free"),
26 (LOCK_LOCK, "lock"),
27 (LOCK_RUNNING, "running"),
28 )
29
30 address = models.CharField(max_length = 254)
31 betype = models.IntegerField(choices = TYPE)
32 bbaddress = models.CharField(max_length = 254, blank = True)
33 bbport = models.IntegerField(default = -1)
34 bbtoken = models.CharField(max_length = 126, blank = True)
35 bbstate = models.IntegerField(choices = SERVER_STATE, default = SERVER_STOPPED)
36 sourcedir = models.CharField(max_length = 512, blank = True)
37 builddir = models.CharField(max_length = 512, blank = True)
38 lock = models.IntegerField(choices = LOCK_STATE, default = LOCK_FREE)
39 created = models.DateTimeField(auto_now_add = True)
40 updated = models.DateTimeField(auto_now = True)
41
42
43# a BuildRequest is a request that the scheduler will build using a BuildEnvironment
44# the build request queue is the table itself, ordered by state
45
46class BuildRequest(models.Model):
47 REQ_CREATED = 0
48 REQ_QUEUED = 1
49 REQ_INPROGRESS = 2
50 REQ_COMPLETED = 3
51 REQ_FAILED = 4
52
53 REQUEST_STATE = (
54 (REQ_CREATED, "created"),
55 (REQ_QUEUED, "queued"),
56 (REQ_INPROGRESS, "in progress"),
57 (REQ_COMPLETED, "completed"),
58 (REQ_FAILED, "failed"),
59 )
60
61 project = models.ForeignKey(Project)
62 build = models.ForeignKey(Build, null = True) # TODO: toasterui should set this when Build is created
63 state = models.IntegerField(choices = REQUEST_STATE, default = REQ_CREATED)
64 created = models.DateTimeField(auto_now_add = True)
65 updated = models.DateTimeField(auto_now = True)
66
67
68# These tables specify the settings for running an actual build.
69# They MUST be kept in sync with the tables in orm.models.Project*
70
71class BRLayer(models.Model):
72 req = models.ForeignKey(BuildRequest)
73 name = models.CharField(max_length = 100)
74 giturl = models.CharField(max_length = 254)
75 commit = models.CharField(max_length = 254)
76 dirpath = models.CharField(max_length = 254)
77
78class BRBitbake(models.Model):
79 req = models.ForeignKey(BuildRequest, unique = True) # only one bitbake for a request
80 giturl = models.CharField(max_length =254)
81 commit = models.CharField(max_length = 254)
82 dirpath = models.CharField(max_length = 254)
83
84class BRVariable(models.Model):
85 req = models.ForeignKey(BuildRequest)
86 name = models.CharField(max_length=100)
87 value = models.TextField(blank = True)
88
89class BRTarget(models.Model):
90 req = models.ForeignKey(BuildRequest)
91 target = models.CharField(max_length=100)
92 task = models.CharField(max_length=100, null=True)
93
94class BRError(models.Model):
95 req = models.ForeignKey(BuildRequest)
96 errtype = models.CharField(max_length=100)
97 errmsg = models.TextField()
98 traceback = models.TextField()