summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2017-09-14 16:58:15 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-05 22:41:27 +0000
commitecb828a68fca5bc3004c965f3142362eb8834902 (patch)
treea9935f7e477650a74d273e19f3d774a56a7470f7 /bitbake
parent99656fecf4fa6e24ba49ecb7f26f893e733818a0 (diff)
downloadpoky-ecb828a68fca5bc3004c965f3142362eb8834902.tar.gz
bitbake: toaster: reserve HEAD from imported layers
The HEAD reference in Toaster layers are reserved for the "Local Yocto Project" layers, stored at the top directory. Imported layers are not allowed to use this since they are managed differently - for example the 'remotes' will collide. Fix the add layer handler to not drop the data fields when it is a git repo. Explicitly inform the user when an internal Toaster error is returned via AJAX, so that they know why clicking the layer add button did not do anything. [YOCTO #9924] (Bitbake rev: 90fb89e5e3ada9e36ab0b2a5a0dbfd74f9be279f) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/api.py6
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js17
-rw-r--r--bitbake/lib/toaster/toastergui/templates/importlayer.html2
3 files changed, 18 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 5b035505c2..1a6507c3f6 100644
--- a/bitbake/lib/toaster/toastergui/api.py
+++ b/bitbake/lib/toaster/toastergui/api.py
@@ -292,14 +292,14 @@ class XhrLayer(View):
292 layer_source=LayerSource.TYPE_IMPORTED) 292 layer_source=LayerSource.TYPE_IMPORTED)
293 293
294 # Local layer 294 # Local layer
295 if 'local_source_dir' in layer_data: 295 if ('local_source_dir' in layer_data) and layer.local_source_dir:
296 layer.local_source_dir = layer_data['local_source_dir'] 296 layer.local_source_dir = layer_data['local_source_dir']
297 # git layer 297 # git layer
298 elif 'vcs_url' in layer_data: 298 elif 'vcs_url' in layer_data:
299 layer.vcs_url = layer_data['vcs_url'] 299 layer.vcs_url = layer_data['vcs_url']
300 layer_version.dirpath = layer_data['dir_path'] 300 layer_version.dirpath = layer_data['dir_path']
301 layer_version.commit = layer_data['get_ref'] 301 layer_version.commit = layer_data['git_ref']
302 layer_version.branch = layer_data['get_ref'] 302 layer_version.branch = layer_data['git_ref']
303 303
304 layer.save() 304 layer.save()
305 layer_version.save() 305 layer_version.save()
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index b3f094e69b..59652b9a36 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -176,6 +176,8 @@ function importLayerPageInit (ctx) {
176 success: function (data) { 176 success: function (data) {
177 if (data.error != "ok") { 177 if (data.error != "ok") {
178 console.log(data.error); 178 console.log(data.error);
179 /* let the user know why nothing happened */
180 alert(data.error)
179 } else { 181 } else {
180 createImportedNotification(data); 182 createImportedNotification(data);
181 window.location.replace(libtoaster.ctx.projectPageUrl); 183 window.location.replace(libtoaster.ctx.projectPageUrl);
@@ -244,9 +246,18 @@ function importLayerPageInit (ctx) {
244 enable_import_btn(true); 246 enable_import_btn(true);
245 } 247 }
246 248
247 if ($("#git-repo-radio").prop("checked") && 249 if ($("#git-repo-radio").prop("checked")) {
248 vcsURLInput.val().length > 0 && gitRefInput.val().length > 0) { 250 if (gitRefInput.val().length > 0 &&
249 enable_import_btn(true); 251 gitRefInput.val() == 'HEAD') {
252 $('#invalid-layer-revision-hint').show();
253 $('#layer-revision-ctrl').addClass('has-error');
254 enable_import_btn(false);
255 } else if (vcsURLInput.val().length > 0 &&
256 gitRefInput.val().length > 0) {
257 $('#invalid-layer-revision-hint').hide();
258 $('#layer-revision-ctrl').removeClass('has-error');
259 enable_import_btn(true);
260 }
250 } 261 }
251 } 262 }
252 263
diff --git a/bitbake/lib/toaster/toastergui/templates/importlayer.html b/bitbake/lib/toaster/toastergui/templates/importlayer.html
index afbeb94d42..7e5253e963 100644
--- a/bitbake/lib/toaster/toastergui/templates/importlayer.html
+++ b/bitbake/lib/toaster/toastergui/templates/importlayer.html
@@ -115,8 +115,8 @@
115 </label> 115 </label>
116 <span style="display: block"> 116 <span style="display: block">
117 <input type="text" class="form-control" id="layer-git-ref" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" required> 117 <input type="text" class="form-control" id="layer-git-ref" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" required>
118 <span class="help-inline" style="display:none;" id="invalid-layer-revision-hint"></span>
119 </span> 118 </span>
119 <span class="help-block has-error" style="display:none;" id="invalid-layer-revision-hint">The "HEAD" branch is reserved (only allowed for the "Local Yocto Project" layers)</span>
120 </div> 120 </div>
121 </fieldset> 121 </fieldset>
122 122