mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
bitbake: hashserv: Extend get_outhash API to optionally include unihash
Extends the get_outhash API with a flag indicating whether to include the unihash in the output. This is means that the query doesn't require the unihash entry to be present to return a result (Bitbake rev: b8d6abfeb4a0765727a62b3d8d83276335c7c7d6) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
840d60de78
commit
cc218dd108
@@ -83,10 +83,10 @@ class AsyncClient(bb.asyncrpc.AsyncClient):
|
|||||||
{"get": {"taskhash": taskhash, "method": method, "all": all_properties}}
|
{"get": {"taskhash": taskhash, "method": method, "all": all_properties}}
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_outhash(self, method, outhash, taskhash):
|
async def get_outhash(self, method, outhash, taskhash, with_unihash=True):
|
||||||
await self._set_mode(self.MODE_NORMAL)
|
await self._set_mode(self.MODE_NORMAL)
|
||||||
return await self.send_message(
|
return await self.send_message(
|
||||||
{"get-outhash": {"outhash": outhash, "taskhash": taskhash, "method": method}}
|
{"get-outhash": {"outhash": outhash, "taskhash": taskhash, "method": method, "with_unihash": with_unihash}}
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_stats(self):
|
async def get_stats(self):
|
||||||
|
|||||||
@@ -270,27 +270,42 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection):
|
|||||||
method = request['method']
|
method = request['method']
|
||||||
outhash = request['outhash']
|
outhash = request['outhash']
|
||||||
taskhash = request['taskhash']
|
taskhash = request['taskhash']
|
||||||
|
with_unihash = request.get("with_unihash", True)
|
||||||
|
|
||||||
with closing(self.db.cursor()) as cursor:
|
with closing(self.db.cursor()) as cursor:
|
||||||
d = await self.get_outhash(cursor, method, outhash, taskhash)
|
d = await self.get_outhash(cursor, method, outhash, taskhash, with_unihash)
|
||||||
|
|
||||||
self.write_message(d)
|
self.write_message(d)
|
||||||
|
|
||||||
async def get_outhash(self, cursor, method, outhash, taskhash):
|
async def get_outhash(self, cursor, method, outhash, taskhash, with_unihash=True):
|
||||||
d = None
|
d = None
|
||||||
cursor.execute(
|
if with_unihash:
|
||||||
'''
|
cursor.execute(
|
||||||
SELECT *, unihashes_v2.unihash AS unihash FROM outhashes_v2
|
'''
|
||||||
INNER JOIN unihashes_v2 ON unihashes_v2.method=outhashes_v2.method AND unihashes_v2.taskhash=outhashes_v2.taskhash
|
SELECT *, unihashes_v2.unihash AS unihash FROM outhashes_v2
|
||||||
WHERE outhashes_v2.method=:method AND outhashes_v2.outhash=:outhash
|
INNER JOIN unihashes_v2 ON unihashes_v2.method=outhashes_v2.method AND unihashes_v2.taskhash=outhashes_v2.taskhash
|
||||||
ORDER BY outhashes_v2.created ASC
|
WHERE outhashes_v2.method=:method AND outhashes_v2.outhash=:outhash
|
||||||
LIMIT 1
|
ORDER BY outhashes_v2.created ASC
|
||||||
''',
|
LIMIT 1
|
||||||
{
|
''',
|
||||||
'method': method,
|
{
|
||||||
'outhash': outhash,
|
'method': method,
|
||||||
}
|
'outhash': outhash,
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
cursor.execute(
|
||||||
|
"""
|
||||||
|
SELECT * FROM outhashes_v2
|
||||||
|
WHERE outhashes_v2.method=:method AND outhashes_v2.outhash=:outhash
|
||||||
|
ORDER BY outhashes_v2.created ASC
|
||||||
|
LIMIT 1
|
||||||
|
""",
|
||||||
|
{
|
||||||
|
'method': method,
|
||||||
|
'outhash': outhash,
|
||||||
|
}
|
||||||
|
)
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
|
|
||||||
if row is not None:
|
if row is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user