From: Andre McCurdy <armccurdy@gmail.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 3/3] data.py: sort variables being output by emit_func()
Date: Wed, 27 Jan 2016 16:43:18 -0800 [thread overview]
Message-ID: <1453941798-11670-4-git-send-email-armccurdy@gmail.com> (raw)
In-Reply-To: <1453941798-11670-1-git-send-email-armccurdy@gmail.com>
Sorting variables and separating those being exported from those being
unset greatly improves the readability of OE run.do_configure, etc,
shell scripts.
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
---
lib/bb/data.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/bb/data.py b/lib/bb/data.py
index 70ba56b..07f4bba 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -270,7 +270,13 @@ def exported_vars(d):
def emit_func(func, o=sys.__stdout__, d = init()):
"""Emits all items in the data store in a format such that it can be sourced by a shell."""
- keys = (key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func"))
+ o.write('\n')
+ keys = sorted(key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func") and not d.getVarFlag(key, 'unexport'))
+ for key in keys:
+ emit_var(key, o, d, False)
+
+ o.write('\n')
+ keys = sorted(key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func") and d.getVarFlag(key, 'unexport'))
for key in keys:
emit_var(key, o, d, False)
--
1.9.1
next prev parent reply other threads:[~2016-01-28 0:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 0:43 [PATCH 0/3] improve formatting of OE run.do_configure etc scripts Andre McCurdy
2016-01-28 0:43 ` [PATCH 1/3] build.py: minor shell_trap_code() formatting tweaks Andre McCurdy
2016-01-28 0:43 ` [PATCH 2/3] data.py: avoid double newlines at the end of functions in emit_var() Andre McCurdy
2016-01-28 0:43 ` Andre McCurdy [this message]
2016-01-29 0:01 ` [PATCH 3/3] data.py: sort variables being output by emit_func() Richard Purdie
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=1453941798-11670-4-git-send-email-armccurdy@gmail.com \
--to=armccurdy@gmail.com \
--cc=bitbake-devel@lists.openembedded.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.