diff options
| author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-07-15 13:01:56 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-23 20:06:57 +0100 |
| commit | 5aba3d7fcc3a9edf477bedeced96444b2fbcb8be (patch) | |
| tree | f273adece5de31e95cc6f6e24b216706ed43c859 /bitbake/lib/toaster/orm/models.py | |
| parent | 6cfb76fa8bd1c192e6a0524b7670e2172e5d8e26 (diff) | |
| download | poky-5aba3d7fcc3a9edf477bedeced96444b2fbcb8be.tar.gz | |
bitbake: toaster: improved Project models
A layer may live in a subdirectory of a git repository,
so we add a field to track this setting in the Project layers.
We add the Project schedule_build function, which creates
a build request from the current project configuration.
We also fix an import problem with Projects in views.
(Bitbake rev: 1b5835e5d48cbfb7d38e38437c45d161052dfb37)
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 | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index f4064296bc..9b7387a8af 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
| @@ -37,13 +37,13 @@ class ProjectManager(models.Manager): | |||
| 37 | name = "meta", | 37 | name = "meta", |
| 38 | giturl = "git://git.yoctoproject.org/poky", | 38 | giturl = "git://git.yoctoproject.org/poky", |
| 39 | commit = branch, | 39 | commit = branch, |
| 40 | treepath = "meta") | 40 | dirpath = "meta") |
| 41 | 41 | ||
| 42 | ProjectLayer.objects.create(project = prj, | 42 | ProjectLayer.objects.create(project = prj, |
| 43 | name = "meta-yocto", | 43 | name = "meta-yocto", |
| 44 | giturl = "git://git.yoctoproject.org/poky", | 44 | giturl = "git://git.yoctoproject.org/poky", |
| 45 | commit = branch, | 45 | commit = branch, |
| 46 | treepath = "meta-yocto") | 46 | dirpath = "meta-yocto") |
| 47 | 47 | ||
| 48 | return prj | 48 | return prj |
| 49 | 49 | ||
| @@ -66,6 +66,22 @@ class Project(models.Model): | |||
| 66 | user_id = models.IntegerField(null = True) | 66 | user_id = models.IntegerField(null = True) |
| 67 | objects = ProjectManager() | 67 | objects = ProjectManager() |
| 68 | 68 | ||
| 69 | |||
| 70 | def schedule_build(self): | ||
| 71 | from bldcontrol.models import BuildRequest, BRTarget, BRLayer, BRVariable | ||
| 72 | br = BuildRequest.objects.create(project = self) | ||
| 73 | for l in self.projectlayer_set.all(): | ||
| 74 | BRLayer.objects.create(req = br, name = l.name, giturl = l.giturl, commit = l.commit, dirpath = l.dirpath) | ||
| 75 | for t in self.projecttarget_set.all(): | ||
| 76 | BRTarget.objects.create(req = br, target = t.target, task = t.task) | ||
| 77 | for v in self.projectvariable_set.all(): | ||
| 78 | BRVariable.objects.create(req = br, name = v.name, value = v.value) | ||
| 79 | |||
| 80 | br.state = BuildRequest.REQ_QUEUED | ||
| 81 | br.save() | ||
| 82 | return br | ||
| 83 | |||
| 84 | |||
| 69 | class Build(models.Model): | 85 | class Build(models.Model): |
| 70 | SUCCEEDED = 0 | 86 | SUCCEEDED = 0 |
| 71 | FAILED = 1 | 87 | FAILED = 1 |
| @@ -375,6 +391,7 @@ class ProjectLayer(models.Model): | |||
| 375 | name = models.CharField(max_length = 100) | 391 | name = models.CharField(max_length = 100) |
| 376 | giturl = models.CharField(max_length = 254) | 392 | giturl = models.CharField(max_length = 254) |
| 377 | commit = models.CharField(max_length = 254) | 393 | commit = models.CharField(max_length = 254) |
| 394 | dirpath = models.CharField(max_length = 254) | ||
| 378 | 395 | ||
| 379 | class Layer(models.Model): | 396 | class Layer(models.Model): |
| 380 | name = models.CharField(max_length=100) | 397 | name = models.CharField(max_length=100) |
