poky distro 详细分析 —— poky-sanity.bbclass

这个不用关心,更新bblayer.conf的

  1 # Provide some extensions to sanity.bbclass to handle poky-specific conf file upgrades
  2 
  3 python poky_update_bblayersconf() {
  4     current_version = int(d.getVar('POKY_BBLAYERS_CONF_VERSION', True) or -1)
  5     latest_version = int(d.getVar('REQUIRED_POKY_BBLAYERS_CONF_VERSION', True) or -1)
  6     if current_version == -1 or latest_version == -1:
  7     ¦   # one or the other missing => malformed configuration
  8     ¦   raise NotImplementedError("You need to update bblayers.conf manually for this version transition")
  9 
 10     success = True
 11 
 12     # check for out of date templateconf.cfg file
 13     lines = []
 14     fn = os.path.join(d.getVar('TOPDIR', True), 'conf/templateconf.cfg')
 15 
 16     lines = sanity_conf_read(fn)
 17     index, meta_yocto_line = sanity_conf_find_line(r'^meta-yocto/', lines)
 18     if meta_yocto_line:
 19     ¦   lines[index] = meta_yocto_line.replace('meta-yocto', 'meta-poky')
 20     ¦   with open(fn, "w") as f:
 21     ¦   ¦   f.write(''.join(lines))
 22     ¦   bb.note("Your conf/templateconf.cfg file was updated from meta-yocto to meta-poky")
 23 
 24     # add any additional layer checks/changes here
 25 
 26     if success:                                                                                                                                                                                                   
 27     ¦   current_version = latest_version
 28     ¦   bblayers_fn = bblayers_conf_file(d)
 29     ¦   lines = sanity_conf_read(bblayers_fn)
 30     ¦   # sanity_conf_update() will erroneously find a match when the var name
 31     ¦   # is used in a comment, so do our own here. The code below can be
 32     ¦   # removed when sanity_conf_update() is fixed in OE-Core.
 33     ¦   #sanity_conf_update(bblayers_fn, lines, 'POKY_BBLAYERS_CONF_VERSION', current_version)
 34     ¦   index, line = sanity_conf_find_line(r'^POKY_BBLAYERS_CONF_VERSION', lines)
 35     ¦   lines[index] = 'POKY_BBLAYERS_CONF_VERSION = "%d"\n' % current_version
 36     ¦   with open(bblayers_fn, "w") as f:
 37     ¦   ¦   f.write(''.join(lines))
 38     ¦   bb.note("Your conf/bblayers.conf has been automatically updated.")
 39     if success:
 40     ¦   return
 41 
 42     raise NotImplementedError("You need to update bblayers.conf manually for this version transition")
 43 }
 44 
 45 # ensure our function runs after the OE-Core one
 46 BBLAYERS_CONF_UPDATE_FUNCS += "conf/bblayers.conf:POKY_BBLAYERS_CONF_VERSION:REQUIRED_POKY_BBLAYERS_CONF_VERSION:poky_update_bblayersconf"
~                                                                                                                                               
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容