cmdline.html 4.32 KB
<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.pl 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 C. 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"
>C.2. 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.pl 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
>