summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py')
-rw-r--r--import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py b/import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py
index cb49a58c4..409614b9e 100644
--- a/import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py
+++ b/import-layers/yocto-poky/bitbake/lib/toaster/bldcontrol/models.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
-from django.utils.encoding import force_bytes
+from django.utils.encoding import force_text
from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version
import logging
@@ -63,20 +63,20 @@ class BuildRequest(models.Model):
REQ_CREATED = 0
REQ_QUEUED = 1
REQ_INPROGRESS = 2
- REQ_COMPLETED = 3
- REQ_FAILED = 4
- REQ_DELETED = 5
- REQ_CANCELLING = 6
+ REQ_FAILED = 3
+ REQ_DELETED = 4
+ REQ_CANCELLING = 5
+ REQ_COMPLETED = 6
REQ_ARCHIVE = 7
REQUEST_STATE = (
(REQ_CREATED, "created"),
(REQ_QUEUED, "queued"),
(REQ_INPROGRESS, "in progress"),
- (REQ_COMPLETED, "completed"),
(REQ_FAILED, "failed"),
(REQ_DELETED, "deleted"),
(REQ_CANCELLING, "cancelling"),
+ (REQ_COMPLETED, "completed"),
(REQ_ARCHIVE, "archive"),
)
@@ -91,18 +91,18 @@ class BuildRequest(models.Model):
def __init__(self, *args, **kwargs):
super(BuildRequest, self).__init__(*args, **kwargs)
- # Save the old state incase it's about to be modified
+ # Save the old state in case it's about to be modified
self.old_state = self.state
def save(self, *args, **kwargs):
# Check that the state we're trying to set is not going backwards
# e.g. from REQ_FAILED to REQ_INPROGRESS
if self.old_state != self.state and self.old_state > self.state:
- logger.warn("Invalid state change requested: "
- "Cannot go from %s to %s - ignoring request" %
- (BuildRequest.REQUEST_STATE[self.old_state][1],
- BuildRequest.REQUEST_STATE[self.state][1])
- )
+ logger.warning("Invalid state change requested: "
+ "Cannot go from %s to %s - ignoring request" %
+ (BuildRequest.REQUEST_STATE[self.old_state][1],
+ BuildRequest.REQUEST_STATE[self.state][1])
+ )
# Set property back to the old value
self.state = self.old_state
return
@@ -121,17 +121,19 @@ class BuildRequest(models.Model):
return self.brvariable_set.get(name="MACHINE").value
def __str__(self):
- return force_bytes('%s %s' % (self.project, self.get_state_display()))
+ return force_text('%s %s' % (self.project, self.get_state_display()))
# These tables specify the settings for running an actual build.
# They MUST be kept in sync with the tables in orm.models.Project*
+
class BRLayer(models.Model):
- req = models.ForeignKey(BuildRequest)
- name = models.CharField(max_length = 100)
- giturl = models.CharField(max_length = 254)
- commit = models.CharField(max_length = 254)
- dirpath = models.CharField(max_length = 254)
+ req = models.ForeignKey(BuildRequest)
+ name = models.CharField(max_length=100)
+ giturl = models.CharField(max_length=254, null=True)
+ local_source_dir = models.CharField(max_length=254, null=True)
+ commit = models.CharField(max_length=254, null=True)
+ dirpath = models.CharField(max_length=254, null=True)
layer_version = models.ForeignKey(Layer_Version, null=True)
class BRBitbake(models.Model):
OpenPOWER on IntegriCloud