From ddafe24cef1e2119c348cef8399077680cb4b716 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sep 23 2023 00:31:01 +0000 Subject: [PATCH 1/2] createbz: set bug status to ASSIGNED and block the tracker This just implements a couple of steps you currently have to do manually. Convenience! Note, this depends on https://github.com/python-bugzilla/python-bugzilla/pull/190 to let us block on the alias. Signed-off-by: Adam Williamson --- diff --git a/changes/createbz.py b/changes/createbz.py index 2fdde7a..a14d69c 100644 --- a/changes/createbz.py +++ b/changes/createbz.py @@ -86,6 +86,18 @@ if __name__ == "__main__": b = bz.createbug(ret) # BZ is too slow... time.sleep(5) + # set bug to ASSIGNED and block the tracker + relnum = "".join((char for char in record.get("Targeted Release", "") if char.isdigit())) + if relnum: + vals = bz.build_update(status="ASSIGNED", blocks_add=[f"F{relnum}Changes"]) + else: + print("WARNING: unable to determine release number, cannot block tracker, please do this manually") + vals = bz.build_update(status="ASSIGNED") + try: + bz.update_bugs([b.id], vals) + time.sleep(5) + except xmlrpc.client.Fault: + print("WARNING: unable to set status and block tracker, please do this manually") if emails: # try adding CCs and setting assignee all in one go try: From 91df802a8a0734932476ab3136ae89749bf9d788 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sep 28 2023 21:50:26 +0000 Subject: [PATCH 2/2] processcp: fix parsing of not-done release notes links The current release note link parsing assumes every Change has a proper release note ticket. When they don't, we wind up with kinda weird bogus links with duplicated text. This tweaks the handling to be more similar to how we handle the tracker bug links, and not attempt to turn the discovered text into a release notes tracker link unless it actually is one (a string containing only pound signs and digits). Otherwise it just keeps whatever the text is. Also we fix FedoraFeaturePage.get() to always return a bytestring (before it returned a bytestring if there was any text, but a regular string if there wasn't). Signed-off-by: Adam Williamson --- diff --git a/changes/processcp.py b/changes/processcp.py index dba1b61..b5f4334 100644 --- a/changes/processcp.py +++ b/changes/processcp.py @@ -224,7 +224,7 @@ class FedoraFeaturePage(FeaturePage): for section in self.sections: if key in section.content: return section.content[key].encode("utf-8") - return "" + return b"" def getSummary(self): return self.summary @@ -307,6 +307,7 @@ if __name__ == "__main__": completed = False buglink = "" + rnlink = "" docs_contact = "" print(page.get("tracker bug")) @@ -331,6 +332,9 @@ if __name__ == "__main__": if bugstatus == "ON_QA" or bugstatus == "CLOSED": completed = True + rnlink = page.get("release notes tracker").decode("utf-8") + if rnlink.replace("#", "").isdigit(): + rnlink = f"[{RN_TRACKER}{rnlink.replace('#', '')} {rnlink}]" # write output file writer.writerow({ @@ -343,7 +347,7 @@ if __name__ == "__main__": "Targeted Release": page.get("targeted release").decode("utf-8"), "Last updated": page.get("last updated").decode("utf-8"), "Bug": buglink, - "Release Notes": page.get("release notes tracker") + "Release Notes": rnlink }) record['PageName'] = page.getName() @@ -353,13 +357,8 @@ if __name__ == "__main__": record['Target'] = page.get("targeted release") record['Updated'] = page.get("last updated").decode("utf-8") record['Bug'] = buglink - # Mangle the detected Release Notes issue because we parse the rendered output apparently - try: - rn_issue = page.get("release notes tracker").decode("utf-8") - record['ReleaseNotes'] = "[" + RN_TRACKER + rn_issue.replace('#','') + ' ' + rn_issue + "]" - except AttributeError: - # If there's no release notes issue yet, that's okay - pass + if rnlink: + record['ReleaseNotes'] = rnlink statuses = { 'NEW': "Not being worked on", 'ASSIGNED': "Change accepted", 'MODIFIED': "Testable", 'ON_QA': "100% code completed", 'RELEASE_PENDING': "Finished", 'CLOSED': "Finished", 'unknown': "Unknown", 'POST': 'In progress' } record['Status'] = statuses[bugstatus]