summaryrefslogtreecommitdiffstats
path: root/lib/toaster/bldcontrol/models.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-10-14 13:57:33 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-10-30 13:39:37 +0000
commit5fce7f6e83c6143244faa9618b7ed20c1106e08f (patch)
tree9c41765bbb190798f4f723469f40196654aa39ed /lib/toaster/bldcontrol/models.py
parent7c333350418c4140e6c988c5272940f8057d327d (diff)
downloadbitbake-5fce7f6e83c6143244faa9618b7ed20c1106e08f.tar.gz
toastergui: provide download file capability
We add, for the localhost environments, the capability to download build artifacts. This is a pontentially dangerous API, because it gives unrestricted read access to the build environment file system - do not expose the functionality directly to the web layer, but use filtering/translation code, such as exemplified in the build_artifact view. The capability for remote build environments is dependent on bug 6835, as to use the collect storage as intermediary storage for serving files. [YOCTO #6834] Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'lib/toaster/bldcontrol/models.py')
-rw-r--r--lib/toaster/bldcontrol/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/toaster/bldcontrol/models.py b/lib/toaster/bldcontrol/models.py
index df3635b33..15270c3a5 100644
--- a/lib/toaster/bldcontrol/models.py
+++ b/lib/toaster/bldcontrol/models.py
@@ -40,6 +40,19 @@ class BuildEnvironment(models.Model):
updated = models.DateTimeField(auto_now = True)
+ def get_artifact_type(self, path):
+ if self.betype == BuildEnvironment.TYPE_LOCAL:
+ import magic
+ m = magic.open(magic.MAGIC_MIME_TYPE)
+ m.load()
+ return m.file(path)
+ raise Exception("FIXME: not implemented")
+
+ def get_artifact(self, path):
+ if self.betype == BuildEnvironment.TYPE_LOCAL:
+ return open(path, "r")
+ raise Exception("FIXME: not implemented")
+
# a BuildRequest is a request that the scheduler will build using a BuildEnvironment
# the build request queue is the table itself, ordered by state