distro/oel: Force ARM_INSTRUCTION_SET to use OEL settings
[meta-ossystems-base.git] / classes / restore-dumped-headrevs.bbclass
1 def copy_persist_domain(d, domain, other_db_path, restore=False):
2     import contextlib
3
4     source_table = bb.persist_data.persist(domain, d)
5     dest_table = bb.persist_data.SQLTable(other_db_path, domain)
6     if restore:
7         source_table, dest_table = dest_table, source_table
8
9     with contextlib.nested(source_table, dest_table):
10         dest_table.update(source_table)
11
12 def dump_headrevs(d, dump_db_path):
13     copy_persist_domain(d, 'BB_URI_HEADREVS', dump_db_path)
14
15 def restore_headrevs(d, dump_db_path):
16     copy_persist_domain(d, 'BB_URI_HEADREVS', dump_db_path, restore=True)
17
18 DUMP_HEADREVS_DB ?= '${COREBASE}/saved_persist_data.db'
19 DUMP_HEADREVS_STAMP ?= '${STAMP}.restored_headrevs'
20
21 python restore_dumped_headrevs() {
22     stamp_path = d.getVar('DUMP_HEADREVS_STAMP', True)
23     dump_db_path = d.getVar('DUMP_HEADREVS_DB', True)
24     if not os.path.exists(stamp_path) and os.path.exists(dump_db_path):
25         restore_headrevs(d, dump_db_path)
26         bb.utils.mkdirhier(os.path.dirname(stamp_path))
27         open(stamp_path, 'w').close()
28 }
29 restore_dumped_headrevs[eventmask] = "bb.event.ConfigParsed"
30 addhandler restore_dumped_headrevs