From 72b7ac6fa92a7082b07970f3c7d5b003b3148533 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 17 Feb 2012 16:11:36 +0100 Subject: [PATCH] Bug 7553 new script, in a new directory, to automatically check bugzilla need signoff patches with the bugz script, we can play with bugzilla bug status. This script check all bugs that "needs signoff", and, at the end, report a list of all those that don't apply. If you copy/paste this list into bugzilla search you can see all of them Note that the script is very verbose, but the list appear at the end of the process. Also note that I planned to automatically update patch status, but bugz don't handle "Patch doesn't apply" status and complain for it. So the script just report the list. --- misc/devel/testbugzillapatches.pl | 133 +++++++++++++++++++++++++++++++++++++ misc/devel/yyyy | 23 +++++++ 2 files changed, 156 insertions(+), 0 deletions(-) create mode 100755 misc/devel/testbugzillapatches.pl create mode 100644 misc/devel/yyyy diff --git a/misc/devel/testbugzillapatches.pl b/misc/devel/testbugzillapatches.pl new file mode 100755 index 0000000..ab83bed --- /dev/null +++ b/misc/devel/testbugzillapatches.pl @@ -0,0 +1,133 @@ +#!/usr/bin/perl + +# Copyright BibLibre, 2012 +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +=head1 SYNOPSIS + +./testbugzillapatches.pl --u yourlogin --p your password +./testbugzillapatches.pl --help for detailled help + + +=head1 DESCRIPTION + +This script will query Koha bugzilla (http://bugs.koha-community.org/bugzilla3/) for all bugs waiting for patch signoff +and will test that the patches still apply fine. + +if a patch apply, nothing is made + +if a patch does not apply, the bug status is set to "Does not apply", with a message saying +"misc/devel/testbugzillapatches.pl has detected that the patch(es) does not apply anymore + +=head1 PARAMETERS + +\t-u your bugzilla username +\t-p your bugzilla password +\t-h or --help help +\t-d debug mode, will give you more details about what's done +\t-t test mode, won't submit any comment to bugzilla, will just report what's applying and what's not. + +=head1 PRE-REQUISITE + +This script must be run in a directory where your git koha is setup. + +Git must be uptodate, the script don't try to pull anything from the git repo + +=cut + +#read parameters +# u = bugzilla username +# p = bugzilla password +use 5.10.0; +use strict; +use warnings; +use Getopt::Long; +use Pod::Usage; + +my $login=''; +my $password=''; +my $help=''; +my $DEBUG=0; +my $test=0; +my $doesnotapplylist=''; + +GetOptions( 'u' => \$login, + 'p' => \$password, + 'h|help' => \$help, + 'd' => \$DEBUG, + 't' => \$test, + ); + +if ($help or not $login) { + pod2usage(-verbose => $help?2:1 ); + exit; +} + +# first, retrieve all bugs that needs signoff +my @buglist = `bugz -u $login -p $password -b http://bugs.koha-community.org/bugzilla3/ search -s "Needs signoff"`; +# then parse all bugs and try to apply them +foreach my $bugtotest (@buglist) { + $bugtotest =~ /(....)(.*)/; + my $bugnumber = $1; + if ($bugnumber =~ /\d{4}/) { +# next unless $bugnumber eq '7261'; + # bug to test found, try to apply... + # first checkout master, remove test branch and recreate it + my $checkout = `git checkout master 2>/dev/null;git branch -D test >/dev/null 2>/dev/null;git checkout -b test 2>/dev/null`; + my $gitbz; + # now apply the patch + $gitbz = `git bz apply $bugnumber