summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/sshbecontroller.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-01-28 13:18:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-30 15:14:58 +0000
commitafe85485fe185b663a1285b5c27de3160bf06cf7 (patch)
tree487cdf0fbbd11353094c1f68bc1034b3390dd7e6 /bitbake/lib/toaster/bldcontrol/sshbecontroller.py
parentc58c94824b29665f52ae67ceae3f096930c89fe5 (diff)
downloadpoky-afe85485fe185b663a1285b5c27de3160bf06cf7.tar.gz
bitbake: toaster: new layer checkout logic
This patch implements a new layer checkout logic that brings more flexibility in getting layers under different commits work with Toaster. The new hibrid logic will checkout separately each layer and commit id; the task execution will be delegated to the checkedout bitbake, but the data logger will be executed from the current toaster version as to bring in enough data to sustain the updates in UI models. [YOCTO #7171] [YOCTO #6892] (Bitbake rev: c6eb0f7f16c59530c2525b2e5629fe86de4e8f0f) 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/sshbecontroller.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/sshbecontroller.py58
1 files changed, 2 insertions, 56 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/sshbecontroller.py b/bitbake/lib/toaster/bldcontrol/sshbecontroller.py
index 45e15392e5..be797c9486 100644
--- a/bitbake/lib/toaster/bldcontrol/sshbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/sshbecontroller.py
@@ -29,7 +29,7 @@ import subprocess
29 29
30from toastermain import settings 30from toastermain import settings
31 31
32from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, _getgitcheckoutdirectoryname 32from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, _get_git_clonedirectory
33 33
34def DN(path): 34def DN(path):
35 return "/".join(path.split("/")[0:-1]) 35 return "/".join(path.split("/")[0:-1])
@@ -124,62 +124,8 @@ class SSHBEController(BuildEnvironmentController):
124 assert len(bitbakes) == 1 124 assert len(bitbakes) == 1
125 # set layers in the layersource 125 # set layers in the layersource
126 126
127 # 1. get a list of repos, and map dirpaths for each layer
128 gitrepos = {}
129 gitrepos[bitbakes[0].giturl] = []
130 gitrepos[bitbakes[0].giturl].append( ("bitbake", bitbakes[0].dirpath, bitbakes[0].commit) )
131
132 for layer in layers:
133 # we don't process local URLs
134 if layer.giturl.startswith("file://"):
135 continue
136 if not layer.giturl in gitrepos:
137 gitrepos[layer.giturl] = []
138 gitrepos[layer.giturl].append( (layer.name, layer.dirpath, layer.commit))
139 for giturl in gitrepos.keys():
140 commitid = gitrepos[giturl][0][2]
141 for e in gitrepos[giturl]:
142 if commitid != e[2]:
143 raise BuildSetupException("More than one commit per git url, unsupported configuration")
144
145 layerlist = []
146
147 # 2. checkout the repositories
148 for giturl in gitrepos.keys():
149 import os
150 localdirname = os.path.join(self.be.sourcedir, _getgitcheckoutdirectoryname(giturl))
151 print "DEBUG: giturl ", giturl ,"checking out in current directory", localdirname
152
153 # make sure our directory is a git repository
154 if self._pathexists(localdirname):
155 if not giturl in self._shellcmd("git remote -v", localdirname):
156 raise BuildSetupException("Existing git repository at %s, but with different remotes (not '%s'). Aborting." % (localdirname, giturl))
157 else:
158 self._shellcmd("git clone \"%s\" \"%s\"" % (giturl, localdirname))
159 # checkout the needed commit
160 commit = gitrepos[giturl][0][2]
161
162 # branch magic name "HEAD" will inhibit checkout
163 if commit != "HEAD":
164 print "DEBUG: checking out commit ", commit, "to", localdirname
165 self._shellcmd("git fetch --all && git checkout \"%s\"" % commit , localdirname)
166
167 # take the localdirname as poky dir if we can find the oe-init-build-env
168 if self.pokydirname is None and self._pathexists(os.path.join(localdirname, "oe-init-build-env")):
169 print "DEBUG: selected poky dir name", localdirname
170 self.pokydirname = localdirname
171
172 # verify our repositories
173 for name, dirpath, commit in gitrepos[giturl]:
174 localdirpath = os.path.join(localdirname, dirpath)
175 if not self._pathexists(localdirpath):
176 raise BuildSetupException("Cannot find layer git path '%s' in checked out repository '%s:%s'. Aborting." % (localdirpath, giturl, commit))
177
178 if name != "bitbake":
179 layerlist.append(localdirpath)
180
181 print "DEBUG: current layer list ", layerlist
182 127
128 raise Exception("Not implemented: SSH setLayers")
183 # 3. configure the build environment, so we have a conf/bblayers.conf 129 # 3. configure the build environment, so we have a conf/bblayers.conf
184 assert self.pokydirname is not None 130 assert self.pokydirname is not None
185 self._setupBE() 131 self._setupBE()