update.py: improve handling of machine descriptions

Fall back to NAME if DESCRIPTION is not specified and remove more
preamble from the string.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-03-20 17:21:29 +00:00
parent 342ff28648
commit e1bbc39237

View File

@ -114,13 +114,16 @@ def update_recipe_file(data, path, recipe, layerdir_start, repodir):
def update_machine_conf_file(path, machine): def update_machine_conf_file(path, machine):
logger.debug('Updating machine %s' % path) logger.debug('Updating machine %s' % path)
desc = ""
with open(path, 'r') as f: with open(path, 'r') as f:
for line in f: for line in f:
if line.startswith('#@NAME:'):
desc = line[7:].strip()
if line.startswith('#@DESCRIPTION:'): if line.startswith('#@DESCRIPTION:'):
desc = line[14:].strip() desc = line[14:].strip()
desc = re.sub(r'Machine configuration for (the )*', '', desc) desc = re.sub(r'Machine configuration for( running)*( an)*( the)*', '', desc)
machine.description = desc
break break
machine.description = desc
def parse_layer_conf(layerdir, data): def parse_layer_conf(layerdir, data):
data.setVar('LAYERDIR', str(layerdir)) data.setVar('LAYERDIR', str(layerdir))