diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-12-05 15:14:20 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-18 10:24:06 +0000 |
commit | f99f2cdd69f1015953a7e9ab07af46dd63e50ad4 (patch) | |
tree | f7f13e4ef5e92f6158d405887da187ad07b5f7ec /bitbake/lib/toaster/orm/models.py | |
parent | c467bbd841d6ef2caae7fb2693456c50584d23ec (diff) | |
download | poky-f99f2cdd69f1015953a7e9ab07af46dd63e50ad4.tar.gz |
bitbake: add build artifacts table and other improvements
We add a BuildArtifacts class to store data about files
discovered during the build process and not stored anywhere
else.
Small cosmetic changes in the toasterui.
Add model methods to return file path display data relative
to the build environment instead of absolute file paths.
[YOCTO #6834]
(Bitbake rev: bbe24d912869312d561be199b2c029b0c898e049)
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 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 34d37542e1..f5c600ba9f 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -25,6 +25,7 @@ from django.utils import timezone | |||
25 | 25 | ||
26 | 26 | ||
27 | from django.core import validators | 27 | from django.core import validators |
28 | from django.conf import settings | ||
28 | 29 | ||
29 | class GitURLValidator(validators.URLValidator): | 30 | class GitURLValidator(validators.URLValidator): |
30 | import re | 31 | import re |
@@ -183,6 +184,28 @@ class Build(models.Model): | |||
183 | return self.logmessage_set.filter(level=LogMessage.EXCEPTION) | 184 | return self.logmessage_set.filter(level=LogMessage.EXCEPTION) |
184 | 185 | ||
185 | 186 | ||
187 | # an Artifact is anything that results from a Build, and may be of interest to the user, and is not stored elsewhere | ||
188 | class BuildArtifact(models.Model): | ||
189 | build = models.ForeignKey(Build) | ||
190 | file_name = models.FilePathField() | ||
191 | file_size = models.IntegerField() | ||
192 | |||
193 | |||
194 | def get_local_file_name(self): | ||
195 | try: | ||
196 | deploydir = Variable.objects.get(build = self.build, variable_name="DEPLOY_DIR").variable_value | ||
197 | return self.file_name[len(deploydir)+1:] | ||
198 | except: | ||
199 | raise | ||
200 | |||
201 | return self.file_name | ||
202 | |||
203 | |||
204 | def is_available(self): | ||
205 | if settings.MANAGED and build.project is not None: | ||
206 | return build.buildrequest.environment.has_artifact(file_path) | ||
207 | return False | ||
208 | |||
186 | class ProjectTarget(models.Model): | 209 | class ProjectTarget(models.Model): |
187 | project = models.ForeignKey(Project) | 210 | project = models.ForeignKey(Project) |
188 | target = models.CharField(max_length=100) | 211 | target = models.CharField(max_length=100) |
@@ -457,6 +480,12 @@ class Recipe(models.Model): | |||
457 | def __unicode__(self): | 480 | def __unicode__(self): |
458 | return "Recipe " + self.name + ":" + self.version | 481 | return "Recipe " + self.name + ":" + self.version |
459 | 482 | ||
483 | def get_local_path(self): | ||
484 | if settings.MANAGED and self.layer_version.build.project is not None: | ||
485 | return self.file_path[len(self.layer_version.layer.local_path)+1:] | ||
486 | |||
487 | return self.file_path | ||
488 | |||
460 | class Meta: | 489 | class Meta: |
461 | unique_together = ("layer_version", "file_path") | 490 | unique_together = ("layer_version", "file_path") |
462 | 491 | ||