Bugzilla – Attachment 7735 Details for
Bug 7553
automated checking that "need signoff" patch still applies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7553 new script, in a new directory, to automatically check bugzilla need signoff patches
Bug-7553-new-script-in-a-new-directory-to-automati.patch (text/plain), 6.61 KB, created by
Paul Poulain
on 2012-02-17 15:12:16 UTC
(
hide
)
Description:
Bug 7553 new script, in a new directory, to automatically check bugzilla need signoff patches
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2012-02-17 15:12:16 UTC
Size:
6.61 KB
patch
obsolete
>From 72b7ac6fa92a7082b07970f3c7d5b003b3148533 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >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 <yyyy`; >+ # test if things went well or no: >+ if ($gitbz =~ /git am --skip/ or $gitbz =~ /BEGIN failed/ or $gitbz =~ /cannot convert from/ ) { >+ # git am --skip is the most common string included if the patch fails >+ # BEGIN failed happend when you have pre-applypatch git hook and the script don't compile >+ # cannot convert from happend when you have a wrongly encoded patch >+ # if things went wrong, rollback ! >+ my $cancel = `git am --abort`; >+ # if something went wrong, checkout any file modified >+ my $checkout = `git status -s`; >+ foreach (split /\n/, $checkout) { >+ my $file_to_checkout = $_; >+ next if $file_to_checkout =~ /^\?\?/; >+ $file_to_checkout =~ s/^ M //; >+ `git checkout $file_to_checkout`; >+ } >+ if ($gitbz =~ /CONFLICT \(content\): Merge conflict in installer\/data\/mysql\/updatedatabase.pl/) { >+ # just issue that there is a conflict in an updatedatabase.pl, don't change bug status >+ say "bug $bugnumber has an updatedatabase and don't apply cleanly"; >+ } else { >+ # the patch does not apply anymore >+ $DEBUG and say "!!!!!!!!!!!!! Bug $bugnumber does not apply anymore"; >+ if ($test) { >+ say "!!!!!!!!!!! Bug $bugnumber does not apply anymore"; >+ } else { >+ # bugz doesn't accept the status "Patch doesn't apply". Until it's fixed, just report the patch don't apply >+ # `bugz -u $login -p $password -b http://bugs.koha-community.org/bugzilla3/ modify -s "Patch doesn't apply" -c "The script misc/devel/testbugzillapatches.pl has detected that this patch does not apply anymore:\n $gitbz" $bugnumber`; >+ print "!!!!!!!!!!! Bug $bugnumber does not apply anymore\n"; >+ $doesnotapplylist.=",$bugnumber"; >+ } >+ } >+ } else { >+ $test and print "+++++++++++ Bug $bugnumber apply cleanly\n"; >+ } >+ } else { >+ $DEBUG and print "NOT A BUG: $bugtotest\n"; >+ } >+} >+say $doesnotapplylist; >+ >diff --git a/misc/devel/yyyy b/misc/devel/yyyy >new file mode 100644 >index 0000000..42a90f8 >--- /dev/null >+++ b/misc/devel/yyyy >@@ -0,0 +1,23 @@ >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >+y >-- >1.7.5.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7553
: 7735