From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: yocto@yoctoproject.org
Subject: [layerindex-web][PATCH 2/3] update_layer.py: use DISTRO_NAME as primary distro short description
Date: Tue, 14 Mar 2017 15:19:58 +1300 [thread overview]
Message-ID: <20170314021959.12676-2-paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <20170314021959.12676-1-paul.eggleton@linux.intel.com>
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>
---
layerindex/update_layer.py | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index 705227b..9fe96fb 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -133,7 +133,7 @@ def update_machine_conf_file(path, machine):
break
machine.description = desc
-def update_distro_conf_file(path, distro):
+def update_distro_conf_file(path, distro, d):
logger.debug('Updating distro %s' % path)
desc = ""
with open(path, 'r') as f:
@@ -144,7 +144,18 @@ def update_distro_conf_file(path, distro):
desc = line[14:].strip()
desc = re.sub(r'Distribution configuration for( running)*( an)*( the)*', '', desc)
break
- distro.description = desc
+
+ 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
def main():
if LooseVersion(git.__version__) < '0.3.1':
@@ -531,7 +542,7 @@ def main():
distro = Distro()
distro.layerbranch = layerbranch
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()
elif typename == 'bbclass':
bbclass = BBClass()
@@ -568,7 +579,7 @@ def main():
results = layerdistros.filter(name=filename)
if results:
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()
deps = RecipeFileDependency.objects.filter(layerbranch=layerbranch).filter(path=path)
@@ -642,7 +653,7 @@ def main():
distro = Distro()
distro.layerbranch = layerbranch
distro.name = filename
- update_distro_conf_file(fullpath, distro)
+ update_distro_conf_file(fullpath, distro, config_data_copy)
distro.save()
elif typename == 'bbclass':
bbclass = BBClass()
--
2.9.3
next prev parent reply other threads:[~2017-03-14 2:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 2:19 [layerindex-web][PATCH 1/3] utils.py: split out parse_conf() from parse_layer_conf() Paul Eggleton
2017-03-14 2:19 ` Paul Eggleton [this message]
2017-03-14 2:19 ` [layerindex-web][PATCH 3/3] layerindex: add "No update" status to LayerItem Paul Eggleton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170314021959.12676-2-paul.eggleton@linux.intel.com \
--to=paul.eggleton@linux.intel.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.