diff options
Diffstat (limited to 'bitbake/lib/toaster/orm')
3 files changed, 59 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py b/bitbake/lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py new file mode 100644 index 0000000000..cc5c96d2dd --- /dev/null +++ b/bitbake/lib/toaster/orm/migrations/0013_recipe_parse_progress_fields.py | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from __future__ import unicode_literals | ||
| 3 | |||
| 4 | from django.db import migrations, models | ||
| 5 | |||
| 6 | |||
| 7 | class Migration(migrations.Migration): | ||
| 8 | |||
| 9 | dependencies = [ | ||
| 10 | ('orm', '0012_use_release_instead_of_up_branch'), | ||
| 11 | ] | ||
| 12 | |||
| 13 | operations = [ | ||
| 14 | migrations.AddField( | ||
| 15 | model_name='build', | ||
| 16 | name='recipes_parsed', | ||
| 17 | field=models.IntegerField(default=0), | ||
| 18 | ), | ||
| 19 | migrations.AddField( | ||
| 20 | model_name='build', | ||
| 21 | name='recipes_to_parse', | ||
| 22 | field=models.IntegerField(default=1), | ||
| 23 | ), | ||
| 24 | ] | ||
diff --git a/bitbake/lib/toaster/orm/migrations/0014_allow_empty_buildname.py b/bitbake/lib/toaster/orm/migrations/0014_allow_empty_buildname.py new file mode 100644 index 0000000000..4749a14b26 --- /dev/null +++ b/bitbake/lib/toaster/orm/migrations/0014_allow_empty_buildname.py | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from __future__ import unicode_literals | ||
| 3 | |||
| 4 | from django.db import migrations, models | ||
| 5 | |||
| 6 | |||
| 7 | class Migration(migrations.Migration): | ||
| 8 | |||
| 9 | dependencies = [ | ||
| 10 | ('orm', '0013_recipe_parse_progress_fields'), | ||
| 11 | ] | ||
| 12 | |||
| 13 | operations = [ | ||
| 14 | migrations.AlterField( | ||
| 15 | model_name='build', | ||
| 16 | name='build_name', | ||
| 17 | field=models.CharField(default='', max_length=100), | ||
| 18 | ), | ||
| 19 | ] | ||
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 2df6d4910a..4641736add 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
| @@ -397,9 +397,15 @@ class Build(models.Model): | |||
| 397 | completed_on = models.DateTimeField() | 397 | completed_on = models.DateTimeField() |
| 398 | outcome = models.IntegerField(choices=BUILD_OUTCOME, default=IN_PROGRESS) | 398 | outcome = models.IntegerField(choices=BUILD_OUTCOME, default=IN_PROGRESS) |
| 399 | cooker_log_path = models.CharField(max_length=500) | 399 | cooker_log_path = models.CharField(max_length=500) |
| 400 | build_name = models.CharField(max_length=100) | 400 | build_name = models.CharField(max_length=100, default='') |
| 401 | bitbake_version = models.CharField(max_length=50) | 401 | bitbake_version = models.CharField(max_length=50) |
| 402 | 402 | ||
| 403 | # number of recipes to parse for this build | ||
| 404 | recipes_to_parse = models.IntegerField(default=1) | ||
| 405 | |||
| 406 | # number of recipes parsed so far for this build | ||
| 407 | recipes_parsed = models.IntegerField(default=0) | ||
| 408 | |||
| 403 | @staticmethod | 409 | @staticmethod |
| 404 | def get_recent(project=None): | 410 | def get_recent(project=None): |
| 405 | """ | 411 | """ |
| @@ -615,6 +621,13 @@ class Build(models.Model): | |||
| 615 | else: | 621 | else: |
| 616 | return False | 622 | return False |
| 617 | 623 | ||
| 624 | def is_parsing(self): | ||
| 625 | """ | ||
| 626 | True if the build is still parsing recipes | ||
| 627 | """ | ||
| 628 | return self.outcome == Build.IN_PROGRESS and \ | ||
| 629 | self.recipes_parsed < self.recipes_to_parse | ||
| 630 | |||
| 618 | def get_state(self): | 631 | def get_state(self): |
| 619 | """ | 632 | """ |
| 620 | Get the state of the build; one of 'Succeeded', 'Failed', 'In Progress', | 633 | Get the state of the build; one of 'Succeeded', 'Failed', 'In Progress', |
| @@ -628,6 +641,8 @@ class Build(models.Model): | |||
| 628 | return 'Cancelling'; | 641 | return 'Cancelling'; |
| 629 | elif self.is_queued(): | 642 | elif self.is_queued(): |
| 630 | return 'Queued' | 643 | return 'Queued' |
| 644 | elif self.is_parsing(): | ||
| 645 | return 'Parsing' | ||
| 631 | else: | 646 | else: |
| 632 | return self.get_outcome_text() | 647 | return self.get_outcome_text() |
| 633 | 648 | ||
