mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
layerindex: Add collection and version to layerbranch
Collection and version will be pulled from the layer.conf if it exists and dependencies will be resolved by first checking for layers with the dependency name and then checking for collections. Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com> Added associated migration. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
This commit is contained in:
parent
540336edde
commit
65f0b71ade
24
layerindex/migrations/0003_auto_20161011_0304.py
Normal file
24
layerindex/migrations/0003_auto_20161011_0304.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('layerindex', '0002_distro'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='layerbranch',
|
||||
name='collection',
|
||||
field=models.CharField(max_length=40, help_text='Name of the layer that could be used in the list of dependencies - can only contain letters, numbers and dashes', verbose_name='Layer Collection', null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='layerbranch',
|
||||
name='version',
|
||||
field=models.CharField(max_length=10, blank=True, help_text='The layer version for this particular branch.', verbose_name='Layer Version', null=True),
|
||||
),
|
||||
]
|
|
@ -130,6 +130,8 @@ class LayerItem(models.Model):
|
|||
class LayerBranch(models.Model):
|
||||
layer = models.ForeignKey(LayerItem)
|
||||
branch = models.ForeignKey(Branch)
|
||||
collection = models.CharField('Layer Collection', max_length=40, null=True, help_text='Name of the layer that could be used in the list of dependencies - can only contain letters, numbers and dashes')
|
||||
version = models.CharField('Layer Version', max_length=10, null=True, blank=True, help_text='The layer version for this particular branch.')
|
||||
vcs_subdir = models.CharField('Repository subdirectory', max_length=40, blank=True, help_text='Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)')
|
||||
vcs_last_fetch = models.DateTimeField('Last successful fetch', blank=True, null=True)
|
||||
vcs_last_rev = models.CharField('Last revision fetched', max_length=80, blank=True)
|
||||
|
|
|
@ -283,6 +283,7 @@ def main():
|
|||
layerconfparser.shutdown()
|
||||
sys.exit(1)
|
||||
utils.add_dependencies(layerbranch, layer_config_data, logger=logger)
|
||||
utils.set_layerbranch_collection_version(layerbranch, layer_config_data, logger=logger)
|
||||
layerbranch.save()
|
||||
|
||||
layerrecipes = Recipe.objects.filter(layerbranch=layerbranch)
|
||||
|
|
|
@ -30,8 +30,10 @@ def get_layer(layername):
|
|||
def get_dependency_layer(depname, version_str=None, logger=None):
|
||||
from layerindex.models import LayerItem, LayerBranch
|
||||
|
||||
# Get any LayerBranch with a layer that has a name that matches the depname
|
||||
res = list(LayerBranch.objects.filter(layer__name=depname))
|
||||
# Get any LayerBranch with a layer that has a name that matches depmod, or
|
||||
# a LayerBranch that has the collection name depmod.
|
||||
res = list(LayerBranch.objects.filter(layer__name=depname)) + \
|
||||
list(LayerBranch.objects.filter(collection=depname))
|
||||
|
||||
# Nothing found, return.
|
||||
if not res:
|
||||
|
@ -68,6 +70,10 @@ def _add_dependency(var, name, layerbranch, config_data, logger=None):
|
|||
layer_name = layerbranch.layer.name
|
||||
var_name = layer_name
|
||||
|
||||
if layerbranch.collection:
|
||||
var_name = layerbranch.collection
|
||||
|
||||
|
||||
dep_list = config_data.getVar("%s_%s" % (var, var_name), True)
|
||||
|
||||
if not dep_list:
|
||||
|
@ -104,11 +110,21 @@ def _add_dependency(var, name, layerbranch, config_data, logger=None):
|
|||
|
||||
if logger:
|
||||
logger.debug('Adding %s %s to %s' % (name, dep_layer.name, layer_name))
|
||||
|
||||
layerdep = LayerDependency()
|
||||
layerdep.layerbranch = layerbranch
|
||||
layerdep.dependency = dep_layer
|
||||
layerdep.save()
|
||||
|
||||
def set_layerbranch_collection_version(layerbranch, config_data, logger=None):
|
||||
|
||||
layerbranch.collection = config_data.getVar('BBFILE_COLLECTIONS', True)
|
||||
ver_str = "LAYERVERSION_"
|
||||
if layerbranch.collection:
|
||||
layerbranch.collection = layerbranch.collection.strip()
|
||||
ver_str += layerbranch.collection
|
||||
layerbranch.version = config_data.getVar(ver_str, True)
|
||||
|
||||
def setup_tinfoil(bitbakepath, enable_tracking):
|
||||
sys.path.insert(0, bitbakepath + '/lib')
|
||||
import bb.tinfoil
|
||||
|
|
Loading…
Reference in New Issue
Block a user