* [PATCH] *** bblayers.conf should be updated automatically
@ 2012-09-26 6:49 Constantin Musca
2012-09-26 6:49 ` [PATCH] sanity.bbclass: " Constantin Musca
2012-09-26 6:51 ` [PATCH] *** " Constantin Musca
0 siblings, 2 replies; 5+ messages in thread
From: Constantin Musca @ 2012-09-26 6:49 UTC (permalink / raw)
To: bitbake-devel; +Cc: Constantin Musca
To keep things simple for this release, Paul proposed to put the bblayers.conf
merging code in sanity.bbclass. After upgrading bblayers.conf we tell the
user to re-run. It would be better if we could re-read the configuration but that
is something we can address in 1.4. Every layer should make its specific bblayers.conf
updates by appending to the check_bblayers_conf bitbake function. We decided that this
is the right thing to do because we don't want to be invasive. This represents the meta
merging functionality and does only the bblayers.conf v4 -> v5 update. The v5 -> v6
bblayers.conf update is done in another patch sent to poky@yoctoproject.org.
Constantin Musca (1):
sanity.bbclass: bblayers.conf should be updated automatically
meta/classes/sanity.bbclass | 56 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] sanity.bbclass: bblayers.conf should be updated automatically
2012-09-26 6:49 [PATCH] *** bblayers.conf should be updated automatically Constantin Musca
@ 2012-09-26 6:49 ` Constantin Musca
2012-09-26 6:51 ` [PATCH] *** " Constantin Musca
1 sibling, 0 replies; 5+ messages in thread
From: Constantin Musca @ 2012-09-26 6:49 UTC (permalink / raw)
To: bitbake-devel; +Cc: Constantin Musca, Constantin Musca
From: Constantin Musca <constantin.musca@gmail.com>
- add check_bblayers_conf bitbake function which does the bblayers.conf
v4 -> v5 update if necessary (every layer should make its specific
bblayers.conf upgrades appending to the check_bblayers_conf function)
- we ask the user to re-run bitbake because we can't trigger reparsing
without being invasive
[YOCTO #3082]
Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
meta/classes/sanity.bbclass | 56 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 385d733..e25dcf5 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -4,6 +4,56 @@
SANITY_REQUIRED_UTILITIES ?= "patch diffstat makeinfo git bzip2 tar gzip gawk chrpath wget cpio"
+python check_bblayers_conf() {
+ bblayers_fn = os.path.join(d.getVar('TOPDIR', True), 'conf/bblayers.conf')
+
+ current_lconf = int(d.getVar('LCONF_VERSION', True))
+ if not current_lconf:
+ sys.exit()
+ lconf_version = int(d.getVar('LAYER_CONF_VERSION', True))
+ lines = []
+
+ import re
+ def find_line(pattern, lines):
+ return next(((index, line)
+ for index, line in enumerate(lines)
+ if re.search(pattern, line)), (None, None))
+
+ if current_lconf < 4:
+ sys.exit()
+
+ with open(bblayers_fn, 'r') as f:
+ lines = f.readlines()
+
+ if current_lconf == 4:
+ topdir_var = '$' + '{TOPDIR}'
+ index, bbpath_line = find_line('BBPATH', lines)
+ if bbpath_line:
+ start = bbpath_line.find('"')
+ if start != -1 and (len(bbpath_line) != (start + 1)):
+ if bbpath_line[start + 1] == '"':
+ lines[index] = (bbpath_line[:start + 1] +
+ topdir_var + bbpath_line[start + 1:])
+ else:
+ if not topdir_var in bbpath_line:
+ lines[index] = (bbpath_line[:start + 1] +
+ topdir_var + ':' + bbpath_line[start + 1:])
+ else:
+ sys.exit()
+ else:
+ index, bbfiles_line = find_line('BBFILES', lines)
+ if bbfiles_line:
+ lines.insert(index, 'BBPATH = "' + topdir_var + '"\n')
+ else:
+ sys.exit()
+
+ index, line = find_line('LCONF_VERSION', lines)
+ current_lconf += 1
+ lines[index] = 'LCONF_VERSION = "%d"\n' % current_lconf
+ with open(bblayers_fn, "w") as f:
+ f.write(''.join(lines))
+}
+
def raise_sanity_error(msg, d):
if d.getVar("SANITY_USE_EVENTS", True) == "1":
bb.event.fire(bb.event.SanityCheckFailed(msg), d)
@@ -337,7 +387,11 @@ def check_sanity(sanity_data):
current_lconf = sanity_data.getVar('LCONF_VERSION', True)
lconf_version = sanity_data.getVar('LAYER_CONF_VERSION', True)
if current_lconf != lconf_version:
- messages = messages + "Your version of bblayers.conf was generated from an older version of bblayers.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/bblayers.conf ${COREBASE}/meta*/conf/bblayers.conf.sample\" is a good way to visualise the changes.\n"
+ try:
+ bb.build.exec_func("check_bblayers_conf", sanity_data)
+ messages = messages + "Your bblayers.conf has been updated. Please re-run."
+ except Exception:
+ messages = messages + "Your version of bblayers.conf was generated from an older version of bblayers.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/bblayers.conf ${COREBASE}/meta*/conf/bblayers.conf.sample\" is a good way to visualise the changes.\n"
# If we have a site.conf, check it's valid
if check_conf_exists("conf/site.conf", sanity_data):
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] *** bblayers.conf should be updated automatically
2012-09-26 6:49 [PATCH] *** bblayers.conf should be updated automatically Constantin Musca
2012-09-26 6:49 ` [PATCH] sanity.bbclass: " Constantin Musca
@ 2012-09-26 6:51 ` Constantin Musca
1 sibling, 0 replies; 5+ messages in thread
From: Constantin Musca @ 2012-09-26 6:51 UTC (permalink / raw)
To: Constantin Musca; +Cc: bitbake-devel
On 09/26/2012 09:49 AM, Constantin Musca wrote:
> To keep things simple for this release, Paul proposed to put the bblayers.conf
> merging code in sanity.bbclass. After upgrading bblayers.conf we tell the
> user to re-run. It would be better if we could re-read the configuration but that
> is something we can address in 1.4. Every layer should make its specific bblayers.conf
> updates by appending to the check_bblayers_conf bitbake function. We decided that this
> is the right thing to do because we don't want to be invasive. This represents the meta
> merging functionality and does only the bblayers.conf v4 -> v5 update. The v5 -> v6
> bblayers.conf update is done in another patch sent to poky@yoctoproject.org.
>
> Constantin Musca (1):
> sanity.bbclass: bblayers.conf should be updated automatically
>
> meta/classes/sanity.bbclass | 56 ++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 55 insertions(+), 1 deletion(-)
>
Sorry. Wrong mail list.
Constantin
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] *** bblayers.conf should be updated automatically
@ 2012-09-26 6:52 Constantin Musca
0 siblings, 0 replies; 5+ messages in thread
From: Constantin Musca @ 2012-09-26 6:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Constantin Musca
To keep things simple for this release, Paul proposed to put the bblayers.conf
merging code in sanity.bbclass. After upgrading bblayers.conf we tell the
user to re-run. It would be better if we could re-read the configuration but that
is something we can address in 1.4. Every layer should make its specific bblayers.conf
updates by appending to the check_bblayers_conf bitbake function. We decided that this
is the right thing to do because we don't want to be invasive. This represents the meta
merging functionality and does only the bblayers.conf v4 -> v5 update. The v5 -> v6
bblayers.conf update is done in another patch sent to poky@yoctoproject.org.
Constantin Musca (1):
sanity.bbclass: bblayers.conf should be updated automatically
meta/classes/sanity.bbclass | 56 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] *** bblayers.conf should be updated automatically
@ 2012-09-26 6:52 Constantin Musca
0 siblings, 0 replies; 5+ messages in thread
From: Constantin Musca @ 2012-09-26 6:52 UTC (permalink / raw)
To: poky; +Cc: Constantin Musca
To keep things simple for this release, Paul proposed to put the bblayers.conf
merging code in sanity.bbclass. Because we don't to be invasive we do the meta-yocto
specific bblayers.conf update in a bbclass (poky-sanity) appending the code to the
check_bblayers_conf function from sanity.bbclass. After upgrading bblayers.conf we
tell the user to re-run. It would be better if we could re-read the configuration
but that is something we can address in 1.4. Every layer should make its specific
bblayers.conf updates by appending to the check_bblayers_conf bitbake function. This
patch depends on the patch sent to the oecore mailing list (sanity.bbclass: bblayers.conf
should be updated automatically).
Constantin Musca (1):
poky-sanity.bbclass: bblayers.conf should be updated automatically
meta-yocto/classes/poky-sanity.bbclass | 16 ++++++++++++++++
meta-yocto/conf/distro/poky.conf | 3 +++
2 files changed, 19 insertions(+)
create mode 100644 meta-yocto/classes/poky-sanity.bbclass
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-26 8:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 6:49 [PATCH] *** bblayers.conf should be updated automatically Constantin Musca
2012-09-26 6:49 ` [PATCH] sanity.bbclass: " Constantin Musca
2012-09-26 6:51 ` [PATCH] *** " Constantin Musca
-- strict thread matches above, loose matches on Subject: below --
2012-09-26 6:52 Constantin Musca
2012-09-26 6:52 Constantin Musca
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.