mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

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>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
#
|
|
# 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()
|