diff options
| -rwxr-xr-x | bitbake/bin/toaster | 3 | ||||
| -rw-r--r-- | bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | 55 |
2 files changed, 46 insertions, 12 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 79ab301de8..80d07ab0c8 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
| @@ -59,7 +59,8 @@ webserverStartAll() | |||
| 59 | echo "Failed migrations, aborting system start" 1>&2 | 59 | echo "Failed migrations, aborting system start" 1>&2 |
| 60 | return $retval | 60 | return $retval |
| 61 | fi | 61 | fi |
| 62 | 62 | # Make sure that checksettings can pick up any value for TEMPLATECONF | |
| 63 | export TEMPLATECONF | ||
| 63 | $MANAGE checksettings --traceback || retval=1 | 64 | $MANAGE checksettings --traceback || retval=1 |
| 64 | 65 | ||
| 65 | if [ $retval -eq 1 ]; then | 66 | if [ $retval -eq 1 ]; then |
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index 8cdc81311f..fcee8b09ef 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | |||
| @@ -1,10 +1,15 @@ | |||
| 1 | from django.core.management.base import NoArgsCommand, CommandError | 1 | from django.core.management.base import NoArgsCommand, CommandError |
| 2 | from django.db import transaction | 2 | from django.db import transaction |
| 3 | |||
| 4 | from django.core.management import call_command | ||
| 3 | from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdException | 5 | from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdException |
| 4 | from bldcontrol.models import BuildRequest, BuildEnvironment, BRError | 6 | from bldcontrol.models import BuildRequest, BuildEnvironment, BRError |
| 5 | from orm.models import ToasterSetting, Build | 7 | from orm.models import ToasterSetting, Build, Layer |
| 8 | |||
| 6 | import os | 9 | import os |
| 7 | import traceback | 10 | import traceback |
| 11 | import warnings | ||
| 12 | |||
| 8 | 13 | ||
| 9 | def DN(path): | 14 | def DN(path): |
| 10 | if path is None: | 15 | if path is None: |
| @@ -94,30 +99,58 @@ class Command(NoArgsCommand): | |||
| 94 | print("\n -- Validation: The build directory must to be set to an absolute path.") | 99 | print("\n -- Validation: The build directory must to be set to an absolute path.") |
| 95 | is_changed = _update_builddir() | 100 | is_changed = _update_builddir() |
| 96 | 101 | ||
| 97 | |||
| 98 | if is_changed: | 102 | if is_changed: |
| 99 | print("\nBuild configuration saved") | 103 | print("\nBuild configuration saved") |
| 100 | be.save() | 104 | be.save() |
| 101 | return True | 105 | return True |
| 102 | 106 | ||
| 103 | |||
| 104 | if be.needs_import: | 107 | if be.needs_import: |
| 105 | try: | 108 | try: |
| 106 | config_file = os.environ.get('TOASTER_CONF') | 109 | print("Loading default settings") |
| 107 | print("\nImporting file: %s" % config_file) | 110 | call_command("loaddata", "settings") |
| 108 | from .loadconf import Command as LoadConfigCommand | 111 | template_conf = os.environ.get("TEMPLATECONF", "") |
| 112 | |||
| 113 | if "poky" in template_conf: | ||
| 114 | print("Loading poky configuration") | ||
| 115 | call_command("loaddata", "poky") | ||
| 116 | else: | ||
| 117 | print("Loading OE-Core configuration") | ||
| 118 | call_command("loaddata", "oe-core") | ||
| 119 | if template_conf: | ||
| 120 | oe_core_path = os.realpath(template_conf + | ||
| 121 | "/../") | ||
| 122 | else: | ||
| 123 | print("TEMPLATECONF not found. You may have to" | ||
| 124 | " manually configure layer paths") | ||
| 125 | oe_core_path = input("Please enter the path of" | ||
| 126 | " your openembedded-core " | ||
| 127 | "layer: ") | ||
| 128 | # Update the layer instances of openemebedded-core | ||
| 129 | for layer in Layer.objects.filter( | ||
| 130 | name="openembedded-core"): | ||
| 131 | layer.local_source_dir = oe_core_path | ||
| 132 | layer.save() | ||
| 133 | |||
| 134 | # Import the custom fixture if it's present | ||
| 135 | with warnings.catch_warnings(): | ||
| 136 | warnings.filterwarnings( | ||
| 137 | action="ignore", | ||
| 138 | message="^.*No fixture named.*$") | ||
| 139 | print("Importing custom settings if present") | ||
| 140 | call_command("loaddata", "custom") | ||
| 109 | 141 | ||
| 110 | LoadConfigCommand()._import_layer_config(config_file) | ||
| 111 | # we run lsupdates after config update | 142 | # we run lsupdates after config update |
| 112 | print("\nLayer configuration imported. Updating information from the layer sources, please wait.\nYou can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates") | 143 | print("\nFetching information from the layer index, " |
| 113 | from django.core.management import call_command | 144 | "please wait.\nYou can re-update any time later " |
| 145 | "by running bitbake/lib/toaster/manage.py " | ||
| 146 | "lsupdates\n") | ||
| 114 | call_command("lsupdates") | 147 | call_command("lsupdates") |
| 115 | 148 | ||
| 116 | # we don't look for any other config files | 149 | # we don't look for any other config files |
| 117 | return is_changed | 150 | return is_changed |
| 118 | except Exception as e: | 151 | except Exception as e: |
| 119 | print("Failure while trying to import the toaster config file %s: %s" %\ | 152 | print("Failure while trying to setup toaster: %s" |
| 120 | (config_file, e)) | 153 | % e) |
| 121 | traceback.print_exc() | 154 | traceback.print_exc() |
| 122 | 155 | ||
| 123 | return is_changed | 156 | return is_changed |
