PyBugz is a python and command line interface to Bugzilla.

It was conceived as a tool to speed up the workflow for Gentoo Linux developers and contributors when dealing with bugs using Bugzilla. By avoiding the clunky web interface, the user quickly search, isolate and contribute to the project very quickly. Developers alike can easily extract attachments and close bugs all from the comfort of the command line.

PyBugz is written in Python and written in a way to be extended easily for use on other Bugzillas. I've tested the code unmodified on XenSource Bugzilla and GNOME Bugzilla.

For more information, check out the Google Code project post.

http://code.google.com/p/pybugz/

Download/Install

PuBugz requires ElementTree and Python 2.4.

  • For Gentoo Users, just install it via emerge pybugz.
  • Download the source: pybugz-0.6.11.tar.gz
  • SVN Source: svn co http://pybugz.googlecode.com/svn/trunk pybugz

License

Example Workflow

The command line program is named bugz:

liquidx@qoo $ bugz
Usage: bugz <subcommand> [parameter(s)] [options..]

Options:
  -b, --base <bugzilla_url>    Bugzilla base URL
  -u, --user <username>        User name (if required)
  -p, --password <password>    Password (if required)
  -f, --forget                 Do not remember authentication
  --columns <columns>          Number of columns to use when
                               displaying output

Subcommands:
  search      Search for bugs in bugzilla
  get         Get a bug from bugzilla
  attachment  Get an attachment from bugzilla
  post        Post a new bug into bugzilla
  modify      Modify a bug (eg. post a comment)
  attach      Attach file to a bug

By default, bugz uses http://bugs.gentoo.org/ as the Bugzilla Base URL (--base), but you can customise it to other bugzillas too:

$ bugz --base 'http://bugzilla.gnome.org/' search google
 * Using http://bugzilla.gnome.org/ ..
 * Searching for "google" ordered by "number"
 142505 bugzilla.gnome.org   Invite google to index bugs
 331250 rhythmbox            Add lookup on last.fm/google music/wikipedia/allm
 338341 Evolution            needs 'agenda view' like google calendar

To search, we can simply use the following to get a list of bugs.

$ bugz search bluetooth
 * Using http://bugs.gentoo.org/ ..
 * Searching for "bluetooth" ordered by "number"
  91558 liquidx              new ebuilds:bluetooth-alsa-1.6-r2.ebuild btsco-0.4
 110221 docs-team            Add section about OBEX on the command line to the
 111151 maintainer-wanted    [REQ] ebuild for the GNOME Bluetooth control remot
 124149 maintainer-wanted    kxdocker-bluetooth-1.0.0.ebuild
 137590 mobile               net-wireless/bluez-utils - /lib/udev/bluetooth.sh
 138277 kde                  kdebluetooth-1.0_beta1-r2 fails to compile with st
 142393 liquidx              [PATCH] net-wireless/bluez-libs - bluetooth.h does

If we want to read one of the bugs, we refer to it by name:

$ bugz get 142393
 * Using http://bugs.gentoo.org/ ..
 * Getting bug 142393 ..
Title       : [PATCH] net-wireless/bluez-libs - bluetooth.h doesn`t compile cleanly with -std=iso9899:1990 flag
Assignee    : liquidx@gentoo.org
Reported    : 2006-08-01 02:25 PST
Updated     : 2006-08-02 04:14:59 PST
...

You can also get an attachment by number:

$ bugz get 71123 | grep -i attach
...
[Attachment] [76050] [bluez-pin-0.30.ebuild]
...
$ bugz attachment 76050

If we've fixed the bug, we can always close it by modifying the bug:

$ bugz modify 12344 --fixed -c "Thanks for the patch. Committed to portage."

Finally, for users, if they want to report a bug, they can do it via:

$ bugz post

If authentication is required, the interface will prompt for a username and password, or if you would like to use bugz in a script, it can be passed as command line argument.

$ bugz -u liquidx -p secretpassword get 1234

And finally, if you would like to restrict the output width, you can use --columns:

$ bugz --columns 50 get 1234

Advanced Gentoo Workflow

Here is typically how I use bugz in my day-to-day Gentoo hacking.

First I might search for bugz that are assigned to me:

$ bugz search --assigned-to liquidx@gentoo.org

Maybe I'm bit lazy and want to do version bumps:

$ bugz search --assigned-to liquidx@gentoo.org --severity enhancement

So I've got a bug here for bluez-libs:

$ bugz get 143154

After reading the bug I decide that I will bump the package:

$ cd /usr/portage/net-wireless/bluez-libs 
.. bump new package ..
$ emerge bluez-libs
$ ekeyword \~all bluez-libs-3.1.ebuild
.. testing ..
$ repoman commit -m "version bump (#143154)"

Then I should close the bug and inform the reporter

$ bugz modify 143154 --status RESOLVED --resolution FIXED -c
"thanks for your report, the new version is in portage"

Or actually, we can simplify that to:

$ bugz modify 143154 --fixed -c "thanks, in portage."

Rinse. Wash. Repeat.


You can reply to me about this on Twitter: