diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-05-14 16:44:27 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-29 11:59:44 +0100 |
commit | 56c5ff920c93a627f6bd473383ab4bbca912fc41 (patch) | |
tree | 7a193c508fe8e74786a0d21c6877aef1fd88bbae /bitbake/lib/toaster/orm/models.py | |
parent | e3e85bdf7100cc5619d7f184dc8d9e2a77a03364 (diff) | |
download | poky-56c5ff920c93a627f6bd473383ab4bbca912fc41.tar.gz |
bitbake: toaster logger: assign projects to all builds
Bitbake logger now sets a default project if the TOASTER_BRBE
or TOASTER_PROJECT Bitbake variables are not set.
This a necessary step in getting all builds under a project,
as to unify the MANAGED and interactive modes.
Other small fixes are included, related to the size of the
fields in the database.
(Bitbake rev: 5e0bf388f4e5c1cc493ac8264785e631bad2f672)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 29ede657c8..0f725764d5 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -81,15 +81,18 @@ class ProjectManager(models.Manager): | |||
81 | def create(self, *args, **kwargs): | 81 | def create(self, *args, **kwargs): |
82 | raise Exception("Invalid call to Project.objects.create. Use Project.objects.create_project() to create a project") | 82 | raise Exception("Invalid call to Project.objects.create. Use Project.objects.create_project() to create a project") |
83 | 83 | ||
84 | def get_or_create(self, *args, **kwargs): | 84 | def get_or_create(self, **kwargs): |
85 | # allow project creation for default data | ||
86 | if 'pk' in kwargs and kwargs['pk'] == 0: | ||
87 | return super(ProjectManager, self).get_or_create(**kwargs) | ||
85 | raise Exception("Invalid call to Project.objects.get_or_create. Use Project.objects.create_project() to create a project") | 88 | raise Exception("Invalid call to Project.objects.get_or_create. Use Project.objects.create_project() to create a project") |
86 | 89 | ||
87 | class Project(models.Model): | 90 | class Project(models.Model): |
88 | search_allowed_fields = ['name', 'short_description', 'release__name', 'release__branch_name'] | 91 | search_allowed_fields = ['name', 'short_description', 'release__name', 'release__branch_name'] |
89 | name = models.CharField(max_length=100) | 92 | name = models.CharField(max_length=100) |
90 | short_description = models.CharField(max_length=50, blank=True) | 93 | short_description = models.CharField(max_length=50, blank=True) |
91 | bitbake_version = models.ForeignKey('BitbakeVersion') | 94 | bitbake_version = models.ForeignKey('BitbakeVersion', null=True) |
92 | release = models.ForeignKey("Release") | 95 | release = models.ForeignKey("Release", null=True) |
93 | created = models.DateTimeField(auto_now_add = True) | 96 | created = models.DateTimeField(auto_now_add = True) |
94 | updated = models.DateTimeField(auto_now = True) | 97 | updated = models.DateTimeField(auto_now = True) |
95 | # This is a horrible hack; since Toaster has no "User" model available when | 98 | # This is a horrible hack; since Toaster has no "User" model available when |
@@ -223,7 +226,7 @@ class Build(models.Model): | |||
223 | 226 | ||
224 | search_allowed_fields = ['machine', 'cooker_log_path', "target__target", "target__target_image_file__file_name"] | 227 | search_allowed_fields = ['machine', 'cooker_log_path', "target__target", "target__target_image_file__file_name"] |
225 | 228 | ||
226 | project = models.ForeignKey(Project, null = True) | 229 | project = models.ForeignKey(Project) # must have a project |
227 | machine = models.CharField(max_length=100) | 230 | machine = models.CharField(max_length=100) |
228 | distro = models.CharField(max_length=100) | 231 | distro = models.CharField(max_length=100) |
229 | distro_version = models.CharField(max_length=100) | 232 | distro_version = models.CharField(max_length=100) |
@@ -435,8 +438,8 @@ class Task(models.Model): | |||
435 | script_type = models.IntegerField(choices=TASK_CODING, default=CODING_NA) | 438 | script_type = models.IntegerField(choices=TASK_CODING, default=CODING_NA) |
436 | line_number = models.IntegerField(default=0) | 439 | line_number = models.IntegerField(default=0) |
437 | disk_io = models.IntegerField(null=True) | 440 | disk_io = models.IntegerField(null=True) |
438 | cpu_usage = models.DecimalField(max_digits=6, decimal_places=2, null=True) | 441 | cpu_usage = models.DecimalField(max_digits=8, decimal_places=2, null=True) |
439 | elapsed_time = models.DecimalField(max_digits=6, decimal_places=2, null=True) | 442 | elapsed_time = models.DecimalField(max_digits=8, decimal_places=2, null=True) |
440 | sstate_result = models.IntegerField(choices=SSTATE_RESULT, default=SSTATE_NA) | 443 | sstate_result = models.IntegerField(choices=SSTATE_RESULT, default=SSTATE_NA) |
441 | message = models.CharField(max_length=240) | 444 | message = models.CharField(max_length=240) |
442 | logfile = models.FilePathField(max_length=255, blank=True) | 445 | logfile = models.FilePathField(max_length=255, blank=True) |