diff options
author | David Reyna <David.Reyna@windriver.com> | 2018-08-26 15:33:32 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-28 10:32:08 +0100 |
commit | 4c41fc3f6eca667a6b09ff1b7701cec9b8b37e3f (patch) | |
tree | a9a15e440a8898f4cd290f07338a2522affa3775 /bitbake/lib/toaster | |
parent | 1035d9decb8e9cfed44e70795d54c1aa6241c070 (diff) | |
download | poky-4c41fc3f6eca667a6b09ff1b7701cec9b8b37e3f.tar.gz |
bitbake: toaster: enable project import and merged Toaster settings
Enable the ability to select an existing build directory into Toaster.
This opens to the user the backend features of 12823, for command line
user compatibility.
Enable the ability to select saving Toaster settings in the regular
"bblayers.conf" and "local.conf" instead of the default
"toaster_bblayers.conf" and "toaster.conf". This opens to the user the
backend features of 12821, for command line user compatibility.
[YOCTO #12902]
(Bitbake rev: 8ce51fbd92ab42365a38e0c1c260bb4979377a89)
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
4 files changed, 48 insertions, 42 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index aba09e0d27..67bfbf6394 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | |||
@@ -373,8 +373,8 @@ class LocalhostBEController(BuildEnvironmentController): | |||
373 | conf.write('INHERIT+="toaster buildhistory"') | 373 | conf.write('INHERIT+="toaster buildhistory"') |
374 | else: | 374 | else: |
375 | # Append the Toaster-specific values directly to the bblayers.conf | 375 | # Append the Toaster-specific values directly to the bblayers.conf |
376 | bblconfpath = os.path.join(bitbake.req.project.builddir, "conf/bblayers.conf") | 376 | bblconfpath = os.path.join(builddir, "conf/bblayers.conf") |
377 | bblconfpath_save = os.path.join(bitbake.req.project.builddir, "conf/bblayers.conf.save") | 377 | bblconfpath_save = os.path.join(builddir, "conf/bblayers.conf.save") |
378 | shutil.copyfile(bblconfpath, bblconfpath_save) | 378 | shutil.copyfile(bblconfpath, bblconfpath_save) |
379 | with open(bblconfpath) as bblayers: | 379 | with open(bblconfpath) as bblayers: |
380 | content = bblayers.readlines() | 380 | content = bblayers.readlines() |
@@ -399,8 +399,8 @@ class LocalhostBEController(BuildEnvironmentController): | |||
399 | bblayers.write(' "\n') | 399 | bblayers.write(' "\n') |
400 | bblayers.write('#=== TOASTER_CONFIG_EPILOG ===\n') | 400 | bblayers.write('#=== TOASTER_CONFIG_EPILOG ===\n') |
401 | # Append the Toaster-specific values directly to the local.conf | 401 | # Append the Toaster-specific values directly to the local.conf |
402 | bbconfpath = os.path.join(bitbake.req.project.builddir, "conf/local.conf") | 402 | bbconfpath = os.path.join(builddir, "conf/local.conf") |
403 | bbconfpath_save = os.path.join(bitbake.req.project.builddir, "conf/local.conf.save") | 403 | bbconfpath_save = os.path.join(builddir, "conf/local.conf.save") |
404 | shutil.copyfile(bbconfpath, bbconfpath_save) | 404 | shutil.copyfile(bbconfpath, bbconfpath_save) |
405 | with open(bbconfpath) as f: | 405 | with open(bbconfpath) as f: |
406 | content = f.readlines() | 406 | content = f.readlines() |
diff --git a/bitbake/lib/toaster/toastergui/templates/newproject.html b/bitbake/lib/toaster/toastergui/templates/newproject.html index bd03bb55d7..7e1ebb382a 100644 --- a/bitbake/lib/toaster/toastergui/templates/newproject.html +++ b/bitbake/lib/toaster/toastergui/templates/newproject.html | |||
@@ -20,23 +20,19 @@ | |||
20 | <input type="text" class="form-control" required id="new-project-name" name="projectname"> | 20 | <input type="text" class="form-control" required id="new-project-name" name="projectname"> |
21 | </div> | 21 | </div> |
22 | <p class="help-block text-danger" style="display: none;" id="hint-error-project-name">A project with this name exists. Project names must be unique.</p> | 22 | <p class="help-block text-danger" style="display: none;" id="hint-error-project-name">A project with this name exists. Project names must be unique.</p> |
23 | <!-- | ||
24 | <fieldset> | ||
25 | <label class="project-form">Project type</label> | ||
26 | <label class="project-form radio"><input type="radio" name="ptype" value="analysis" checked/> Analysis Project</label> | ||
27 | 23 | ||
24 | <label class="project-form">Project type:</label> | ||
28 | {% if releases.count > 0 %} | 25 | {% if releases.count > 0 %} |
29 | <label class="project-form radio"><input type="radio" name="ptype" value="build" checked /> Build Project</label> | 26 | <label class="project-form radio" style="padding-left: 35px;"><input id='type-new' type="radio" name="ptype" value="new"/> New project</label> |
30 | {% endif %} | 27 | {% endif %} |
31 | </fieldset> --> | 28 | <label class="project-form radio" style="padding-left: 35px;"><input id='type-import' type="radio" name="ptype" value="import"/> Import command line project</label> |
32 | <input type="hidden" name="ptype" value="build" /> | ||
33 | 29 | ||
34 | {% if releases.count > 0 %} | 30 | {% if releases.count > 0 %} |
35 | <div class="release form-group"> | 31 | <div class="release form-group"> |
36 | {% if releases.count > 1 %} | 32 | {% if releases.count > 1 %} |
37 | <label class="control-label"> | 33 | <label class="control-label"> |
38 | Release | 34 | Release |
39 | <span class="glyphicon glyphicon-question-sign get-help" title="The version of the build system you want to use"></span> | 35 | <span class="glyphicon glyphicon-question-sign get-help" title="The version of the build system you want to use for this project"></span> |
40 | </label> | 36 | </label> |
41 | <select name="projectversion" id="projectversion" class="form-control"> | 37 | <select name="projectversion" id="projectversion" class="form-control"> |
42 | {% for release in releases %} | 38 | {% for release in releases %} |
@@ -59,28 +55,26 @@ | |||
59 | {% else %} | 55 | {% else %} |
60 | <input type="hidden" name="projectversion" value="{{releases.0.id}}"/> | 56 | <input type="hidden" name="projectversion" value="{{releases.0.id}}"/> |
61 | {% endif %} | 57 | {% endif %} |
62 | </div> | 58 | |
59 | <input type="checkbox" class="checkbox-mergeattr" name="mergeattr" value="mergeattr"> Merged Toaster settings (Command line user compatibility) | ||
60 | <span class="glyphicon glyphicon-question-sign get-help" title="Place the Toaster settings into the standard 'local.conf' and 'bblayers.conf' instead of 'toaster_bblayers.conf' and 'toaster.conf'"></span> | ||
61 | |||
62 | </div> | ||
63 | {% endif %} | 63 | {% endif %} |
64 | |||
65 | <div class="build-import form-group" id="import-project"> | ||
66 | <label class="control-label">Import existing project directory | ||
67 | <span class="glyphicon glyphicon-question-sign get-help" title="Enter a path to an existing build directory, import the existing settings, and create a Toaster Project for it."></span> | ||
68 | </label> | ||
69 | <input style="width: 33%;"type="text" class="form-control" required id="import-project-dir" name="importdir"> | ||
70 | </div> | ||
71 | |||
64 | <div class="top-air"> | 72 | <div class="top-air"> |
65 | <input type="submit" id="create-project-button" class="btn btn-primary btn-lg" value="Create project"/> | 73 | <input type="submit" id="create-project-button" class="btn btn-primary btn-lg" value="Create project"/> |
66 | <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span> | 74 | <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span> |
67 | </div> | 75 | </div> |
68 | 76 | ||
69 | </form> | 77 | </form> |
70 | <!-- | ||
71 | <div class="col-md-5 well"> | ||
72 | <span class="help-block"> | ||
73 | <h4>Toaster project types</h4> | ||
74 | <p>With a <strong>build project</strong> you configure and run your builds from Toaster.</p> | ||
75 | <p>With an <strong>analysis project</strong>, the builds are configured and run by another tool | ||
76 | (something like Buildbot or Jenkins), and the project only collects the information about the | ||
77 | builds (packages, recipes, dependencies, logs, etc). </p> | ||
78 | <p>You can read more on <a href="#">how to set up an analysis project</a> | ||
79 | in the Toaster manual.</p> | ||
80 | <h4>Release</h4> | ||
81 | <p>If you create a <strong>build project</strong>, you will need to select a <strong>release</strong>, | ||
82 | which is the version of the build system you want to use to run your builds.</p> | ||
83 | </div> --> | ||
84 | </div> | 78 | </div> |
85 | </div> | 79 | </div> |
86 | 80 | ||
@@ -89,6 +83,7 @@ | |||
89 | // hide the new project button | 83 | // hide the new project button |
90 | $("#new-project-button").hide(); | 84 | $("#new-project-button").hide(); |
91 | $('.btn-primary').attr('disabled', 'disabled'); | 85 | $('.btn-primary').attr('disabled', 'disabled'); |
86 | $('#type-new').attr('checked', 'checked'); | ||
92 | 87 | ||
93 | // enable submit button when all required fields are populated | 88 | // enable submit button when all required fields are populated |
94 | $("input#new-project-name").on('input', function() { | 89 | $("input#new-project-name").on('input', function() { |
@@ -118,20 +113,24 @@ | |||
118 | $(".btn-primary")); | 113 | $(".btn-primary")); |
119 | 114 | ||
120 | 115 | ||
121 | /* // Hide the project release when you select an analysis project | 116 | // Hide the project release when you select an analysis project |
122 | function projectType() { | 117 | function projectType() { |
123 | if ($("input[type='radio']:checked").val() == 'build') { | 118 | if ($("input[type='radio']:checked").val() == 'new') { |
119 | $('.build-import').fadeOut(); | ||
124 | $('.release').fadeIn(); | 120 | $('.release').fadeIn(); |
121 | $('#import-project-dir').removeAttr('required'); | ||
125 | } | 122 | } |
126 | else { | 123 | else { |
127 | $('.release').fadeOut(); | 124 | $('.release').fadeOut(); |
125 | $('.build-import').fadeIn(); | ||
126 | $('#import-project-dir').attr('required', 'required'); | ||
128 | } | 127 | } |
129 | } | 128 | } |
130 | projectType(); | 129 | projectType(); |
131 | 130 | ||
132 | $('input:radio').change(function(){ | 131 | $('input:radio').change(function(){ |
133 | projectType(); | 132 | projectType(); |
134 | }); */ | 133 | }); |
135 | }); | 134 | }); |
136 | </script> | 135 | </script> |
137 | 136 | ||
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 4939b6b1f4..c712b06a6e 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -1398,7 +1398,9 @@ if True: | |||
1398 | mandatory_fields = ['projectname', 'ptype'] | 1398 | mandatory_fields = ['projectname', 'ptype'] |
1399 | try: | 1399 | try: |
1400 | ptype = request.POST.get('ptype') | 1400 | ptype = request.POST.get('ptype') |
1401 | if ptype == "build": | 1401 | if ptype == "import": |
1402 | mandatory_fields.append('importdir') | ||
1403 | else: | ||
1402 | mandatory_fields.append('projectversion') | 1404 | mandatory_fields.append('projectversion') |
1403 | # make sure we have values for all mandatory_fields | 1405 | # make sure we have values for all mandatory_fields |
1404 | missing = [field for field in mandatory_fields if len(request.POST.get(field, '')) == 0] | 1406 | missing = [field for field in mandatory_fields if len(request.POST.get(field, '')) == 0] |
@@ -1415,14 +1417,22 @@ if True: | |||
1415 | login(request, user) | 1417 | login(request, user) |
1416 | 1418 | ||
1417 | # save the project | 1419 | # save the project |
1418 | if ptype == "analysis": | 1420 | if ptype == "import": |
1419 | release = None | 1421 | if not os.path.isdir('%s/conf' % request.POST['importdir']): |
1422 | raise BadParameterException("Bad path or missing 'conf' directory (%s)" % request.POST['importdir']) | ||
1423 | from django.core import management | ||
1424 | management.call_command('buildimport', '--command=import', '--name=%s' % request.POST['projectname'], '--path=%s' % request.POST['importdir'], interactive=False) | ||
1425 | prj = Project.objects.get(name = request.POST['projectname']) | ||
1426 | prj.merged_attr = True | ||
1427 | prj.save() | ||
1420 | else: | 1428 | else: |
1421 | release = Release.objects.get(pk = request.POST.get('projectversion', None )) | 1429 | release = Release.objects.get(pk = request.POST.get('projectversion', None )) |
1430 | prj = Project.objects.create_project(name = request.POST['projectname'], release = release) | ||
1431 | prj.user_id = request.user.pk | ||
1432 | if 'mergeattr' == request.POST.get('mergeattr', ''): | ||
1433 | prj.merged_attr = True | ||
1434 | prj.save() | ||
1422 | 1435 | ||
1423 | prj = Project.objects.create_project(name = request.POST['projectname'], release = release) | ||
1424 | prj.user_id = request.user.pk | ||
1425 | prj.save() | ||
1426 | return redirect(reverse(project, args=(prj.pk,)) + "?notify=new-project") | 1436 | return redirect(reverse(project, args=(prj.pk,)) + "?notify=new-project") |
1427 | 1437 | ||
1428 | except (IntegrityError, BadParameterException) as e: | 1438 | except (IntegrityError, BadParameterException) as e: |
diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildimport.py b/bitbake/lib/toaster/toastermain/management/commands/buildimport.py index 791d528231..9e1cd6d479 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/buildimport.py +++ b/bitbake/lib/toaster/toastermain/management/commands/buildimport.py | |||
@@ -484,11 +484,8 @@ class Command(BaseCommand): | |||
484 | def handle(self, *args, **options): | 484 | def handle(self, *args, **options): |
485 | project_name = options['name'] | 485 | project_name = options['name'] |
486 | project_path = options['path'] | 486 | project_path = options['path'] |
487 | project_callback = options['callback'] | 487 | project_callback = options['callback'] if options['callback'] else '' |
488 | if options['release']: | 488 | release_name = options['release'] if options['release'] else '' |
489 | release_name = options['release'] | ||
490 | else: | ||
491 | release_name = '' | ||
492 | 489 | ||
493 | # | 490 | # |
494 | # Delete project | 491 | # Delete project |