diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-01-30 16:25:51 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-01 15:08:41 +0000 |
commit | 3d2f6d56109fc3ebe9c8e7fe0d84d6cd01a9e2fb (patch) | |
tree | 42c2478f7f1c43999e2ac67c43ec982fdfbe5f03 /bitbake | |
parent | cf425a13a2283de5483939a9f70b518fb745e9f6 (diff) | |
download | ast2050-yocto-poky-3d2f6d56109fc3ebe9c8e7fe0d84d6cd01a9e2fb.zip ast2050-yocto-poky-3d2f6d56109fc3ebe9c8e7fe0d84d6cd01a9e2fb.tar.gz |
bitbake-layers: use directory name as layer name
It turns out that using the collection name as specified within
layer.conf (i.e. what gets added to BBFILE_COLLECTIONS) as a name to
refer to the layer is not particularly useful, since layer creators
aren't necessarily setting these to a meaningful value - e.g. OE-Core
uses "normal", meta-oe uses "openembedded-layer", etc. In any case,
BitBake uses the directory name in its list of configured layers in the
system information presented upon starting a build, so let's just do the
same here and avoid confusion.
Also rename the get_append_layer function to get_file_layer since it is
in no way specific to bbappends.
(Bitbake rev: 35d2c1c618826e961dbf4b9889b829f469346d74)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake-layers | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers index fd1ebfb..65496b1 100755 --- a/bitbake/bin/bitbake-layers +++ b/bitbake/bin/bitbake-layers @@ -57,6 +57,7 @@ class Commands(cmd.Cmd): self.config_data = self.cooker.configuration.data bb.providers.logger.setLevel(logging.ERROR) self.cooker_data = None + self.bblayers = (self.config_data.getVar('BBLAYERS', True) or "").split() def register_idle_function(self, function, data): pass @@ -110,13 +111,11 @@ class Commands(cmd.Cmd): logger.plain('') logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority")) logger.plain('=' * 74) - layerdirs = str(self.config_data.getVar('BBLAYERS', True)).split() - for layerdir in layerdirs: - layername = '?' + for layerdir in self.bblayers: + layername = self.get_layer_name(layerdir) layerpri = 0 for layer, _, regex, pri in self.cooker.status.bbfile_config_priorities: if regex.match(os.path.join(layerdir, 'test')): - layername = layer layerpri = pri break @@ -181,18 +180,16 @@ build results (as the layer priority order has effectively changed). return self.check_prepare_cooker() - layers = (self.config_data.getVar('BBLAYERS', True) or "").split() + layers = self.bblayers if len(arglist) > 2: layernames = arglist[:-1] found_layernames = [] found_layerdirs = [] for layerdir in layers: - for layername, _, regex, _ in self.cooker.status.bbfile_config_priorities: - if layername in layernames: - if regex.match(os.path.join(layerdir, 'test')): - found_layerdirs.append(layerdir) - found_layernames.append(layername) - break + layername = self.get_layer_name(layerdir) + if layername in layernames: + found_layerdirs.append(layerdir) + found_layernames.append(layername) for layername in layernames: if not layername in found_layernames: @@ -268,10 +265,9 @@ build results (as the layer priority order has effectively changed). first_regex = None layerdir = layers[0] for layername, pattern, regex, _ in self.cooker.status.bbfile_config_priorities: - if (not layernames) or layername in layernames: - if regex.match(os.path.join(layerdir, 'test')): - first_regex = regex - break + if regex.match(os.path.join(layerdir, 'test')): + first_regex = regex + break if first_regex: # Find the BBFILES entries that match (which will have come from this conf/layer.conf file) @@ -297,17 +293,22 @@ build results (as the layer priority order has effectively changed). if not entry_found: logger.warning("File %s does not match the flattened layer's BBFILES setting, you may need to edit conf/layer.conf or move the file elsewhere" % f1full) - def get_append_layer(self, appendname): + def get_file_layer(self, filename): for layer, _, regex, _ in self.cooker.status.bbfile_config_priorities: - if regex.match(appendname): - return layer + if regex.match(filename): + for layerdir in self.bblayers: + if regex.match(os.path.join(layerdir, 'test')): + return self.get_layer_name(layerdir) return "?" + def get_layer_name(self, layerdir): + return os.path.basename(layerdir.rstrip(os.sep)) + def apply_append(self, appendname, recipename): appendfile = open(appendname, 'r') recipefile = open(recipename, 'a') recipefile.write('\n') - recipefile.write('##### bbappended from %s #####\n' % self.get_append_layer(appendname)) + recipefile.write('##### bbappended from %s #####\n' % self.get_file_layer(appendname)) recipefile.writelines(appendfile.readlines()) recipefile.close() appendfile.close() |