classes/poky-sanity: fix handling of bblayers.conf updating

* Update for new structure in sanity.bbclass - use a separate function
  to update bblayers.conf and add it to the list to be executed
* Additionally, don't add meta-yocto-bsp if it's already in BBLAYERS
  (this can occur when switching between DISTRO = "" or other distros
  which use a LAYER_CONF_VERSION = "5" and DISTRO = "poky" which has
  LAYER_CONF_VERSION = "6")

(From meta-yocto rev: 94b98b4868bfa6f9cb7d9a9f1d62c63665214c32)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2013-04-12 21:22:49 +01:00 committed by Richard Purdie
parent 093dec12e6
commit 27ad9cac7b
1 changed files with 17 additions and 9 deletions

View File

@ -1,16 +1,24 @@
python check_bblayers_conf_append() { python poky_update_bblayersconf() {
if current_lconf != lconf_version: current_version = int(d.getVar('LCONF_VERSION', True) or -1)
if current_lconf == 5: latest_version = int(d.getVar('LAYER_CONF_VERSION', True) or -1)
index, meta_yocto_line = find_line('meta-yocto\s*\\\\\\n', lines)
bblayers_fn = bblayers_conf_file(d)
lines = sanity_conf_read(bblayers_fn)
if current_version == 5 and latest_version == 6:
if '/meta-yocto-bsp' not in d.getVar('BBLAYERS', True):
index, meta_yocto_line = sanity_conf_find_line('meta-yocto\s*\\\\\\n', lines)
if meta_yocto_line: if meta_yocto_line:
lines.insert(index + 1, meta_yocto_line.replace('meta-yocto', lines.insert(index + 1, meta_yocto_line.replace('meta-yocto',
'meta-yocto-bsp')) 'meta-yocto-bsp'))
else: else:
sys.exit() sys.exit()
index, line = find_line('LCONF_VERSION', lines) current_version += 1
current_lconf += 1 sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_version)
lines[index] = 'LCONF_VERSION = "%d"\n' % current_lconf return
with open(bblayers_fn, "w") as f:
f.write(''.join(lines)) sys.exit()
} }
BBLAYERS_CONF_UPDATE_FUNCS += "poky_update_bblayersconf"