<HTML ><HEAD ><TITLE >Command-line Bugzilla Queries</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.61 "><LINK REL="HOME" TITLE="The Bugzilla Guide" HREF="index.html"><LINK REL="UP" TITLE="Useful Patches and Utilities for Bugzilla" HREF="patches.html"><LINK REL="PREVIOUS" TITLE="The setperl.csh Utility" HREF="setperl.html"><LINK REL="NEXT" TITLE="The Quicksearch Utility" HREF="quicksearch.html"></HEAD ><BODY CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >The Bugzilla Guide</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="setperl.html" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Appendix D. Useful Patches and Utilities for Bugzilla</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="quicksearch.html" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="cmdline" >D.3. Command-line Bugzilla Queries</A ></H1 ><P > Users can query Bugzilla from the command line using this suite of utilities. </P ><P > The query.conf file contains the mapping from options to field names and comparison types. Quoted option names are "grepped" for, so it should be easy to edit this file. Comments (#) have no effect; you must make sure these lines do not contain any quoted "option" </P ><P > buglist is a shell script which submits a Bugzilla query and writes the resulting HTML page to stdout. It supports both short options, (such as "-Afoo" or "-Rbar") and long options (such as "--assignedto=foo" or "--reporter=bar"). If the first character of an option is not "-", it is treated as if it were prefixed with "--default=". </P ><P > The columlist is taken from the COLUMNLIST environment variable. This is equivalent to the "Change Columns" option when you list bugs in buglist.cgi. If you have already used Bugzilla, use <B CLASS="command" >grep COLUMLIST ~/.netscape/cookies</B > to see your current COLUMNLIST setting. </P ><P > bugs is a simple shell script which calls buglist and extracts the bug numbers from the output. Adding the prefix "http://bugzilla.mozilla.org/buglist.cgi?bug_id=" turns the bug list into a working link if any bugs are found. Counting bugs is easy. Pipe the results through <B CLASS="command" >sed -e 's/,/ /g' | wc | awk '{printf $2 "\n"}'</B > </P ><P > Akkana says she has good results piping buglist output through <B CLASS="command" >w3m -T text/html -dump</B > </P ><DIV CLASS="procedure" ><OL TYPE="1" ><LI ><P > Download three files: </P ><OL CLASS="SUBSTEPS" TYPE="a" ><LI ><P > <TT CLASS="computeroutput" > <TT CLASS="prompt" >bash$</TT > <B CLASS="command" >wget -O query.conf 'http://bugzilla.mozilla.org/showattachment.cgi?attach_id=26157'</B > </TT > </P ></LI ><LI ><P > <TT CLASS="computeroutput" > <TT CLASS="prompt" >bash$</TT > <B CLASS="command" >wget -O buglist 'http://bugzilla.mozilla.org/showattachment.cgi?attach_id=26944'</B > </TT > </P ></LI ><LI ><P > <TT CLASS="computeroutput" > <TT CLASS="prompt" >bash#</TT > <B CLASS="command" >wget -O bugs 'http://bugzilla.mozilla.org/showattachment.cgi?attach_id=26215'</B > </TT > </P ></LI ></OL ></LI ><LI ><P > Make your utilities executable: <TT CLASS="computeroutput" > <TT CLASS="prompt" >bash$</TT > <B CLASS="command" >chmod u+x buglist bugs</B > </TT > </P ></LI ></OL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="setperl.html" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="quicksearch.html" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >The setperl.csh Utility</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="patches.html" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >The Quicksearch Utility</TD ></TR ></TABLE ></DIV ></BODY ></HTML >