Skip to content

Instantly share code, notes, and snippets.

@jralls
Created June 28, 2018 22:29
Show Gist options
  • Save jralls/c25aaf55cfa0ac86ffd995787fe53650 to your computer and use it in GitHub Desktop.
Save jralls/c25aaf55cfa0ac86ffd995787fe53650 to your computer and use it in GitHub Desktop.
GnuCash bug update script.
from __future__ import print_function
import time
import bugzilla
URL = "bugzilla.gnome.org"
bzapi = bugzilla.Bugzilla(URL)
if not bzapi.logged_in:
print("You need to log in to %s" % URL)
bzapi.interactive_login()
# Get a list of GnuCash bugs:
query = bzapi.build_query(product="GnuCash", include_fields=["id", "status"])
buglist = bzapi.query(query)
closing_comment = 'GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=%s. Please continue processing the bug there and please update any external references or bookmarks.'
closed_comment = 'GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=%s. Please update any external references or bookmarks.'
for bug in buglist:
if bug.status in ("RESOLVED", "VERIFIED"):
update = bzapi.build_update(comment=closed_comment % bug.id)
bzapi.update_bugs([bug.id], update)
else:
update = bzapi.build_update(comment=closing_comment % bug.id,
status="RESOLVED", resolution="OBSOLETE")
bzapi.update_bugs([bug.id], update)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment