summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-29 13:27:29 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-30 16:42:39 (GMT)
commit432294856418fc40e749552106034b8e14fa5c81 (patch)
tree3f699f77b04937ce22a3ca6e3ec83864efd1ab61 /bitbake
parentc7a389729a5453bf090f05946bfa64413a5e04ed (diff)
downloadpoky-432294856418fc40e749552106034b8e14fa5c81.tar.gz
bitbake: cookerdata: Allow bblayers.conf to be found using BBPATH
It should be possible to run a build anywhere on the filesystem and have bitbake find the correct build directory if its set somehow. The BBPATH variable makes perfect sense for this usage. Therefore use any available value of BBPATH to search for conf/bblayers.conf before walking the parent directory structure. This restores the option of being able to run bitbake from anywhere if the user has set things up to operate in that environment. (Bitbake rev: e86336b3fe245bc97fe74c9b9d6a21d38a536fb7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cookerdata.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 8a0bc22..0b278b1 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -177,14 +177,21 @@ def _inherit(bbclass, data):
177 bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data) 177 bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data)
178 return data 178 return data
179 179
180def findConfigFile(configfile): 180def findConfigFile(configfile, data):
181 search = []
182 bbpath = data.getVar("BBPATH", True)
183 if bbpath:
184 for i in bbpath.split(":"):
185 search.append(os.path.join(i, "conf", configfile))
181 path = os.getcwd() 186 path = os.getcwd()
182 while path != "/": 187 while path != "/":
183 confpath = os.path.join(path, "conf", configfile) 188 search.append(os.path.join(path, "conf", configfile))
184 if os.path.exists(confpath):
185 return confpath
186
187 path, _ = os.path.split(path) 189 path, _ = os.path.split(path)
190
191 for i in search:
192 if os.path.exists(i):
193 return i
194
188 return None 195 return None
189 196
190class CookerDataBuilder(object): 197class CookerDataBuilder(object):
@@ -225,8 +232,8 @@ class CookerDataBuilder(object):
225 logger.exception("Error parsing configuration files") 232 logger.exception("Error parsing configuration files")
226 sys.exit(1) 233 sys.exit(1)
227 234
228 def _findLayerConf(self): 235 def _findLayerConf(self, data):
229 return findConfigFile("bblayers.conf") 236 return findConfigFile("bblayers.conf", data)
230 237
231 def parseConfigurationFiles(self, prefiles, postfiles): 238 def parseConfigurationFiles(self, prefiles, postfiles):
232 data = self.data 239 data = self.data
@@ -236,7 +243,7 @@ class CookerDataBuilder(object):
236 for f in prefiles: 243 for f in prefiles:
237 data = parse_config_file(f, data) 244 data = parse_config_file(f, data)
238 245
239 layerconf = self._findLayerConf() 246 layerconf = self._findLayerConf(data)
240 if layerconf: 247 if layerconf:
241 parselog.debug(2, "Found bblayers.conf (%s)", layerconf) 248 parselog.debug(2, "Found bblayers.conf (%s)", layerconf)
242 # By definition bblayers.conf is in conf/ of TOPDIR. 249 # By definition bblayers.conf is in conf/ of TOPDIR.