mirror of
https://git.yoctoproject.org/poky
synced 2026-09-12 15:49:36 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
c467bbd841
commit
f99f2cdd69
@@ -25,6 +25,7 @@ from django.utils import timezone
|
||||
|
||||
|
||||
from django.core import validators
|
||||
from django.conf import settings
|
||||
|
||||
class GitURLValidator(validators.URLValidator):
|
||||
import re
|
||||
@@ -183,6 +184,28 @@ class Build(models.Model):
|
||||
return self.logmessage_set.filter(level=LogMessage.EXCEPTION)
|
||||
|
||||
|
||||
# an Artifact is anything that results from a Build, and may be of interest to the user, and is not stored elsewhere
|
||||
class BuildArtifact(models.Model):
|
||||
build = models.ForeignKey(Build)
|
||||
file_name = models.FilePathField()
|
||||
file_size = models.IntegerField()
|
||||
|
||||
|
||||
def get_local_file_name(self):
|
||||
try:
|
||||
deploydir = Variable.objects.get(build = self.build, variable_name="DEPLOY_DIR").variable_value
|
||||
return self.file_name[len(deploydir)+1:]
|
||||
except:
|
||||
raise
|
||||
|
||||
return self.file_name
|
||||
|
||||
|
||||
def is_available(self):
|
||||
if settings.MANAGED and build.project is not None:
|
||||
return build.buildrequest.environment.has_artifact(file_path)
|
||||
return False
|
||||
|
||||
class ProjectTarget(models.Model):
|
||||
project = models.ForeignKey(Project)
|
||||
target = models.CharField(max_length=100)
|
||||
@@ -457,6 +480,12 @@ class Recipe(models.Model):
|
||||
def __unicode__(self):
|
||||
return "Recipe " + self.name + ":" + self.version
|
||||
|
||||
def get_local_path(self):
|
||||
if settings.MANAGED and self.layer_version.build.project is not None:
|
||||
return self.file_path[len(self.layer_version.layer.local_path)+1:]
|
||||
|
||||
return self.file_path
|
||||
|
||||
class Meta:
|
||||
unique_together = ("layer_version", "file_path")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user