Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | PRSERV_DUMPOPT_VERSION = "${PRAUTOINX}" |
| 2 | PRSERV_DUMPOPT_PKGARCH = "" |
| 3 | PRSERV_DUMPOPT_CHECKSUM = "" |
| 4 | PRSERV_DUMPOPT_COL = "0" |
| 5 | |
| 6 | PRSERV_DUMPDIR ??= "${LOG_DIR}/db" |
| 7 | PRSERV_DUMPFILE ??= "${PRSERV_DUMPDIR}/prserv.inc" |
| 8 | |
| 9 | python prexport_handler () { |
| 10 | import bb.event |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 11 | if not e.data or bb.data.inherits_class('native', e.data) or \ |
| 12 | bb.data.inherits_class('crosssdk', e.data): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 13 | return |
| 14 | |
| 15 | if isinstance(e, bb.event.RecipeParsed): |
| 16 | import oe.prservice |
| 17 | #get all PR values for the current PRAUTOINX |
| 18 | ver = e.data.getVar('PRSERV_DUMPOPT_VERSION', True) |
| 19 | ver = ver.replace('%','-') |
| 20 | retval = oe.prservice.prserv_dump_db(e.data) |
| 21 | if not retval: |
| 22 | bb.fatal("prexport_handler: export failed!") |
| 23 | (metainfo, datainfo) = retval |
| 24 | if not datainfo: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 25 | bb.note("prexport_handler: No AUTOPR values found for %s" % ver) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | return |
| 27 | oe.prservice.prserv_export_tofile(e.data, None, datainfo, False) |
| 28 | if 'AUTOINC' in ver: |
| 29 | import re |
| 30 | srcpv = bb.fetch2.get_srcrev(e.data) |
| 31 | base_ver = "AUTOINC-%s" % ver[:ver.find(srcpv)] |
| 32 | e.data.setVar('PRSERV_DUMPOPT_VERSION', base_ver) |
| 33 | retval = oe.prservice.prserv_dump_db(e.data) |
| 34 | if not retval: |
| 35 | bb.fatal("prexport_handler: export failed!") |
| 36 | (metainfo, datainfo) = retval |
| 37 | oe.prservice.prserv_export_tofile(e.data, None, datainfo, False) |
| 38 | elif isinstance(e, bb.event.ParseStarted): |
| 39 | import bb.utils |
| 40 | import oe.prservice |
| 41 | oe.prservice.prserv_check_avail(e.data) |
| 42 | #remove dumpfile |
| 43 | bb.utils.remove(e.data.getVar('PRSERV_DUMPFILE', True)) |
| 44 | elif isinstance(e, bb.event.ParseCompleted): |
| 45 | import oe.prservice |
| 46 | #dump meta info of tables |
| 47 | d = e.data.createCopy() |
| 48 | d.setVar('PRSERV_DUMPOPT_COL', "1") |
| 49 | retval = oe.prservice.prserv_dump_db(d) |
| 50 | if not retval: |
| 51 | bb.error("prexport_handler: export failed!") |
| 52 | return |
| 53 | (metainfo, datainfo) = retval |
| 54 | oe.prservice.prserv_export_tofile(d, metainfo, None, True) |
| 55 | |
| 56 | } |
| 57 | |
| 58 | addhandler prexport_handler |
| 59 | prexport_handler[eventmask] = "bb.event.RecipeParsed bb.event.ParseStarted bb.event.ParseCompleted" |