diff options
Diffstat (limited to 'meta/classes/prexport.bbclass')
-rw-r--r-- | meta/classes/prexport.bbclass | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/classes/prexport.bbclass b/meta/classes/prexport.bbclass new file mode 100644 index 0000000000..5b5b707a88 --- /dev/null +++ b/meta/classes/prexport.bbclass | |||
@@ -0,0 +1,45 @@ | |||
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 | ||
11 | if not e.data: | ||
12 | return | ||
13 | |||
14 | if isinstance(e, bb.event.RecipeParsed): | ||
15 | import oe.prservice | ||
16 | #get all PR values for the current PRAUTOINX | ||
17 | ver = e.data.getVar('PRSERV_DUMPOPT_VERSION', True) | ||
18 | ver = ver.replace('%','-') | ||
19 | retval = oe.prservice.prserv_dump_db(e.data) | ||
20 | if not retval: | ||
21 | bb.fatal("prexport_handler: export failed!") | ||
22 | (metainfo, datainfo) = retval | ||
23 | if not datainfo: | ||
24 | bb.error("prexport_handler: No AUROPR values found for %s" % ver) | ||
25 | return | ||
26 | oe.prservice.prserv_export_tofile(e.data, None, datainfo, False) | ||
27 | elif isinstance(e, bb.event.ParseStarted): | ||
28 | import bb.utils | ||
29 | #remove dumpfile | ||
30 | bb.utils.remove(e.data.getVar('PRSERV_DUMPFILE', True)) | ||
31 | elif isinstance(e, bb.event.ParseCompleted): | ||
32 | import oe.prservice | ||
33 | #dump meta info of tables | ||
34 | d = e.data.createCopy() | ||
35 | d.setVar('PRSERV_DUMPOPT_COL', "1") | ||
36 | retval = oe.prservice.prserv_dump_db(d) | ||
37 | if not retval: | ||
38 | bb.error("prexport_handler: export failed!") | ||
39 | return | ||
40 | (metainfo, datainfo) = retval | ||
41 | oe.prservice.prserv_export_tofile(d, metainfo, None, True) | ||
42 | |||
43 | } | ||
44 | |||
45 | addhandler prexport_handler | ||