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
In reply to Re: get list of bugzilla bugs as hashes?
by leocharre
in thread get list of bugzilla bugs as hashes?
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |