diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-07-21 14:43:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-26 08:10:35 +0100 |
commit | 1477886debc00c9d52b7b147710ef549824dd6ec (patch) | |
tree | 64ac3fa4a5281cfc04a97c33020dd9ab4e1feb8b /bitbake | |
parent | c27ae255db1484cbee68ae13d726e923d78a9640 (diff) | |
download | poky-1477886debc00c9d52b7b147710ef549824dd6ec.tar.gz |
bitbake: toaster: loadconf remove Loading LayerSources
We don't need to configure layer sources in the initial configuration as
this information is provided by the models.
(Bitbake rev: fd56c152699bc4c2d22b87728d0fefbff5209135)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py | 69 |
1 files changed, 2 insertions, 67 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py index 173e3ce579..6f08f1db80 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/loadconf.py | |||
@@ -1,6 +1,6 @@ | |||
1 | from django.core.management.base import BaseCommand, CommandError | 1 | from django.core.management.base import BaseCommand, CommandError |
2 | from orm.models import LayerSource, ToasterSetting, Branch, Layer, Layer_Version | 2 | from orm.models import LayerSource, ToasterSetting, Branch, Layer, Layer_Version |
3 | from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer, ReleaseLayerSourcePriority | 3 | from orm.models import BitbakeVersion, Release, ReleaseDefaultLayer |
4 | from django.db import IntegrityError | 4 | from django.db import IntegrityError |
5 | import os | 5 | import os |
6 | 6 | ||
@@ -42,7 +42,7 @@ class Command(BaseCommand): | |||
42 | data = json.loads(open(filepath, "r").read()) | 42 | data = json.loads(open(filepath, "r").read()) |
43 | 43 | ||
44 | # verify config file validity before updating settings | 44 | # verify config file validity before updating settings |
45 | for i in ['bitbake', 'releases', 'defaultrelease', 'config', 'layersources']: | 45 | for i in ['bitbake', 'releases', 'defaultrelease', 'config']: |
46 | assert i in data | 46 | assert i in data |
47 | 47 | ||
48 | def _read_git_url_from_local_repository(address): | 48 | def _read_git_url_from_local_repository(address): |
@@ -81,65 +81,6 @@ class Command(BaseCommand): | |||
81 | bvo.dirpath = bvi['dirpath'] | 81 | bvo.dirpath = bvi['dirpath'] |
82 | bvo.save() | 82 | bvo.save() |
83 | 83 | ||
84 | # set the layer sources | ||
85 | for lsi in data['layersources']: | ||
86 | assert 'sourcetype' in lsi | ||
87 | assert 'apiurl' in lsi | ||
88 | assert 'name' in lsi | ||
89 | assert 'branches' in lsi | ||
90 | |||
91 | |||
92 | if _get_id_for_sourcetype(lsi['sourcetype']) == LayerSource.TYPE_LAYERINDEX or lsi['apiurl'].startswith("/"): | ||
93 | apiurl = lsi['apiurl'] | ||
94 | else: | ||
95 | apiurl = _reduce_canon_path(os.path.join(DN(os.path.abspath(filepath)), lsi['apiurl'])) | ||
96 | |||
97 | assert ((_get_id_for_sourcetype(lsi['sourcetype']) == LayerSource.TYPE_LAYERINDEX) or apiurl.startswith("/")), (lsi['sourcetype'],apiurl) | ||
98 | |||
99 | try: | ||
100 | ls, created = LayerSource.objects.get_or_create(sourcetype = _get_id_for_sourcetype(lsi['sourcetype']), apiurl = apiurl) | ||
101 | ls.name = lsi['name'] | ||
102 | ls.save() | ||
103 | except IntegrityError as e: | ||
104 | logger.warning("IntegrityError %s \nWhile setting name %s for layer source %s " % (e, lsi['name'], ls)) | ||
105 | |||
106 | |||
107 | layerbranches = [] | ||
108 | for branchname in lsi['branches']: | ||
109 | bo, created = Branch.objects.get_or_create(layer_source = ls, name = branchname) | ||
110 | layerbranches.append(bo) | ||
111 | |||
112 | if 'layers' in lsi: | ||
113 | for layerinfo in lsi['layers']: | ||
114 | lo, created = Layer.objects.get_or_create(layer_source = ls, name = layerinfo['name']) | ||
115 | if layerinfo['local_path'].startswith("/"): | ||
116 | lo.local_path = layerinfo['local_path'] | ||
117 | else: | ||
118 | lo.local_path = _reduce_canon_path(os.path.join(ls.apiurl, layerinfo['local_path'])) | ||
119 | |||
120 | if not os.path.exists(lo.local_path): | ||
121 | logger.error("Local layer path %s must exists. Are you trying to import a layer that does not exist ? Check your local toasterconf.json" % lo.local_path) | ||
122 | |||
123 | if layerinfo['vcs_url'].startswith("remote:"): | ||
124 | lo.vcs_url = _read_git_url_from_local_repository(layerinfo['vcs_url']) | ||
125 | if lo.vcs_url is None: | ||
126 | logger.error("The toaster config file references the local git repo, but Toaster cannot detect it.\nYour local configuration for layer %s is invalid. Make sure that the toasterconf.json file is correct." % layerinfo['name']) | ||
127 | |||
128 | if lo.vcs_url is None: | ||
129 | lo.vcs_url = layerinfo['vcs_url'] | ||
130 | |||
131 | if 'layer_index_url' in layerinfo: | ||
132 | lo.layer_index_url = layerinfo['layer_index_url'] | ||
133 | lo.save() | ||
134 | |||
135 | for branch in layerbranches: | ||
136 | lvo, created = Layer_Version.objects.get_or_create(layer_source = ls, | ||
137 | up_branch = branch, | ||
138 | commit = branch.name, | ||
139 | layer = lo) | ||
140 | lvo.dirpath = layerinfo['dirpath'] | ||
141 | lvo.save() | ||
142 | # set releases | ||
143 | for ri in data['releases']: | 84 | for ri in data['releases']: |
144 | bvo = BitbakeVersion.objects.get(name = ri['bitbake']) | 85 | bvo = BitbakeVersion.objects.get(name = ri['bitbake']) |
145 | assert bvo is not None | 86 | assert bvo is not None |
@@ -149,12 +90,6 @@ class Command(BaseCommand): | |||
149 | ro.helptext = ri['helptext'] | 90 | ro.helptext = ri['helptext'] |
150 | ro.save() | 91 | ro.save() |
151 | 92 | ||
152 | # save layer source priority for release | ||
153 | for ls_name in ri['layersourcepriority'].keys(): | ||
154 | rlspo, created = ReleaseLayerSourcePriority.objects.get_or_create(release = ro, layer_source = LayerSource.objects.get(name=ls_name)) | ||
155 | rlspo.priority = ri['layersourcepriority'][ls_name] | ||
156 | rlspo.save() | ||
157 | |||
158 | for dli in ri['defaultlayers']: | 93 | for dli in ri['defaultlayers']: |
159 | # find layers with the same name | 94 | # find layers with the same name |
160 | ReleaseDefaultLayer.objects.get_or_create( release = ro, layer_name = dli) | 95 | ReleaseDefaultLayer.objects.get_or_create( release = ro, layer_name = dli) |