diff options
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/localhostbecontroller.py')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index ebf2b4f3bb..22d31e33f2 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | |||
@@ -32,6 +32,10 @@ from toastermain import settings | |||
32 | 32 | ||
33 | from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, _getgitcheckoutdirectoryname | 33 | from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, _getgitcheckoutdirectoryname |
34 | 34 | ||
35 | import logging | ||
36 | logger = logging.getLogger("toaster") | ||
37 | |||
38 | |||
35 | class LocalhostBEController(BuildEnvironmentController): | 39 | class LocalhostBEController(BuildEnvironmentController): |
36 | """ Implementation of the BuildEnvironmentController for the localhost; | 40 | """ Implementation of the BuildEnvironmentController for the localhost; |
37 | this controller manages the default build directory, | 41 | this controller manages the default build directory, |
@@ -56,8 +60,10 @@ class LocalhostBEController(BuildEnvironmentController): | |||
56 | err = "command: %s \n%s" % (command, out) | 60 | err = "command: %s \n%s" % (command, out) |
57 | else: | 61 | else: |
58 | err = "command: %s \n%s" % (command, err) | 62 | err = "command: %s \n%s" % (command, err) |
63 | logger.debug("localhostbecontroller: shellcmd error %s" % err) | ||
59 | raise ShellCmdException(err) | 64 | raise ShellCmdException(err) |
60 | else: | 65 | else: |
66 | logger.debug("localhostbecontroller: shellcmd success") | ||
61 | return out | 67 | return out |
62 | 68 | ||
63 | def _createdirpath(self, path): | 69 | def _createdirpath(self, path): |
@@ -90,7 +96,7 @@ class LocalhostBEController(BuildEnvironmentController): | |||
90 | for i in self._shellcmd(cmd).split("\n"): | 96 | for i in self._shellcmd(cmd).split("\n"): |
91 | if i.startswith("Bitbake server address"): | 97 | if i.startswith("Bitbake server address"): |
92 | port = i.split(" ")[-1] | 98 | port = i.split(" ")[-1] |
93 | print "Found bitbake server port ", port | 99 | logger.debug("localhostbecontroller: Found bitbake server port %s" % port) |
94 | 100 | ||
95 | def _toaster_ui_started(filepath): | 101 | def _toaster_ui_started(filepath): |
96 | if not os.path.exists(filepath): | 102 | if not os.path.exists(filepath): |
@@ -103,10 +109,10 @@ class LocalhostBEController(BuildEnvironmentController): | |||
103 | 109 | ||
104 | while not _toaster_ui_started(os.path.join(self.be.builddir, "toaster_ui.log")): | 110 | while not _toaster_ui_started(os.path.join(self.be.builddir, "toaster_ui.log")): |
105 | import time | 111 | import time |
106 | print "DEBUG: Waiting server to start" | 112 | logger.debug("localhostbecontroller: Waiting bitbake server to start") |
107 | time.sleep(0.5) | 113 | time.sleep(0.5) |
108 | 114 | ||
109 | print("DEBUG: Started server") | 115 | logger.debug("localhostbecontroller: Started bitbake server") |
110 | assert self.be.sourcedir and os.path.exists(self.be.builddir) | 116 | assert self.be.sourcedir and os.path.exists(self.be.builddir) |
111 | self.be.bbaddress = "localhost" | 117 | self.be.bbaddress = "localhost" |
112 | self.be.bbport = port | 118 | self.be.bbport = port |
@@ -116,11 +122,11 @@ class LocalhostBEController(BuildEnvironmentController): | |||
116 | def stopBBServer(self): | 122 | def stopBBServer(self): |
117 | assert self.pokydirname and os.path.exists(self.pokydirname) | 123 | assert self.pokydirname and os.path.exists(self.pokydirname) |
118 | assert self.islayerset | 124 | assert self.islayerset |
119 | print self._shellcmd("bash -c \"source %s/oe-init-build-env %s && %s source toaster stop\"" % | 125 | self._shellcmd("bash -c \"source %s/oe-init-build-env %s && %s source toaster stop\"" % |
120 | (self.pokydirname, self.be.builddir, (lambda: "" if self.be.bbtoken is None else "BBTOKEN=%s" % self.be.bbtoken)())) | 126 | (self.pokydirname, self.be.builddir, (lambda: "" if self.be.bbtoken is None else "BBTOKEN=%s" % self.be.bbtoken)())) |
121 | self.be.bbstate = BuildEnvironment.SERVER_STOPPED | 127 | self.be.bbstate = BuildEnvironment.SERVER_STOPPED |
122 | self.be.save() | 128 | self.be.save() |
123 | print "Stopped server" | 129 | logger.debug("localhostbecontroller: Stopped bitbake server") |
124 | 130 | ||
125 | def setLayers(self, bitbakes, layers): | 131 | def setLayers(self, bitbakes, layers): |
126 | """ a word of attention: by convention, the first layer for any build will be poky! """ | 132 | """ a word of attention: by convention, the first layer for any build will be poky! """ |
@@ -149,12 +155,13 @@ class LocalhostBEController(BuildEnvironmentController): | |||
149 | raise BuildSetupException("More than one commit per git url, unsupported configuration: \n%s" % pprint.pformat(gitrepos)) | 155 | raise BuildSetupException("More than one commit per git url, unsupported configuration: \n%s" % pprint.pformat(gitrepos)) |
150 | 156 | ||
151 | 157 | ||
158 | logger.debug("localhostbecontroller, our git repos are %s" % gitrepos) | ||
152 | layerlist = [] | 159 | layerlist = [] |
153 | 160 | ||
154 | # 2. checkout the repositories | 161 | # 2. checkout the repositories |
155 | for giturl in gitrepos.keys(): | 162 | for giturl in gitrepos.keys(): |
156 | localdirname = os.path.join(self.be.sourcedir, _getgitcheckoutdirectoryname(giturl)) | 163 | localdirname = os.path.join(self.be.sourcedir, _getgitcheckoutdirectoryname(giturl)) |
157 | print "DEBUG: giturl ", giturl ,"checking out in current directory", localdirname | 164 | logger.debug("localhostbecontroller: giturl %s checking out in current directory %s" % (giturl, localdirname)) |
158 | 165 | ||
159 | # make sure our directory is a git repository | 166 | # make sure our directory is a git repository |
160 | if os.path.exists(localdirname): | 167 | if os.path.exists(localdirname): |
@@ -167,17 +174,17 @@ class LocalhostBEController(BuildEnvironmentController): | |||
167 | 174 | ||
168 | # branch magic name "HEAD" will inhibit checkout | 175 | # branch magic name "HEAD" will inhibit checkout |
169 | if commit != "HEAD": | 176 | if commit != "HEAD": |
170 | print "DEBUG: checking out commit ", commit, "to", localdirname | 177 | logger.debug("localhostbecontroller: checking out commit %s to %s " % (commit, localdirname)) |
171 | self._shellcmd("git fetch --all && git checkout \"%s\"" % commit , localdirname) | 178 | self._shellcmd("git fetch --all && git checkout \"%s\"" % commit , localdirname) |
172 | 179 | ||
173 | # take the localdirname as poky dir if we can find the oe-init-build-env | 180 | # take the localdirname as poky dir if we can find the oe-init-build-env |
174 | if self.pokydirname is None and os.path.exists(os.path.join(localdirname, "oe-init-build-env")): | 181 | if self.pokydirname is None and os.path.exists(os.path.join(localdirname, "oe-init-build-env")): |
175 | print "DEBUG: selected poky dir name", localdirname | 182 | logger.debug("localhostbecontroller: selected poky dir name %s" % localdirname) |
176 | self.pokydirname = localdirname | 183 | self.pokydirname = localdirname |
177 | 184 | ||
178 | # make sure we have a working bitbake | 185 | # make sure we have a working bitbake |
179 | if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')): | 186 | if not os.path.exists(os.path.join(self.pokydirname, 'bitbake')): |
180 | print "DEBUG: checking bitbake into the poky dirname %s " % self.pokydirname | 187 | logger.debug("localhostbecontroller: checking bitbake into the poky dirname %s " % self.pokydirname) |
181 | self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbakes[0].commit, bitbakes[0].giturl, os.path.join(self.pokydirname, 'bitbake'))) | 188 | self._shellcmd("git clone -b \"%s\" \"%s\" \"%s\" " % (bitbakes[0].commit, bitbakes[0].giturl, os.path.join(self.pokydirname, 'bitbake'))) |
182 | 189 | ||
183 | # verify our repositories | 190 | # verify our repositories |
@@ -189,7 +196,7 @@ class LocalhostBEController(BuildEnvironmentController): | |||
189 | if name != "bitbake": | 196 | if name != "bitbake": |
190 | layerlist.append(localdirpath.rstrip("/")) | 197 | layerlist.append(localdirpath.rstrip("/")) |
191 | 198 | ||
192 | print "DEBUG: current layer list ", layerlist | 199 | logger.debug("localhostbecontroller: current layer list %s " % layerlist) |
193 | 200 | ||
194 | # 3. configure the build environment, so we have a conf/bblayers.conf | 201 | # 3. configure the build environment, so we have a conf/bblayers.conf |
195 | assert self.pokydirname is not None | 202 | assert self.pokydirname is not None |