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>
This commit is contained in:
parent
cf425a13a2
commit
3d2f6d5610
|
@ -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:
|
||||
layername = self.get_layer_name(layerdir)
|
||||
if layername in layernames:
|
||||
if regex.match(os.path.join(layerdir, 'test')):
|
||||
found_layerdirs.append(layerdir)
|
||||
found_layernames.append(layername)
|
||||
break
|
||||
|
||||
for layername in layernames:
|
||||
if not layername in found_layernames:
|
||||
|
@ -268,7 +265,6 @@ 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
|
||||
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue