mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
update_layer.py: use DISTRO_NAME as primary distro short description
When reading conf/distro/*.conf to create distro records, attempt to parse the config file and use DISTRO_NAME (if set) to populate the description field for the record. If that's not set then fall back to the less commonly used meta-comment that we supported previously. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
d62b84f593
commit
2919424f89
|
@ -133,7 +133,7 @@ def update_machine_conf_file(path, machine):
|
||||||
break
|
break
|
||||||
machine.description = desc
|
machine.description = desc
|
||||||
|
|
||||||
def update_distro_conf_file(path, distro):
|
def update_distro_conf_file(path, distro, d):
|
||||||
logger.debug('Updating distro %s' % path)
|
logger.debug('Updating distro %s' % path)
|
||||||
desc = ""
|
desc = ""
|
||||||
with open(path, 'r') as f:
|
with open(path, 'r') as f:
|
||||||
|
@ -144,6 +144,17 @@ def update_distro_conf_file(path, distro):
|
||||||
desc = line[14:].strip()
|
desc = line[14:].strip()
|
||||||
desc = re.sub(r'Distribution configuration for( running)*( an)*( the)*', '', desc)
|
desc = re.sub(r'Distribution configuration for( running)*( an)*( the)*', '', desc)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
distro_name = ''
|
||||||
|
try:
|
||||||
|
d = utils.parse_conf(path, d)
|
||||||
|
distro_name = d.getVar('DISTRO_NAME', True)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warn('Error parsing distro configuration file %s: %s' % (path, str(e)))
|
||||||
|
|
||||||
|
if distro_name:
|
||||||
|
distro.description = distro_name
|
||||||
|
else:
|
||||||
distro.description = desc
|
distro.description = desc
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -531,7 +542,7 @@ def main():
|
||||||
distro = Distro()
|
distro = Distro()
|
||||||
distro.layerbranch = layerbranch
|
distro.layerbranch = layerbranch
|
||||||
distro.name = filename
|
distro.name = filename
|
||||||
update_distro_conf_file(os.path.join(repodir, path), distro)
|
update_distro_conf_file(os.path.join(repodir, path), distro, config_data_copy)
|
||||||
distro.save()
|
distro.save()
|
||||||
elif typename == 'bbclass':
|
elif typename == 'bbclass':
|
||||||
bbclass = BBClass()
|
bbclass = BBClass()
|
||||||
|
@ -568,7 +579,7 @@ def main():
|
||||||
results = layerdistros.filter(name=filename)
|
results = layerdistros.filter(name=filename)
|
||||||
if results:
|
if results:
|
||||||
distro = results[0]
|
distro = results[0]
|
||||||
update_distro_conf_file(os.path.join(repodir, path), distro)
|
update_distro_conf_file(os.path.join(repodir, path), distro, config_data_copy)
|
||||||
distro.save()
|
distro.save()
|
||||||
|
|
||||||
deps = RecipeFileDependency.objects.filter(layerbranch=layerbranch).filter(path=path)
|
deps = RecipeFileDependency.objects.filter(layerbranch=layerbranch).filter(path=path)
|
||||||
|
@ -642,7 +653,7 @@ def main():
|
||||||
distro = Distro()
|
distro = Distro()
|
||||||
distro.layerbranch = layerbranch
|
distro.layerbranch = layerbranch
|
||||||
distro.name = filename
|
distro.name = filename
|
||||||
update_distro_conf_file(fullpath, distro)
|
update_distro_conf_file(fullpath, distro, config_data_copy)
|
||||||
distro.save()
|
distro.save()
|
||||||
elif typename == 'bbclass':
|
elif typename == 'bbclass':
|
||||||
bbclass = BBClass()
|
bbclass = BBClass()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user