summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/hashserv/client.py4
-rw-r--r--bitbake/lib/hashserv/server.py45
2 files changed, 32 insertions, 17 deletions
diff --git a/bitbake/lib/hashserv/client.py b/bitbake/lib/hashserv/client.py
index 7446e4c9f6..eeafeabda0 100644
--- a/bitbake/lib/hashserv/client.py
+++ b/bitbake/lib/hashserv/client.py
@@ -83,10 +83,10 @@ class AsyncClient(bb.asyncrpc.AsyncClient):
83 {"get": {"taskhash": taskhash, "method": method, "all": all_properties}} 83 {"get": {"taskhash": taskhash, "method": method, "all": all_properties}}
84 ) 84 )
85 85
86 async def get_outhash(self, method, outhash, taskhash): 86 async def get_outhash(self, method, outhash, taskhash, with_unihash=True):
87 await self._set_mode(self.MODE_NORMAL) 87 await self._set_mode(self.MODE_NORMAL)
88 return await self.send_message( 88 return await self.send_message(
89 {"get-outhash": {"outhash": outhash, "taskhash": taskhash, "method": method}} 89 {"get-outhash": {"outhash": outhash, "taskhash": taskhash, "method": method, "with_unihash": with_unihash}}
90 ) 90 )
91 91
92 async def get_stats(self): 92 async def get_stats(self):
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py
index daf1ffacbb..d52e1d46df 100644
--- a/bitbake/lib/hashserv/server.py
+++ b/bitbake/lib/hashserv/server.py
@@ -270,27 +270,42 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection):
270 method = request['method'] 270 method = request['method']
271 outhash = request['outhash'] 271 outhash = request['outhash']
272 taskhash = request['taskhash'] 272 taskhash = request['taskhash']
273 with_unihash = request.get("with_unihash", True)
273 274
274 with closing(self.db.cursor()) as cursor: 275 with closing(self.db.cursor()) as cursor:
275 d = await self.get_outhash(cursor, method, outhash, taskhash) 276 d = await self.get_outhash(cursor, method, outhash, taskhash, with_unihash)
276 277
277 self.write_message(d) 278 self.write_message(d)
278 279
279 async def get_outhash(self, cursor, method, outhash, taskhash): 280 async def get_outhash(self, cursor, method, outhash, taskhash, with_unihash=True):
280 d = None 281 d = None
281 cursor.execute( 282 if with_unihash:
282 ''' 283 cursor.execute(
283 SELECT *, unihashes_v2.unihash AS unihash FROM outhashes_v2 284 '''
284 INNER JOIN unihashes_v2 ON unihashes_v2.method=outhashes_v2.method AND unihashes_v2.taskhash=outhashes_v2.taskhash 285 SELECT *, unihashes_v2.unihash AS unihash FROM outhashes_v2
285 WHERE outhashes_v2.method=:method AND outhashes_v2.outhash=:outhash 286 INNER JOIN unihashes_v2 ON unihashes_v2.method=outhashes_v2.method AND unihashes_v2.taskhash=outhashes_v2.taskhash
286 ORDER BY outhashes_v2.created ASC 287 WHERE outhashes_v2.method=:method AND outhashes_v2.outhash=:outhash
287 LIMIT 1 288 ORDER BY outhashes_v2.created ASC
288 ''', 289 LIMIT 1
289 { 290 ''',
290 'method': method, 291 {
291 'outhash': outhash, 292 'method': method,
292 } 293 'outhash': outhash,
293 ) 294 }
295 )
296 else:
297 cursor.execute(
298 """
299 SELECT * FROM outhashes_v2
300 WHERE outhashes_v2.method=:method AND outhashes_v2.outhash=:outhash
301 ORDER BY outhashes_v2.created ASC
302 LIMIT 1
303 """,
304 {
305 'method': method,
306 'outhash': outhash,
307 }
308 )
294 row = cursor.fetchone() 309 row = cursor.fetchone()
295 310
296 if row is not None: 311 if row is not None: