mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
43aaa802c3
commit
4f2baebf36
@@ -23,6 +23,7 @@ from django.core.management.base import BaseCommand
|
||||
|
||||
from orm.models import LayerSource, Layer, Release, Layer_Version
|
||||
from orm.models import LayerVersionDependency, Machine, Recipe
|
||||
from orm.models import Distro
|
||||
|
||||
import os
|
||||
import sys
|
||||
@@ -249,6 +250,24 @@ class Command(BaseCommand):
|
||||
depends_on=lvd)
|
||||
self.mini_progress("Layer version dependencies", i, total)
|
||||
|
||||
# update Distros
|
||||
logger.info("Fetching distro information")
|
||||
distros_info = _get_json_response(
|
||||
apilinks['distros'] + "?filter=layerbranch__branch__name:%s" %
|
||||
"OR".join(whitelist_branch_names))
|
||||
|
||||
total = len(distros_info)
|
||||
for i, di in enumerate(distros_info):
|
||||
distro, created = Distro.objects.get_or_create(
|
||||
name=di['name'],
|
||||
layer_version=Layer_Version.objects.get(
|
||||
pk=li_layer_branch_id_to_toaster_lv_id[di['layerbranch']]))
|
||||
distro.up_date = di['updated']
|
||||
distro.name = di['name']
|
||||
distro.description = di['description']
|
||||
distro.save()
|
||||
self.mini_progress("distros", i, total)
|
||||
|
||||
# update machines
|
||||
logger.info("Fetching machine information")
|
||||
machines_info = _get_json_response(
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('orm', '0016_clone_progress'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Distro',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('up_id', models.IntegerField(default=None, null=True)),
|
||||
('up_date', models.DateTimeField(default=None, null=True)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('description', models.CharField(max_length=255)),
|
||||
('layer_version', models.ForeignKey(to='orm.Layer_Version')),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
@@ -321,6 +321,22 @@ class Project(models.Model):
|
||||
|
||||
return queryset
|
||||
|
||||
def get_available_distros(self):
|
||||
""" Returns QuerySet of all Distros which are provided by the
|
||||
Layers currently added to the Project """
|
||||
queryset = Distro.objects.filter(
|
||||
layer_version__in=self.get_project_layer_versions())
|
||||
|
||||
return queryset
|
||||
|
||||
def get_all_compatible_distros(self):
|
||||
""" Returns QuerySet of all the compatible Wind River distros available to the
|
||||
project including ones from Layers not currently added """
|
||||
queryset = Distro.objects.filter(
|
||||
layer_version__in=self.get_all_compatible_layer_versions())
|
||||
|
||||
return queryset
|
||||
|
||||
def get_available_recipes(self):
|
||||
""" Returns QuerySet of all the recipes that are provided by layers
|
||||
added to this project """
|
||||
@@ -1795,6 +1811,21 @@ def signal_runbuilds():
|
||||
except FileNotFoundError:
|
||||
logger.info("Stopping existing runbuilds: no current process found")
|
||||
|
||||
class Distro(models.Model):
|
||||
search_allowed_fields = ["name", "description", "layer_version__layer__name"]
|
||||
up_date = models.DateTimeField(null = True, default = None)
|
||||
|
||||
layer_version = models.ForeignKey('Layer_Version')
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.CharField(max_length=255)
|
||||
|
||||
def get_vcs_distro_file_link_url(self):
|
||||
path = self.name+'.conf'
|
||||
return self.layer_version.get_vcs_file_link_url(path)
|
||||
|
||||
def __unicode__(self):
|
||||
return "Distro " + self.name + "(" + self.description + ")"
|
||||
|
||||
django.db.models.signals.post_save.connect(invalidate_cache)
|
||||
django.db.models.signals.post_delete.connect(invalidate_cache)
|
||||
django.db.models.signals.m2m_changed.connect(invalidate_cache)
|
||||
|
||||
Reference in New Issue
Block a user