1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 01:19:52 +00:00

bitbake: prserv: add extra requests

Useful for connecting a PR server to an upstream one

- "test-package" checks whether the specified package
  version and arch is known in the database.

- "test-pr" checks a specified output hash is found in the database.
  Otherwise it returns 'None' instead of a new value.

- "max-package-pr" returns the highest PR number for
  (version, arch) entries in the database, and None if not found

Add new DB functions supporting the above, plus test_value()
which tells whether a given value is available for the specified
package and architecture.

(Bitbake rev: 0f1474a30f741b760ca81c19dd1d8f3bd5647251)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Opdenacker
2024-04-12 11:02:29 +02:00
committed by Richard Purdie
parent 62a3a7172a
commit 112a37e6a9
3 changed files with 96 additions and 1 deletions
+28
View File
@@ -26,6 +26,9 @@ class PRServerClient(bb.asyncrpc.AsyncServerConnection):
self.handlers.update({
"get-pr": self.handle_get_pr,
"test-pr": self.handle_test_pr,
"test-package": self.handle_test_package,
"max-package-pr": self.handle_max_package_pr,
"import-one": self.handle_import_one,
"export": self.handle_export,
"is-readonly": self.handle_is_readonly,
@@ -43,6 +46,31 @@ class PRServerClient(bb.asyncrpc.AsyncServerConnection):
else:
self.server.table.sync_if_dirty()
async def handle_test_pr(self, request):
'''Finds the PR value corresponding to the request. If not found, returns None and doesn't insert a new value'''
version = request["version"]
pkgarch = request["pkgarch"]
checksum = request["checksum"]
value = self.server.table.find_value(version, pkgarch, checksum)
return {"value": value}
async def handle_test_package(self, request):
'''Tells whether there are entries for (version, pkgarch) in the db. Returns True or False'''
version = request["version"]
pkgarch = request["pkgarch"]
value = self.server.table.test_package(version, pkgarch)
return {"value": value}
async def handle_max_package_pr(self, request):
'''Finds the greatest PR value for (version, pkgarch) in the db. Returns None if no entry was found'''
version = request["version"]
pkgarch = request["pkgarch"]
value = self.server.table.find_max_value(version, pkgarch)
return {"value": value}
async def handle_get_pr(self, request):
version = request["version"]
pkgarch = request["pkgarch"]