diff options
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/models.py')
| -rw-r--r-- | bitbake/lib/toaster/bldcontrol/models.py | 80 |
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 @@ | |||
| 1 | from django.db import models | 1 | from django.db import models |
| 2 | from django.core.validators import MaxValueValidator, MinValueValidator | ||
| 3 | from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build | ||
| 4 | |||
| 5 | # a BuildEnvironment is the equivalent of the "build/" directory on the localhost | ||
| 6 | class 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 | |||
| 42 | class 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 | |||
| 65 | class 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 | |||
| 71 | class BRVariable(models.Model): | ||
| 72 | req = models.ForeignKey(BuildRequest) | ||
| 73 | name = models.CharField(max_length=100) | ||
| 74 | value = models.TextField(blank = True) | ||
| 75 | |||
| 76 | class 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. | ||
