Patchwork [bitbake-devel] cookerdata: Set TOPDIR when using bblayers.conf

mail settings
Submitter Richard Purdie
Date Aug. 29, 2013, 1:26 p.m.
Message ID <1377782813.1059.0.camel@ted>
Download mbox | patch
Permalink /patch/56871/
State New
Headers show


Richard Purdie - Aug. 29, 2013, 1:26 p.m.
By definition, bblayers.conf is at the top of the build tree. We'd like
to support running bitbake anywhere within that build tree but TOPDIR
gets set to wherever cwd is. Change the code to reset TOPDIR
to the top of the build directory.

This shouldn't break anything but does make the system more usable.

Signed-off-by: Richard Purdie <>


diff --git a/bitbake/lib/bb/ b/bitbake/lib/bb/
index a0379cf..8a0bc22 100644
--- a/bitbake/lib/bb/
+++ b/bitbake/lib/bb/
@@ -239,6 +239,9 @@  class CookerDataBuilder(object):
         layerconf = self._findLayerConf()
         if layerconf:
             parselog.debug(2, "Found bblayers.conf (%s)", layerconf)
+            # By definition bblayers.conf is in conf/ of TOPDIR.
+            # We may have been called with cwd somewhere else so reset TOPDIR
+            data.setVar("TOPDIR", os.path.dirname(os.path.dirname(layerconf)))
             data = parse_config_file(layerconf, data)
             layers = (data.getVar('BBLAYERS', True) or "").split()