diff options
author | David Reyna <David.Reyna@windriver.com> | 2017-06-27 13:44:30 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-28 16:02:15 +0100 |
commit | 4f2baebf362d71351db044c0646f9bc6e8a39c49 (patch) | |
tree | bcbb07afbe24816f35d0c9d616ac5ea1fcca7f17 /bitbake/lib/toaster/orm/models.py | |
parent | 43aaa802c35ecc9d972f3b9adcd060033de1d9de (diff) | |
download | poky-4f2baebf362d71351db044c0646f9bc6e8a39c49.tar.gz |
bitbake: toaster: Add distro selection support
Add the ability to select a distro in the project page,
based on values from the Layer Index. Add a distro selection
page with the add layer feature, based on the add machine
page.
[YOCTO #10632]
(Bitbake rev: a156a4eff67cdc3943494f5be72b96e3db656250)
Signed-off-by: David Reyna <David.Reyna@windriver.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 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 13bd11704a..5c14727a70 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -321,6 +321,22 @@ class Project(models.Model): | |||
321 | 321 | ||
322 | return queryset | 322 | return queryset |
323 | 323 | ||
324 | def get_available_distros(self): | ||
325 | """ Returns QuerySet of all Distros which are provided by the | ||
326 | Layers currently added to the Project """ | ||
327 | queryset = Distro.objects.filter( | ||
328 | layer_version__in=self.get_project_layer_versions()) | ||
329 | |||
330 | return queryset | ||
331 | |||
332 | def get_all_compatible_distros(self): | ||
333 | """ Returns QuerySet of all the compatible Wind River distros available to the | ||
334 | project including ones from Layers not currently added """ | ||
335 | queryset = Distro.objects.filter( | ||
336 | layer_version__in=self.get_all_compatible_layer_versions()) | ||
337 | |||
338 | return queryset | ||
339 | |||
324 | def get_available_recipes(self): | 340 | def get_available_recipes(self): |
325 | """ Returns QuerySet of all the recipes that are provided by layers | 341 | """ Returns QuerySet of all the recipes that are provided by layers |
326 | added to this project """ | 342 | added to this project """ |
@@ -1795,6 +1811,21 @@ def signal_runbuilds(): | |||
1795 | except FileNotFoundError: | 1811 | except FileNotFoundError: |
1796 | logger.info("Stopping existing runbuilds: no current process found") | 1812 | logger.info("Stopping existing runbuilds: no current process found") |
1797 | 1813 | ||
1814 | class Distro(models.Model): | ||
1815 | search_allowed_fields = ["name", "description", "layer_version__layer__name"] | ||
1816 | up_date = models.DateTimeField(null = True, default = None) | ||
1817 | |||
1818 | layer_version = models.ForeignKey('Layer_Version') | ||
1819 | name = models.CharField(max_length=255) | ||
1820 | description = models.CharField(max_length=255) | ||
1821 | |||
1822 | def get_vcs_distro_file_link_url(self): | ||
1823 | path = self.name+'.conf' | ||
1824 | return self.layer_version.get_vcs_file_link_url(path) | ||
1825 | |||
1826 | def __unicode__(self): | ||
1827 | return "Distro " + self.name + "(" + self.description + ")" | ||
1828 | |||
1798 | django.db.models.signals.post_save.connect(invalidate_cache) | 1829 | django.db.models.signals.post_save.connect(invalidate_cache) |
1799 | django.db.models.signals.post_delete.connect(invalidate_cache) | 1830 | django.db.models.signals.post_delete.connect(invalidate_cache) |
1800 | django.db.models.signals.m2m_changed.connect(invalidate_cache) | 1831 | django.db.models.signals.m2m_changed.connect(invalidate_cache) |