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): conf.write('INHERIT+="toaster buildhistory"') else: # Append the Toaster-specific values directly to the bblayers.conf - bblconfpath = os.path.join(bitbake.req.project.builddir, "conf/bblayers.conf") - bblconfpath_save = os.path.join(bitbake.req.project.builddir, "conf/bblayers.conf.save") + bblconfpath = os.path.join(builddir, "conf/bblayers.conf") + bblconfpath_save = os.path.join(builddir, "conf/bblayers.conf.save") shutil.copyfile(bblconfpath, bblconfpath_save) with open(bblconfpath) as bblayers: content = bblayers.readlines() @@ -399,8 +399,8 @@ class LocalhostBEController(BuildEnvironmentController): bblayers.write(' "\n') bblayers.write('#=== TOASTER_CONFIG_EPILOG ===\n') # Append the Toaster-specific values directly to the local.conf - bbconfpath = os.path.join(bitbake.req.project.builddir, "conf/local.conf") - bbconfpath_save = os.path.join(bitbake.req.project.builddir, "conf/local.conf.save") + bbconfpath = os.path.join(builddir, "conf/local.conf") + bbconfpath_save = os.path.join(builddir, "conf/local.conf.save") shutil.copyfile(bbconfpath, bbconfpath_save) with open(bbconfpath) as f: 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 @@ - - + {% if releases.count > 0 %} -
+
{% if releases.count > 1 %} {% endif %} -
+ + Merged Toaster settings (Command line user compatibility) + + +
{% endif %} + +
+ + +
+
To create a project, you need to enter a project name
- @@ -89,6 +83,7 @@ // hide the new project button $("#new-project-button").hide(); $('.btn-primary').attr('disabled', 'disabled'); + $('#type-new').attr('checked', 'checked'); // enable submit button when all required fields are populated $("input#new-project-name").on('input', function() { @@ -118,20 +113,24 @@ $(".btn-primary")); -/* // Hide the project release when you select an analysis project + // Hide the project release when you select an analysis project function projectType() { - if ($("input[type='radio']:checked").val() == 'build') { + if ($("input[type='radio']:checked").val() == 'new') { + $('.build-import').fadeOut(); $('.release').fadeIn(); + $('#import-project-dir').removeAttr('required'); } else { $('.release').fadeOut(); + $('.build-import').fadeIn(); + $('#import-project-dir').attr('required', 'required'); } } projectType(); $('input:radio').change(function(){ projectType(); - }); */ + }); }); 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: mandatory_fields = ['projectname', 'ptype'] try: ptype = request.POST.get('ptype') - if ptype == "build": + if ptype == "import": + mandatory_fields.append('importdir') + else: mandatory_fields.append('projectversion') # make sure we have values for all mandatory_fields missing = [field for field in mandatory_fields if len(request.POST.get(field, '')) == 0] @@ -1415,14 +1417,22 @@ if True: login(request, user) # save the project - if ptype == "analysis": - release = None + if ptype == "import": + if not os.path.isdir('%s/conf' % request.POST['importdir']): + raise BadParameterException("Bad path or missing 'conf' directory (%s)" % request.POST['importdir']) + from django.core import management + management.call_command('buildimport', '--command=import', '--name=%s' % request.POST['projectname'], '--path=%s' % request.POST['importdir'], interactive=False) + prj = Project.objects.get(name = request.POST['projectname']) + prj.merged_attr = True + prj.save() else: release = Release.objects.get(pk = request.POST.get('projectversion', None )) + prj = Project.objects.create_project(name = request.POST['projectname'], release = release) + prj.user_id = request.user.pk + if 'mergeattr' == request.POST.get('mergeattr', ''): + prj.merged_attr = True + prj.save() - prj = Project.objects.create_project(name = request.POST['projectname'], release = release) - prj.user_id = request.user.pk - prj.save() return redirect(reverse(project, args=(prj.pk,)) + "?notify=new-project") 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): def handle(self, *args, **options): project_name = options['name'] project_path = options['path'] - project_callback = options['callback'] - if options['release']: - release_name = options['release'] - else: - release_name = '' + project_callback = options['callback'] if options['callback'] else '' + release_name = options['release'] if options['release'] else '' # # Delete project