summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-02-05 12:07:44 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-10 23:07:48 +0000
commit0c89846dafa229b5af9653d6e141011c35451825 (patch)
tree12c42dccf16a5f94202507b747899c2ed122c268 /bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
parent202d808f890b03958cd6873486e6a37f3f437098 (diff)
downloadpoky-0c89846dafa229b5af9653d6e141011c35451825.tar.gz
bitbake: toaster: enhancements for the startup sequence
This patch brings fixes and enhancements in the startup sequence. - the dependency version checking is now correctly enforced when starting in both modes - fixed errors in looking up environment variables - added message with 'daemon' program start location - presenting menu for selecting config file [YOCTO #7283] [YOCTO #7291] [YOCTO #7273] (Bitbake rev: c5ddd9d88910857a1b745b1c237df0390dd56835) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py76
1 files changed, 58 insertions, 18 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
index cf3c3d7ecf..5d80bc7155 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
@@ -78,44 +78,68 @@ class Command(NoArgsCommand):
78 78
79 # we make sure we have builddir and sourcedir for all defined build envionments 79 # we make sure we have builddir and sourcedir for all defined build envionments
80 for be in BuildEnvironment.objects.all(): 80 for be in BuildEnvironment.objects.all():
81 be.needs_import = False
81 def _verify_be(): 82 def _verify_be():
82 is_changed = False 83 is_changed = False
83 print("Verifying the Build Environment. If the Build Environment is completly configured, you will be asked to configure it.") 84 print("Verifying the Build Environment. If the local Build Environment is not properly configured, you will be asked to configure it.")
84 if len(be.sourcedir) == 0: 85
86 def _update_sourcedir():
85 suggesteddir = self._get_suggested_sourcedir(be) 87 suggesteddir = self._get_suggested_sourcedir(be)
86 if len(suggesteddir) > 0: 88 if len(suggesteddir) > 0:
87 be.sourcedir = raw_input("\nToaster needs to know in which directory it should check out the layers that will be needed for your builds.\n Toaster suggests \"%s\". If you select this directory, a layer like \"meta-yocto\" will end up in \"%s/meta-yocto\".\n Press Enter to select \"%s\" or type the full path to a different directory: " % (suggesteddir, suggesteddir, suggesteddir)) 89 be.sourcedir = raw_input("Toaster needs to know in which directory it should check out the layers that will be needed for your builds.\n Toaster suggests \"%s\". If you select this directory, a layer like \"meta-intel\" will end up in \"%s/meta-intel\".\n Press Enter to select \"%s\" or type the full path to a different directory (must be a parent of current checkout directory): " % (suggesteddir, suggesteddir, suggesteddir))
88 else: 90 else:
89 be.sourcedir = raw_input("\nToaster needs to know in which directory it should check out the layers that will be needed for your builds. Type the full path to the directory (for example: \"%s\": " % os.environment['HOME']) 91 be.sourcedir = raw_input("Toaster needs to know in which directory it should check out the layers that will be needed for your builds. Type the full path to the directory (for example: \"%s\": " % os.environ.get('HOME', '/tmp/'))
90 if len(be.sourcedir) == 0 and len(suggesteddir) > 0: 92 if len(be.sourcedir) == 0 and len(suggesteddir) > 0:
91 be.sourcedir = suggesteddir 93 be.sourcedir = suggesteddir
92 is_changed = True 94 return True
95
96 if len(be.sourcedir) == 0:
97 print "\n -- Validation: The checkout directory must be set."
98 is_changed = _update_sourcedir()
93 99
94 if not be.sourcedir.startswith("/"): 100 if not be.sourcedir.startswith("/"):
95 be.sourcedir = raw_input(" Layer sources checkout directory must be an absolute path:") 101 print "\n -- Validation: The checkout directory must be set to an absolute path."
96 is_changed = True 102 is_changed = _update_sourcedir()
97 103
98 if len(be.builddir) == 0: 104 if not be.sourcedir in DN(__file__):
105 print "\n -- Validation: The checkout directory must be a parent of the current checkout."
106 is_changed = _update_sourcedir()
107
108 if is_changed:
109 if be.betype == BuildEnvironment.TYPE_LOCAL:
110 be.needs_import = True
111 return True
112
113 def _update_builddir():
99 suggesteddir = self._get_suggested_builddir(be) 114 suggesteddir = self._get_suggested_builddir(be)
100 if len(suggesteddir) > 0: 115 if len(suggesteddir) > 0:
101 be.builddir = raw_input("\nToaster needs to know where is your build directory.\n The build directory is where all the artifacts created by your builds will be stored. Toaster suggests \"%s\".\n Press Enter to select \"%s\" or type the full path to a different directory: " % (suggesteddir, suggesteddir)) 116 be.builddir = raw_input("Toaster needs to know where it your build directory is located.\n The build directory is where all the artifacts created by your builds will be stored. Toaster suggests \"%s\".\n Press Enter to select \"%s\" or type the full path to a different directory: " % (suggesteddir, suggesteddir))
102 else: 117 else:
103 be.builddir = raw_input("\nToaster needs to know where is your build directory.\n The build directory is where all the artifacts created by your builds will be stored. Type the full path to the directory (for example: \" %s/build\")" % os.environment['HOME']) 118 be.builddir = raw_input("Toaster needs to know where is your build directory.\n The build directory is where all the artifacts created by your builds will be stored. Type the full path to the directory (for example: \" %s/build\")" % os.environ.get('HOME','/tmp/'))
104 if len(be.builddir) == 0 and len(suggesteddir) > 0: 119 if len(be.builddir) == 0 and len(suggesteddir) > 0:
105 be.builddir = suggesteddir 120 be.builddir = suggesteddir
106 is_changed = True 121 return True
122
123 if len(be.builddir) == 0:
124 print "\n -- Validation: The build directory must be set."
125 is_changed = _update_builddir()
107 126
108 if not be.builddir.startswith("/"): 127 if not be.builddir.startswith("/"):
109 be.builddir = raw_input(" Build directory must be an absolute path:") 128 print "\n -- Validation: The build directory must to be set to an absolute path."
110 is_changed = True 129 is_changed = _update_builddir()
111 130
112 131
113 if is_changed: 132 if is_changed:
114 print "Build configuration saved" 133 print "Build configuration saved"
115 be.save() 134 be.save()
135 return True
136
137
138 if be.needs_import:
139 print "\nToaster can use a SINGLE predefined configuration file to set up default project settings and layer information sources.\n"
116 140
117 if is_changed and be.betype == BuildEnvironment.TYPE_LOCAL: 141 # find configuration files
118 print "\nToaster can use a SINGLE predefined configuration file to set up default project settings and layer information sources.\n Toaster will list now the configuration files that it found. Select Yes to use the desired configuration file." 142 config_files = []
119 for dirname in self._recursive_list_directories(be.sourcedir,2): 143 for dirname in self._recursive_list_directories(be.sourcedir,2):
120 if os.path.exists(os.path.join(dirname, ".templateconf")): 144 if os.path.exists(os.path.join(dirname, ".templateconf")):
121 import subprocess 145 import subprocess
@@ -123,11 +147,20 @@ class Command(NoArgsCommand):
123 conffilepath = os.path.join(conffilepath.strip(), "toasterconf.json") 147 conffilepath = os.path.join(conffilepath.strip(), "toasterconf.json")
124 candidatefilepath = os.path.join(dirname, conffilepath) 148 candidatefilepath = os.path.join(dirname, conffilepath)
125 if os.path.exists(candidatefilepath): 149 if os.path.exists(candidatefilepath):
126 i = raw_input("\n Found an preset configuration file \"%s\".\n Do you want to use it? (y/N):" % candidatefilepath) 150 config_files.append(candidatefilepath)
127 if len(i) and i.upper()[0] == 'Y': 151
152 if len(config_files) > 0:
153 print " Toaster will list now the configuration files that it found. Select the number to use the desired configuration file."
154 for cf in config_files:
155 print " [%d] - %s" % (config_files.index(cf) + 1, cf)
156 print "\n [0] - Exit without importing any file"
157 try:
158 i = raw_input("\n Enter your option: ")
159 if len(i) and (int(i) - 1 >= 0 and int(i) - 1 < len(config_files)):
160 print "Importing file: %s" % config_files[int(i)-1]
128 from loadconf import Command as LoadConfigCommand 161 from loadconf import Command as LoadConfigCommand
129 162
130 LoadConfigCommand()._import_layer_config(candidatefilepath) 163 LoadConfigCommand()._import_layer_config(config_files[int(i)-1])
131 # we run lsupdates after config update 164 # we run lsupdates after config update
132 print "Layer configuration imported. Updating information from the layer sources, please wait.\n You can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates" 165 print "Layer configuration imported. Updating information from the layer sources, please wait.\n You can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates"
133 from django.core.management import call_command 166 from django.core.management import call_command
@@ -135,6 +168,13 @@ class Command(NoArgsCommand):
135 168
136 # we don't look for any other config files 169 # we don't look for any other config files
137 return is_changed 170 return is_changed
171 except Exception as e:
172 print "Failure while trying to import the toaster config file: %s" % e
173 else:
174 print "\n Toaster could not find a configuration file. You need to configure Toaster manually using the web interface, or create a configuration file and use\n bitbake/lib/toaster/managepy.py loadconf [filename]\n command to load it. You can use https://wiki.yoctoproject.org/wiki/File:Toasterconf.json.txt.patch as a starting point."
175
176
177
138 178
139 return is_changed 179 return is_changed
140 180