summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2016-08-17 14:31:25 -0500
committerPatrick Williams <patrick@stwcx.xyz>2016-08-22 16:43:26 +0000
commit60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch)
treeecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass
parente18c61205e0234b03697129c20cc69c9b3940efc (diff)
downloadblackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz
blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to hold all of the layers that we import with git-subtree. Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass')
-rw-r--r--import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass46
1 files changed, 46 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass b/import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass
new file mode 100644
index 000000000..81cd2eb6a
--- /dev/null
+++ b/import-layers/yocto-poky/meta-poky/classes/poky-sanity.bbclass
@@ -0,0 +1,46 @@
+# Provide some extensions to sanity.bbclass to handle poky-specific conf file upgrades
+
+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")
+
+ 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")
+}
+
+# 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"
OpenPOWER on IntegriCloud