summaryrefslogtreecommitdiffstats
path: root/meta-poky/classes
diff options
context:
space:
mode:
authorBill Randle <william.c.randle@intel.com>2016-03-21 11:24:48 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-26 07:34:59 +0000
commit54eca753082af7d4c44379f879945f449d4f56cf (patch)
tree595ea9735db3dfd1e46e3b3c22549b902c181eed /meta-poky/classes
parent2b992f3e5633e69fa53850d082ab68f3a4620f77 (diff)
downloadpoky-54eca753082af7d4c44379f879945f449d4f56cf.tar.gz
poky-54eca753082af7d4c44379f879945f449d4f56cf.tar.bz2
poky-54eca753082af7d4c44379f879945f449d4f56cf.zip
poky-sanity.bbclass: update conf/templateconf.cfg for existing installations
Updates of existing installations for the meta-yocto to meta-poky transition will update the bblayers.conf file, but not the templateconf.cfg file. This patch updates the template file to point to meta-poky/conf, if necessary. Fixes [YOCTO #9278] (From meta-yocto rev: e560e9b157fd53cccbe73659b44777715660f0b2) Signed-off-by: Bill Randle <william.c.randle@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-poky/classes')
-rw-r--r--meta-poky/classes/poky-sanity.bbclass42
1 files changed, 38 insertions, 4 deletions
diff --git a/meta-poky/classes/poky-sanity.bbclass b/meta-poky/classes/poky-sanity.bbclass
index 287a9e37d6..81cd2eb6a6 100644
--- a/meta-poky/classes/poky-sanity.bbclass
+++ b/meta-poky/classes/poky-sanity.bbclass
@@ -3,10 +3,44 @@
python poky_update_bblayersconf() {
current_version = int(d.getVar('POKY_BBLAYERS_CONF_VERSION', True) or -1)
latest_version = int(d.getVar('REQUIRED_POKY_BBLAYERS_CONF_VERSION', True) or -1)
+ if current_version == -1 or latest_version == -1:
+ # one or the other missing => malformed configuration
+ raise NotImplementedError("You need to update bblayers.conf manually for this version transition")
- # No version transitions here yet
- raise NotImplementedError("You need to update bblayers.conf manually for this version transision")
+ success = True
+
+ # check for out of date templateconf.cfg file
+ lines = []
+ fn = os.path.join(d.getVar('TOPDIR', True), 'conf/templateconf.cfg')
+
+ lines = sanity_conf_read(fn)
+ index, meta_yocto_line = sanity_conf_find_line(r'^meta-yocto/', lines)
+ if meta_yocto_line:
+ lines[index] = meta_yocto_line.replace('meta-yocto', 'meta-poky')
+ with open(fn, "w") as f:
+ f.write(''.join(lines))
+ bb.note("Your conf/templateconf.cfg file was updated from meta-yocto to meta-poky")
+
+ # add any additional layer checks/changes here
+
+ if success:
+ current_version = latest_version
+ bblayers_fn = bblayers_conf_file(d)
+ lines = sanity_conf_read(bblayers_fn)
+ # sanity_conf_update() will erroneously find a match when the var name
+ # is used in a comment, so do our own here. The code below can be
+ # removed when sanity_conf_update() is fixed in OE-Core.
+ #sanity_conf_update(bblayers_fn, lines, 'POKY_BBLAYERS_CONF_VERSION', current_version)
+ index, line = sanity_conf_find_line(r'^POKY_BBLAYERS_CONF_VERSION', lines)
+ lines[index] = 'POKY_BBLAYERS_CONF_VERSION = "%d"\n' % current_version
+ with open(bblayers_fn, "w") as f:
+ f.write(''.join(lines))
+ bb.note("Your conf/bblayers.conf has been automatically updated.")
+ if success:
+ return
+
+ raise NotImplementedError("You need to update bblayers.conf manually for this version transition")
}
-# Prepend to ensure our function runs before the OE-Core one
-BBLAYERS_CONF_UPDATE_FUNCS =+ "conf/bblayers.conf:POKY_BBLAYERS_CONF_VERSION:REQUIRED_POKY_BBLAYERS_CONF_VERSION:poky_update_bblayersconf"
+# ensure our function runs after the OE-Core one
+BBLAYERS_CONF_UPDATE_FUNCS += "conf/bblayers.conf:POKY_BBLAYERS_CONF_VERSION:REQUIRED_POKY_BBLAYERS_CONF_VERSION:poky_update_bblayersconf"