1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

bitbake: prserv: Replace XML RPC with modern asyncrpc implementation

Update the prserv client and server classes to use the modern json and
asyncio based RPC system implemented by the asyncrpc module.

(Bitbake rev: 6a2b23e27bb61185b8afb382e20ce79f996d9183)

Signed-off-by: Paul Barker <pbarker@konsulko.com>
[updated for asyncrpc changes, client split to separate file]
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Barker
2021-08-19 12:46:43 -04:00
committed by Richard Purdie
parent 4df610473f
commit fb3b05fe8d
2 changed files with 156 additions and 137 deletions
+41
View File
@@ -0,0 +1,41 @@
#
# SPDX-License-Identifier: GPL-2.0-only
#
import logging
import bb.asyncrpc
logger = logging.getLogger("BitBake.PRserv")
class PRAsyncClient(bb.asyncrpc.AsyncClient):
def __init__(self):
super().__init__('PRSERVICE', '1.0', logger)
async def getPR(self, version, pkgarch, checksum):
response = await self.send_message(
{'get-pr': {'version': version, 'pkgarch': pkgarch, 'checksum': checksum}}
)
if response:
return response['value']
async def importone(self, version, pkgarch, checksum, value):
response = await self.send_message(
{'import-one': {'version': version, 'pkgarch': pkgarch, 'checksum': checksum, 'value': value}}
)
if response:
return response['value']
async def export(self, version, pkgarch, checksum, colinfo):
response = await self.send_message(
{'export': {'version': version, 'pkgarch': pkgarch, 'checksum': checksum, 'colinfo': colinfo}}
)
if response:
return (response['metainfo'], response['datainfo'])
class PRClient(bb.asyncrpc.Client):
def __init__(self):
super().__init__()
self._add_methods('getPR', 'importone', 'export')
def _get_async_client(self):
return PRAsyncClient()