Package: pybz
pybzpybz provides a simple command line utility to interact with a bugzilla
5.x server through their REST API. The specification of the bugzilla
REST API isdocumented
here.InstallationThe recommended installation method is throughpip. Installing as
root with pip is not recommended since it might create conflicts with
other globally installed python packages.pip install --user pybzThis will install pybz in~/.local/bin.If your system doesn’t havepipavailable, you can install it as
follows:curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | sudo pythonConfigurationNo configuration is required to use pybz, all parameters can be
specified in the command line. The server URL can be specified with the--urlflag; a server URL is required to perform any operation on
bugzilla. For operations that require authentication you must also
specify a username, which can also be provided in the command-line with
the--usernameflag.To avoid having to specify the server URL and the username on every
invocation ofpybz, these and other settings can be stored in an
initialization file stored at~/.pybz.Example~/.pybzfile:[core]
url = bugzilla.mozilla.org
username = alice@pybz.org
use_keyring = True
insecure = FalseAlthough possible, it is discouraged to store the password in the
initialization file or to provide it through the command-line. When a
username is specified but no password is provided, it will be requested
through the standard input. If theuse_keyringoption is enabled,
passwords will be securely stored and retrieved using the system
keyring.UsageUse the-hor--helpflags to get information about all the
calling options. pybz supports the following commandscommand | description
—————–|—————————————— new |
create new bug get | get bug information set | set bug information
list-fields | list all available bug fields list-products | list all
available bug products list-components | list all components for a
given productCommands likenew,getandsetaccept fields as parameters.Creating bugsWhen creating new bugs the fieldsproduct,component,versionandsummaryare mandatory, all other fields are
optional. Fields which accept a list of values likecccan be
populated by specifying each value individual, i.e.cc:alice@pybz.org cc:bob@pybz.org, much like searching.Searching for bugsThegetcommand is used to search for bugs, in the simplest form you
simply enter a list of numeric bug id’s to retrieve from the server.You can also use fields to create more complex queries. Fields must be
of the formname:value, if your value must contain spaces then you
must quote the whole field as follows"name:value with spaces".When searching different field names are searched as an AND, and if the
same field name appears multiple times then it is used as an OR. So
searching for “priority:P1 priority:P2” returns all bugs of priority P1
OR P2, while searching for “status:OPEN priority:P1” returns bugs of
with an OPEN status AND priority P1.Performing OR operations across different fields is not supported (for
instance, if you wanted to find all bugs which have either a status OPEN
or are have priority P1). For this you can use the quicksearch field,
and follow thequicksearch
APIUpdating bugsUpdating bugs uses the same field syntax as searching. The only
difference is that some fields are treated specially, in particular the
fieldsblocks,depends_on,see_also,groups,ccandkeywords. This is because these fields do not contain a single
value, but instead contain an array of values.If you want to specify that a is blocked by bug 12345 and 12346 then you
would doblocks:=12345blocks:=12346. If instead you wanted to add
bug 12346 to the list of blocking bugs, then you would useblocks:+12346, and if you wanted to remove bug 12346 from the
blocking list you would useblocks:-12346.All array like fields support the+and-, but not all of them
support setting with the=operator. This is a limitation of the
bugzilla API and not bugz. To see which fields support it simply try it
out and pybz will notify you of unsupported operations.ExamplesIn the interest of succinctness, the examples below omit the bugzilla
URL as well as the username. The configuration section of this document
provides more details on these options.BasicGet info about bug number 12345pybz get -n 12345Get info about bug numbers 12345, 12346 and 12347pybz get -n 12345 12346 12347Search for all bugs assigned toalice@pybz.orgpybz get -f assigned_to:alice@pybz.orgSearch for all bugs assigned toalice@pybz.orgwith priority P1pybz get -f assigned_to:alice@pybz.org priority:P1Search for all open bugs with priority P1 or P2pybz get -f status:OPEN priority:P1 priority:P2(Re-)assign bug number 12345 tobob@pybz.organd make it a P2pybz set -n 12345 -f assigned_to:bob@pybz.org priority:P2Upgrade bug number 12345 to have priority P1pybz set -n 12345 -f priority:P1Addcharlie@pybz.orgto the CC list of bug 12345, and removealice@pybz.orgfrom the CC list.pybz set -n 12345 -f cc:+charlie@pybz.org cc:-alice@pybz.orgReport a new bugpybz new -f "summary:new and terrible bug" product:pybz priority:P2 assigned_to:alice@pybz.orgAdvancedReassign all bugs frombob@pybz.orgtocharlie@pybz.orgpybz get -f assigned_to:bob@pybz.org -s id | xargs pybz set -f assigned_to:charlie@pybz.org -nDisplay a list of developers sorted by the number of open P1 bugs
assigned to thempybz get -f priority:P1 status:OPEN -s asigned_to | sort | uniq -c | sort