From 6f47d2423177928db2b83ca687a586acc59b2b0b Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Nov 14 2023 20:39:06 +0000 Subject: createbz: fix the existing bug query to be more precise @amoloney found that the current code believes https://bugzilla.redhat.com/show_bug.cgi?id=1897235 is an 'existing bug' for the F40 KDE Plasma 6 Change, because the bug name for that Change is "KDE Plasma 6" and "AArch64 KDE Plasma Desktop image" contains all the space-separated strings in "KDE Plasma 6", which is the default match type for search queries. This switches to the most precise match type I can find - a regex wrapped in ^ and $. There doesn't seem to be a "is exactly this string" match type, but this seems to achieve the effect. Signed-off-by: Adam Williamson --- diff --git a/changes/createbz.py b/changes/createbz.py index a14d69c..d67455b 100644 --- a/changes/createbz.py +++ b/changes/createbz.py @@ -61,10 +61,13 @@ if __name__ == "__main__": # another check for an existing bug, in case this script is # run twice without feature-pages.csv being updated query = bz.build_query( - short_desc=record["Name"], + short_desc="^" + record["Name"] + "$", component="Changes Tracking", product="Fedora" ) + # we use a regex match for the description to make it as + # precise as possible + query["short_desc_type"] = "regexp" ret = bz.query(query) if ret: print("Bug already exists")