From 3edc458cb9ebe6a2b07dfa3e4769a30425397377 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Thu, 25 Mar 2021 19:16:44 -0500 Subject: populate_sdk_ext: Add support for PR service In the classes/populate_sdk_ext.bbclass the system already copies a number of configurations, such as the hash equivalency data. However, the PR service was being handled. The new code works by checking if PRSERV_HOST is defined, if it is, use the existing export functions to write out a conf/prserv.inc file into the eSDK. On eSDK install, if a conf/prserv.inc file is present we then import this file into the system. This mechanism will work if the PRSERV_HOST is local or remote, as it pulls the necessary data from the server and then imports it to a local database on eSDK installation. Note: the conf/prserv.inc file is not deleted at this time. It was left for possible debugging purposes, but removing it is something we could decide to do in the future. (From OE-Core rev: e207dabdfaa07cd5ebba1cd7dd58610f7185c7e2) Signed-off-by: Mark Hatle Signed-off-by: Mark Hatle Signed-off-by: Richard Purdie --- meta/classes/populate_sdk_ext.bbclass | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'meta/classes/populate_sdk_ext.bbclass') diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass index 14689ec6ac..84232ed9f5 100644 --- a/meta/classes/populate_sdk_ext.bbclass +++ b/meta/classes/populate_sdk_ext.bbclass @@ -375,6 +375,10 @@ python copy_buildsystem () { # Map gcc-dependent uninative sstate cache for installer usage f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n') + if d.getVar("PRSERV_HOST"): + # Override this, we now include PR data, so it should only point ot the local database + f.write('PRSERV_HOST = "localhost:0"\n\n') + # Allow additional config through sdk-extra.conf fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) if fn: @@ -398,6 +402,27 @@ python copy_buildsystem () { bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache')) shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat') + # If PR Service is in use, we need to export this as well + bb.note('Do we have a pr database?') + if d.getVar("PRSERV_HOST"): + bb.note('Writing PR database...') + # Based on the code in classes/prexport.bbclass + import oe.prservice + #dump meta info of tables + localdata = d.createCopy() + localdata.setVar('PRSERV_DUMPOPT_COL', "1") + localdata.setVar('PRSERV_DUMPDIR', os.path.join(baseoutpath, 'conf')) + localdata.setVar('PRSERV_DUMPFILE', '${PRSERV_DUMPDIR}/prserv.inc') + + bb.note('PR Database write to %s' % (localdata.getVar('PRSERV_DUMPFILE'))) + + retval = oe.prservice.prserv_dump_db(localdata) + if not retval: + bb.error("prexport_handler: export failed!") + return + (metainfo, datainfo) = retval + oe.prservice.prserv_export_tofile(localdata, metainfo, datainfo, True) + # Use templateconf.cfg file from builddir if exists if os.path.exists(builddir + '/conf/templateconf.cfg') and use_custom_templateconf == '1': shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg') -- cgit v1.2.3-54-g00ecf