summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r--bitbake/lib/toaster/orm/models.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 1cbf480acd..44a453a58c 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -344,6 +344,9 @@ class Build(models.Model):
344 tgts = Target.objects.filter(build_id = self.id).order_by( 'target' ); 344 tgts = Target.objects.filter(build_id = self.id).order_by( 'target' );
345 return( tgts ); 345 return( tgts );
346 346
347 def get_outcome_text(self):
348 return Build.BUILD_OUTCOME[int(self.outcome)][1]
349
347 @property 350 @property
348 def toaster_exceptions(self): 351 def toaster_exceptions(self):
349 return self.logmessage_set.filter(level=LogMessage.EXCEPTION) 352 return self.logmessage_set.filter(level=LogMessage.EXCEPTION)
@@ -361,10 +364,23 @@ class Build(models.Model):
361 return (self.completed_on - self.started_on).total_seconds() 364 return (self.completed_on - self.started_on).total_seconds()
362 365
363 def get_current_status(self): 366 def get_current_status(self):
367 """
368 get the status string from the build request if the build
369 has one, or the text for the build outcome if it doesn't
370 """
371
364 from bldcontrol.models import BuildRequest 372 from bldcontrol.models import BuildRequest
365 if self.outcome == Build.IN_PROGRESS and self.buildrequest.state != BuildRequest.REQ_INPROGRESS: 373
374 build_request = None
375 if hasattr(self, 'buildrequest'):
376 build_request = self.buildrequest
377
378 if (build_request
379 and build_request.state != BuildRequest.REQ_INPROGRESS
380 and self.outcome == Build.IN_PROGRESS):
366 return self.buildrequest.get_state_display() 381 return self.buildrequest.get_state_display()
367 return self.get_outcome_display() 382 else:
383 return self.get_outcome_text()
368 384
369 def __str__(self): 385 def __str__(self):
370 return "%d %s %s" % (self.id, self.project, ",".join([t.target for t in self.target_set.all()])) 386 return "%d %s %s" % (self.id, self.project, ",".join([t.target for t in self.target_set.all()]))