blob: 809ec1034e638ccb5d86d105d41b55a30972fb3c [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001PRSERV_DUMPOPT_VERSION = "${PRAUTOINX}"
2PRSERV_DUMPOPT_PKGARCH = ""
3PRSERV_DUMPOPT_CHECKSUM = ""
4PRSERV_DUMPOPT_COL = "0"
5
6PRSERV_DUMPDIR ??= "${LOG_DIR}/db"
7PRSERV_DUMPFILE ??= "${PRSERV_DUMPDIR}/prserv.inc"
8
9python prexport_handler () {
10 import bb.event
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050011 if not e.data or bb.data.inherits_class('native', e.data) or \
12 bb.data.inherits_class('crosssdk', e.data):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013 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 Williamsd8c66bc2016-06-20 12:57:21 -050025 bb.note("prexport_handler: No AUTOPR values found for %s" % ver)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 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
58addhandler prexport_handler
59prexport_handler[eventmask] = "bb.event.RecipeParsed bb.event.ParseStarted bb.event.ParseCompleted"