summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-11-14 17:07:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-21 11:49:23 +0000
commit0b6859cdf3a4b66bb8b94361681a5b6b362f93ae (patch)
tree37bf5c650e99b023bd0e0605b63a53cc0ebd0b72 /bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
parent5b0616ad7d7c3734f1818a56b631a2d254271678 (diff)
downloadpoky-0b6859cdf3a4b66bb8b94361681a5b6b362f93ae.tar.gz
bitbake: toastergui: layer name correlation
This patch modifies how layers are identified and matched. Layers were primarely organized by the source of layer information, and Releases were separated by both layer git branches and originating source of layer information. This setup prevented mixing layers from different sources for a certain release, which didn't match the way people use Yocto Project / bitbake. This patch brings name-based indentification, where layers with the same name are assumed to be equivalent, in the sense of being able to substitute one another. To facilitate this identification to humans, layers are differentiated by GIT URI instead of layer sources, which was a rather arbitrary abstraction. Additional changes include modification to models in order accomodate for the new data structure, and to config file loading to match the new toasterconf.json layout. (Bitbake rev: 4357200aed522ad56cfd84917f877645b83b6a70) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
index c9af487d9d..6e1f97a9f9 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py
@@ -1,6 +1,6 @@
1from django.core.management.base import BaseCommand, CommandError 1from django.core.management.base import BaseCommand, CommandError
2from orm.models import LayerSource, ToasterSetting, Branch, Layer, Layer_Version 2from orm.models import LayerSource, ToasterSetting, Branch, Layer, Layer_Version
3from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer 3from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer, ReleaseLayerSourcePriority
4import os 4import os
5 5
6from checksettings import DN 6from checksettings import DN
@@ -71,17 +71,23 @@ class Command(BaseCommand):
71 assert 'name' in lsi 71 assert 'name' in lsi
72 assert 'branches' in lsi 72 assert 'branches' in lsi
73 73
74 if lsi['sourcetype'] == LayerSource.TYPE_LAYERINDEX or lsi['apiurl'].startswith("/"): 74 def _get_id_for_sourcetype(s):
75 for i in LayerSource.SOURCE_TYPE:
76 if s == i[1]:
77 return i[0]
78 raise Exception("Could not find definition for sourcetype " + s)
79
80 if _get_id_for_sourcetype(lsi['sourcetype']) == LayerSource.TYPE_LAYERINDEX or lsi['apiurl'].startswith("/"):
75 apiurl = lsi['apiurl'] 81 apiurl = lsi['apiurl']
76 else: 82 else:
77 apiurl = self._reduce_canon_path(os.path.join(DN(filepath), lsi['apiurl'])) 83 apiurl = self._reduce_canon_path(os.path.join(DN(filepath), lsi['apiurl']))
78 84
79 try: 85 try:
80 ls = LayerSource.objects.get(sourcetype = lsi['sourcetype'], apiurl = apiurl) 86 ls = LayerSource.objects.get(sourcetype = _get_id_for_sourcetype(lsi['sourcetype']), apiurl = apiurl)
81 except LayerSource.DoesNotExist: 87 except LayerSource.DoesNotExist:
82 ls = LayerSource.objects.create( 88 ls = LayerSource.objects.create(
83 name = lsi['name'], 89 name = lsi['name'],
84 sourcetype = lsi['sourcetype'], 90 sourcetype = _get_id_for_sourcetype(lsi['sourcetype']),
85 apiurl = apiurl 91 apiurl = apiurl
86 ) 92 )
87 93
@@ -121,17 +127,20 @@ class Command(BaseCommand):
121 bvo = BitbakeVersion.objects.get(name = ri['bitbake']) 127 bvo = BitbakeVersion.objects.get(name = ri['bitbake'])
122 assert bvo is not None 128 assert bvo is not None
123 129
124 ro, created = Release.objects.get_or_create(name = ri['name'], bitbake_version = bvo, branch = Branch.objects.get( layer_source__name = ri['layersource'], name=ri['branch'])) 130 ro, created = Release.objects.get_or_create(name = ri['name'], bitbake_version = bvo, branch_name = ri['branch'])
125 ro.description = ri['description'] 131 ro.description = ri['description']
126 ro.helptext = ri['helptext'] 132 ro.helptext = ri['helptext']
127 ro.save() 133 ro.save()
128 134
135 # save layer source priority for release
136 for ls_name in ri['layersourcepriority'].keys():
137 rlspo, created = ReleaseLayerSourcePriority.objects.get_or_create(release = ro, layer_source = LayerSource.objects.get(name=ls_name))
138 rlspo.priority = ri['layersourcepriority'][ls_name]
139 rlspo.save()
140
129 for dli in ri['defaultlayers']: 141 for dli in ri['defaultlayers']:
130 layer, created = Layer.objects.get_or_create( 142 # find layers with the same name
131 layer_source = LayerSource.objects.get(name = ri['layersource']), 143 ReleaseDefaultLayer.objects.get_or_create( release = ro, layer_name = dli)
132 name = dli
133 )
134 ReleaseDefaultLayer.objects.get_or_create( release = ro, layer = layer)
135 144
136 # set default release 145 # set default release
137 if ToasterSetting.objects.filter(name = "DEFAULT_RELEASE").count() > 0: 146 if ToasterSetting.objects.filter(name = "DEFAULT_RELEASE").count() > 0: