diff options
author | Mark Hatle <mark.hatle@xilinx.com> | 2021-03-25 19:16:44 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-31 00:06:23 +0100 |
commit | 3edc458cb9ebe6a2b07dfa3e4769a30425397377 (patch) | |
tree | f086015a8be313594beedb26485740fe5ba07ea4 /meta | |
parent | eba2ca9aef130535fede2a6dfcaea16fcb860f50 (diff) | |
download | poky-3edc458cb9ebe6a2b07dfa3e4769a30425397377.tar.gz |
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 <mark.hatle@xilinx.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/populate_sdk_ext.bbclass | 25 | ||||
-rw-r--r-- | meta/files/ext-sdk-prepare.py | 17 |
2 files changed, 42 insertions, 0 deletions
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 () { | |||
375 | # Map gcc-dependent uninative sstate cache for installer usage | 375 | # Map gcc-dependent uninative sstate cache for installer usage |
376 | f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n') | 376 | f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n') |
377 | 377 | ||
378 | if d.getVar("PRSERV_HOST"): | ||
379 | # Override this, we now include PR data, so it should only point ot the local database | ||
380 | f.write('PRSERV_HOST = "localhost:0"\n\n') | ||
381 | |||
378 | # Allow additional config through sdk-extra.conf | 382 | # Allow additional config through sdk-extra.conf |
379 | fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) | 383 | fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) |
380 | if fn: | 384 | if fn: |
@@ -398,6 +402,27 @@ python copy_buildsystem () { | |||
398 | bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache')) | 402 | bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache')) |
399 | shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat') | 403 | shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat') |
400 | 404 | ||
405 | # If PR Service is in use, we need to export this as well | ||
406 | bb.note('Do we have a pr database?') | ||
407 | if d.getVar("PRSERV_HOST"): | ||
408 | bb.note('Writing PR database...') | ||
409 | # Based on the code in classes/prexport.bbclass | ||
410 | import oe.prservice | ||
411 | #dump meta info of tables | ||
412 | localdata = d.createCopy() | ||
413 | localdata.setVar('PRSERV_DUMPOPT_COL', "1") | ||
414 | localdata.setVar('PRSERV_DUMPDIR', os.path.join(baseoutpath, 'conf')) | ||
415 | localdata.setVar('PRSERV_DUMPFILE', '${PRSERV_DUMPDIR}/prserv.inc') | ||
416 | |||
417 | bb.note('PR Database write to %s' % (localdata.getVar('PRSERV_DUMPFILE'))) | ||
418 | |||
419 | retval = oe.prservice.prserv_dump_db(localdata) | ||
420 | if not retval: | ||
421 | bb.error("prexport_handler: export failed!") | ||
422 | return | ||
423 | (metainfo, datainfo) = retval | ||
424 | oe.prservice.prserv_export_tofile(localdata, metainfo, datainfo, True) | ||
425 | |||
401 | # Use templateconf.cfg file from builddir if exists | 426 | # Use templateconf.cfg file from builddir if exists |
402 | if os.path.exists(builddir + '/conf/templateconf.cfg') and use_custom_templateconf == '1': | 427 | if os.path.exists(builddir + '/conf/templateconf.cfg') and use_custom_templateconf == '1': |
403 | shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg') | 428 | shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg') |
diff --git a/meta/files/ext-sdk-prepare.py b/meta/files/ext-sdk-prepare.py index 163d5e9912..d191e5e19c 100644 --- a/meta/files/ext-sdk-prepare.py +++ b/meta/files/ext-sdk-prepare.py | |||
@@ -44,6 +44,23 @@ def main(): | |||
44 | sdk_targets = [] | 44 | sdk_targets = [] |
45 | else: | 45 | else: |
46 | sdk_targets = ' '.join(sys.argv[2:]).split() | 46 | sdk_targets = ' '.join(sys.argv[2:]).split() |
47 | |||
48 | prserv = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'conf', 'prserv.inc') | ||
49 | if os.path.isfile(prserv): | ||
50 | with open(logfile, 'a') as logf: | ||
51 | logf.write('Importing PR data...\n') | ||
52 | |||
53 | ret = run_command_interruptible('bitbake-prserv-tool import %s' % prserv) | ||
54 | |||
55 | lastlog = get_last_consolelog() | ||
56 | if lastlog: | ||
57 | with open(lastlog, 'r') as f: | ||
58 | for line in f: | ||
59 | logf.write(line) | ||
60 | if ret: | ||
61 | print('ERROR: PR data import failed: error log written to %s' % logfile) | ||
62 | return ret | ||
63 | |||
47 | if not sdk_targets: | 64 | if not sdk_targets: |
48 | # Just do a parse so the cache is primed | 65 | # Just do a parse so the cache is primed |
49 | ret = run_command_interruptible('bitbake -p --quiet') | 66 | ret = run_command_interruptible('bitbake -p --quiet') |