diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-10-06 11:02:36 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-10-30 13:39:47 +0000 |
commit | 83edc576b2b5afe9d174ca13c8ac9151dc655024 (patch) | |
tree | 6169623e6e7fe57efe7488d14a20d4ae038d8955 /bitbake | |
parent | d4852795edee46de4d0fd5f5e8ca23e5031cc77d (diff) | |
download | poky-83edc576b2b5afe9d174ca13c8ac9151dc655024.tar.gz |
bitbake: toasterbld: update checksettings command
We update the checksettings command to allow for upstream
git url detection at runtime by looking up a named remote
of a local repository.
Also various small fixes in check settings.
(Bitbake rev: c127ecb3b5b27b705b8714af063d910b944c8bbc)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index 4f6a66e711..9b58587316 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | |||
@@ -53,7 +53,7 @@ class Command(NoArgsCommand): | |||
53 | def _get_suggested_builddir(self, be): | 53 | def _get_suggested_builddir(self, be): |
54 | if be.betype != BuildEnvironment.TYPE_LOCAL: | 54 | if be.betype != BuildEnvironment.TYPE_LOCAL: |
55 | return "" | 55 | return "" |
56 | return DN(self._find_first_path_for_file(self.guesspath, "bblayers.conf", 3)) | 56 | return DN(self._find_first_path_for_file(DN(self.guesspath), "bblayers.conf", 4)) |
57 | 57 | ||
58 | def _import_layer_config(self, baselayerdir): | 58 | def _import_layer_config(self, baselayerdir): |
59 | filepath = os.path.join(baselayerdir, "meta/conf/toasterconf.json") | 59 | filepath = os.path.join(baselayerdir, "meta/conf/toasterconf.json") |
@@ -107,10 +107,35 @@ class Command(NoArgsCommand): | |||
107 | if layerinfo['local_path'].startswith("/"): | 107 | if layerinfo['local_path'].startswith("/"): |
108 | lo.local_path = layerinfo['local_path'] | 108 | lo.local_path = layerinfo['local_path'] |
109 | else: | 109 | else: |
110 | lo.local_path = self._reduce_canon_path(os.path.join(DN(filepath), layerinfo['local_path'])) | 110 | lo.local_path = self._reduce_canon_path(os.path.join(DN(DN(DN(filepath))), layerinfo['local_path'])) |
111 | lo.layer_index_url = layerinfo['layer_index_url'] | 111 | |
112 | if 'vcs_url' in layerinfo: | 112 | if not os.path.exists(lo.local_path): |
113 | raise Exception("Local layer path %s must exists." % lo.local_path) | ||
114 | |||
115 | if layerinfo['vcs_url'].startswith("remote:"): | ||
116 | lo.vcs_url = None | ||
117 | # we detect the remote name at runtime | ||
118 | import subprocess | ||
119 | (remote, remote_name) = layerinfo['vcs_url'].split(":", 1) | ||
120 | cmd = subprocess.Popen("git remote -v", shell=True, cwd = lo.local_path, stdout=subprocess.PIPE, stderr = subprocess.PIPE) | ||
121 | (out,err) = cmd.communicate() | ||
122 | if cmd.returncode != 0: | ||
123 | raise Exception("Error while importing layer vcs_url: git error: %s" % err) | ||
124 | for line in out.split("\n"): | ||
125 | try: | ||
126 | (name, path) = line.split("\t", 1) | ||
127 | if name == remote_name: | ||
128 | lo.vcs_url = path.split(" ")[0] | ||
129 | break | ||
130 | except ValueError: | ||
131 | pass | ||
132 | if lo.vcs_url == None: | ||
133 | raise Exception("Error while looking for remote \"%s\" in \"s\"" % (remote_name, lo.local_path)) | ||
134 | else: | ||
113 | lo.vcs_url = layerinfo['vcs_url'] | 135 | lo.vcs_url = layerinfo['vcs_url'] |
136 | |||
137 | if 'layer_index_url' in layerinfo: | ||
138 | lo.layer_index_url = layerinfo['layer_index_url'] | ||
114 | lo.save() | 139 | lo.save() |
115 | 140 | ||
116 | for branch in layerbranches: | 141 | for branch in layerbranches: |
@@ -132,7 +157,7 @@ class Command(NoArgsCommand): | |||
132 | 157 | ||
133 | for dli in ri['defaultlayers']: | 158 | for dli in ri['defaultlayers']: |
134 | lsi, layername = dli.split(":") | 159 | lsi, layername = dli.split(":") |
135 | layer, created = Layer.objects.get_or_create( | 160 | layer, created = Layer.objects.get_or_create( |
136 | layer_source = LayerSource.objects.get(name = lsi), | 161 | layer_source = LayerSource.objects.get(name = lsi), |
137 | name = layername | 162 | name = layername |
138 | ) | 163 | ) |
@@ -153,6 +178,18 @@ class Command(NoArgsCommand): | |||
153 | 178 | ||
154 | def handle(self, **options): | 179 | def handle(self, **options): |
155 | self.guesspath = DN(DN(DN(DN(DN(DN(DN(__file__))))))) | 180 | self.guesspath = DN(DN(DN(DN(DN(DN(DN(__file__))))))) |
181 | # refuse to start if we have no build environments | ||
182 | while BuildEnvironment.objects.count() == 0: | ||
183 | print(" !! No build environments found. Toaster needs at least one build environment in order to be able to run builds.\n" + | ||
184 | "You can manually define build environments in the database table bldcontrol_buildenvironment.\n" + | ||
185 | "Or Toaster can define a simple localhost-based build environment for you.") | ||
186 | |||
187 | i = raw_input(" -- Do you want to create a basic localhost build environment ? (Y/n) "); | ||
188 | if not len(i) or i.startswith("y") or i.startswith("Y"): | ||
189 | BuildEnvironment.objects.create(pk = 1, betype = 0) | ||
190 | else: | ||
191 | raise Exception("Toaster cannot start without build environments. Aborting.") | ||
192 | |||
156 | 193 | ||
157 | # we make sure we have builddir and sourcedir for all defined build envionments | 194 | # we make sure we have builddir and sourcedir for all defined build envionments |
158 | for be in BuildEnvironment.objects.all(): | 195 | for be in BuildEnvironment.objects.all(): |