leocharre has asked for the wisdom of the Perl Monks concerning the following question:

I'm using bugzilla to track development in my office. It's wonderful.

Here's the thing, I work with a lot of non-tech types. I need to be able to summarize .. Sum up a simple outline/ text.. that says something like..

bug 1: title
description
notes

bug 2: title
description
notes

kind of thing..

Because long format is overkill for these people.

There must be some script already out there to be able to get an array of structs/hashes for each bug.. so you can iterate and print ... or whatever.

Not finding it..

Before I start eating through the bugzilla code to do this.. anybody know of some script/module distro that does this?

Replies are listed 'Best First'.
Re: get list of bugzilla bugs as hashes?
by leocharre (Priest) on Aug 25, 2009 at 19:02 UTC

    Well, this is working..

    I can't get full description and comments.. but.. I get ok output..

    #!/usr/bin/perl use strict; use vars qw($VERSION); use LEOCHARRE::CLI2 ':all','u:p:s:'; use LEOCHARRE::Dir ':all'; $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)/g; use WWW::Bugzilla3; use Smart::Comments '###'; $opt_u or die("Missing username"); $opt_p or die("Missing password"); $opt_s or die("Missing site"); my $b = WWW::Bugzilla3->new( site => $opt_s ); my $r = $b->login( $opt_u, $opt_p ) or die("Could not login"); ### $r my @pids = $b->get_selectable_products(); # product ids ### product ids: @pids # get descriptive.. hashes.. my %product; for (@pids){ my $p = ($b->get_products($_))[0]; $product{$_} = $p; } ### %product my @all_bugs = $b->search; ### @all_bugs; my $count = scalar @all_bugs; warn("Have $count bugs"); $count or exit; my @bugs = $b->get_bugs( @all_bugs ); # bug ids ## @bugs #my $c = scalar @bugs; #($c == 1) or warn("Got $c bugs in id $id, expected 1 only?"); # get_bugs is weird BUG: for my $bug ( @bugs ){ $bug->{internals}->{resolution} ||= 'OPEN'; $bug->{internals}->{resolution}=~/INVALID|DUPLICATE/ and next BUG; # example return for $bug ## { ## alias => '', ## creation_time => '20090623T15:34:00', ## id => '15', ## internals => { ## alias => '', ## assigned_to => '1', ## bug_file_loc => '', ## bug_id => '15', ## bug_severity => 'enhancement', ## bug_status => 'RESOLVED', ## cclist_accessible => '1', ## cf_web_browser => '---', ## component_id => '4', ## creation_ts => '2009.06.23 15:34', ## delta_ts => '2009-06-23 15:55:39', ## everconfirmed => '1', ## op_sys => 'All', ## priority => 'P5', ## product_id => '3', ## qa_contact => '', ## rep_platform => 'All', ## reporter_accessible => '1', ## reporter_id => '1', ## resolution => 'FIXED', ## short_desc => 'branding all the clients i +n the dms', ## status_whiteboard => '', ## target_milestone => '---', ## version => 'DMS2' ## }, ## last_change_time => '20090623T15:55:39', ## summary => 'branding all the clients in the dms' ## } ## ] printf "--- title: %s id: %0.3d product: %s status: %s ", $bug->{summary}, $bug->{id}, $product{ $bug->{internals}->{product_id} }->{name}, ( $bug->{internals}->{resolution} || 'OPEN'), ; } exit; sub usage { qq{$0 [OPTION].. Show bugzilla summary for bureaucracy. -d debug -h help -v version -p string password -u string username -s string url of bugzilla website Example Usage: $0 -u joe\@cpan.org -p hahaha -s https://bugzilla.mysite.com/ }}

    Sample output..

    ---
    title: set ap on user fails
    id: 004
    product: DMS AdminUsers
    status: FIXED
    
    ---
    title: DMS Timing out
    id: 008
    product: DMS WUI
    status: FIXED
    
    ---
    title: add default restrict type APV for apusers
    id: 017
    product: DMS WUI
    status: FIXED
    
      I am getting following error. Could you please help me? RPC::XML::Client::send_request: HTTP server error: Can't verify SSL peers without knowing which Certificate Authorities to trust at /Library/Perl/5.18/RPC/XML/Client.pm line 416.
Re: get list of bugzilla bugs as hashes?
by leocharre (Priest) on Aug 27, 2009 at 17:12 UTC
    Ok, his is pretty much what I wanted: this is bugzillareport distro uploaded to cpan.

    It may seem silly, but personally it's saving me a lot of time, to be able to tell the bureaucracy what's up without having to rewrite summaries and .. tone down technical speech.