aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2023-10-06 09:36:42 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-06 22:44:23 +0100
commita778b99e6a2a1a1e1b7eb26d48313fadcd34de54 (patch)
treebf7833441cb4e9271637d5d458dfb129985e6ee4
parent861d068b3a9fb5e91a01dbec54996a5a6f93ef29 (diff)
downloadbitbake-contrib-a778b99e6a2a1a1e1b7eb26d48313fadcd34de54.tar.gz
bitbake-hashclient: Add remove subcommand
Adds a subcommand to invoke the remove API on the server Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbin/bitbake-hashclient13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/bitbake-hashclient b/bin/bitbake-hashclient
index 494f17592..d09104336 100755
--- a/bin/bitbake-hashclient
+++ b/bin/bitbake-hashclient
@@ -113,6 +113,14 @@ def main():
with lock:
pbar.update()
+ def handle_remove(args, client):
+ where = {k: v for k, v in args.where}
+ if where:
+ result = client.remove(where)
+ print("Removed %d row(s)" % (result["count"]))
+ else:
+ print("No query specified")
+
parser = argparse.ArgumentParser(description='Hash Equivalence Client')
parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")')
parser.add_argument('--log', default='WARNING', help='Set logging level')
@@ -137,6 +145,11 @@ def main():
help='Include string in outhash')
stress_parser.set_defaults(func=handle_stress)
+ remove_parser = subparsers.add_parser('remove', help="Remove hash entries")
+ remove_parser.add_argument("--where", "-w", metavar="KEY VALUE", nargs=2, action="append", default=[],
+ help="Remove entries from table where KEY == VALUE")
+ remove_parser.set_defaults(func=handle_remove)
+
args = parser.parse_args()
logger = logging.getLogger('hashserv')