From f9c572e42f2b5fec239e0f584bd07bdf7e65e9d7 Mon Sep 17 00:00:00 2001 From: tuibuilder_pel7x64builder0 Date: Wed, 4 Sep 2019 09:38:04 +0200 Subject: [PATCH] git-bugzilla package creation Signed-off-by: tuibuilder_pel7x64builder0 --- ...001-Do-not-default-to-GNOME-bugzilla.patch | 50 ++++++++ ...-a-warning-about-uninitialized-value.patch | 25 ++++ SOURCES/0003-Attach-git-am-able-patches.patch | 26 ++++ ...fix-bugzilla.redhat.com-issues-4.4.x.patch | 62 ++++++++++ SPECS/git-bugzilla.spec | 113 ++++++++++++++++++ 5 files changed, 276 insertions(+) create mode 100644 SOURCES/0001-Do-not-default-to-GNOME-bugzilla.patch create mode 100644 SOURCES/0002-Fix-a-warning-about-uninitialized-value.patch create mode 100644 SOURCES/0003-Attach-git-am-able-patches.patch create mode 100644 SOURCES/ersek-authenticate-fix-bugzilla.redhat.com-issues-4.4.x.patch create mode 100644 SPECS/git-bugzilla.spec diff --git a/SOURCES/0001-Do-not-default-to-GNOME-bugzilla.patch b/SOURCES/0001-Do-not-default-to-GNOME-bugzilla.patch new file mode 100644 index 0000000..f92b4e1 --- /dev/null +++ b/SOURCES/0001-Do-not-default-to-GNOME-bugzilla.patch @@ -0,0 +1,50 @@ +From be0337f39091a91b780d55ef4baece05b25a3211 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Sat, 19 Dec 2009 17:22:28 +0100 +Subject: [PATCH 1/2] Do not default to GNOME bugzilla + +--- + git-send-bugzilla.pl | 13 ++++++++++--- + 1 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/git-send-bugzilla.pl b/git-send-bugzilla.pl +index c26af96..8f30460 100755 +--- a/git-send-bugzilla.pl ++++ b/git-send-bugzilla.pl +@@ -37,7 +37,7 @@ sub authenticate { + } + + print STDERR "Logging in as $username...\n"; +- $mech->get("$url/index.cgi?GoAheadAndLogIn=1"); ++ $mech->get("$url?GoAheadAndLogIn=1"); + die "Can't fetch login form: ", $mech->res->status_line + unless $mech->success; + +@@ -106,7 +106,7 @@ sub add_attachment { + unless $mech->success; + + die "Error while attaching patch. Aborting\n" +- unless $mech->title =~ /Changes Submitted/i; ++ unless $mech->title =~ /(Changes Submitted|Attachment \d+ added)/i; + } + + sub read_repo_config { +@@ -131,7 +131,14 @@ sub usage { + exit $exitcode; + } + +-$url = read_repo_config 'url', 'str', 'http://bugzilla.gnome.org'; ++$url = read_repo_config 'url'; ++die < +Date: Sat, 19 Dec 2009 17:23:27 +0100 +Subject: [PATCH 2/2] Fix a warning about uninitialized value + +--- + git-send-bugzilla.pl | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/git-send-bugzilla.pl b/git-send-bugzilla.pl +index 8f30460..e40402e 100755 +--- a/git-send-bugzilla.pl ++++ b/git-send-bugzilla.pl +@@ -51,7 +51,7 @@ sub authenticate { + + sub get_patch_info { + my $rev1 = shift; +- my $rev2 = shift | ''; ++ my $rev2 = shift || ''; + + my $description; + my $comment = ''; +-- +1.6.5.5 + diff --git a/SOURCES/0003-Attach-git-am-able-patches.patch b/SOURCES/0003-Attach-git-am-able-patches.patch new file mode 100644 index 0000000..f15e6d8 --- /dev/null +++ b/SOURCES/0003-Attach-git-am-able-patches.patch @@ -0,0 +1,26 @@ +From e6dadfe44934a26978b97f2e951d72d04165e339 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Wed, 28 Jul 2010 15:39:19 +0200 +Subject: [PATCH] Attach git am -able patches + +--- + git-send-bugzilla.pl | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/git-send-bugzilla.pl b/git-send-bugzilla.pl +index e40402e..7fe5693 100755 +--- a/git-send-bugzilla.pl ++++ b/git-send-bugzilla.pl +@@ -69,7 +69,8 @@ sub get_patch_info { + $comment .= "\n---\n" unless $comment eq ''; + $comment .= `git diff-tree --stat --no-commit-id $rev1 $rev2`; + +- my $patch = `git diff-tree -p $rev1 $rev2`; ++ my $range = $rev2 ? "..$rev2" : " -1"; ++ my $patch = `git format-patch --stdout $rev1$range`; + + return ($description, $comment, $patch); + } +-- +1.7.1 + diff --git a/SOURCES/ersek-authenticate-fix-bugzilla.redhat.com-issues-4.4.x.patch b/SOURCES/ersek-authenticate-fix-bugzilla.redhat.com-issues-4.4.x.patch new file mode 100644 index 0000000..c97d33f --- /dev/null +++ b/SOURCES/ersek-authenticate-fix-bugzilla.redhat.com-issues-4.4.x.patch @@ -0,0 +1,62 @@ +From eaefaf63be7f083b601505e20eb88e658f355a0b Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Tue, 7 Oct 2014 12:40:13 +0200 +Subject: [PATCH] authenticate: fix bugzilla.redhat.com issues (4.4.x) + +There are two problems in the authenticate() subroutine. + +The first is that git-send-bugzilla sends a GET request, even though it +should send a POST. This is remedied by replacing "mech->submit" with the +more explicit "mech->submit_form", where the login button is explicitly +selected for clicking. + +The second problem is documented here: + +https://jira.almworks.com/browse/DZO-1189 + +Basically, the POST request for logging in must contain the valid +Bugzilla_login_token value that the initial GET returned. + +Unfortunately, the initial GET doesn't return such a Bugzilla_login_token +at all, because Bugzilla 4.4.x (erroneously) provides that only if the +initial GET contains Bugzilla_login_request_cookie. Since we don't do that +on the initial get, we receive no Bugzilla_login_token, and then the POST +request is rejected. + +This is fixed by sending the initial GET twice -- the first GET will makes +sure we set Bugzilla_login_request_cookie on the second, and the second +(now correct) GET makes sure that Bugzilla_login_token is set in the +response. We then reflect Bugzilla_login_token in the login POST request. + +Signed-off-by: Laszlo Ersek +--- + git-send-bugzilla.pl | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/git-send-bugzilla.pl b/git-send-bugzilla.pl +index 219cdcc..98582c4 100755 +--- a/git-send-bugzilla.pl ++++ b/git-send-bugzilla.pl +@@ -42,10 +42,16 @@ sub authenticate { + $mech->get("$url?GoAheadAndLogIn=1"); + die "Can't fetch login form: ", $mech->res->status_line + unless $mech->success; ++ $mech->get("$url?GoAheadAndLogIn=1"); ++ ++ $mech->submit_form( ++ with_fields => { ++ Bugzilla_login => $username, ++ Bugzilla_password => $password ++ }, ++ button => "GoAheadAndLogIn" ++ ); + +- $mech->set_fields(Bugzilla_login => $username, +- Bugzilla_password => $password); +- $mech->submit; + die "Login submission failed: ", $mech->res->status_line + unless $mech->success; + die "Invalid login or password\n" if $mech->title =~ /Invalid/i; +-- +1.8.3.1 + diff --git a/SPECS/git-bugzilla.spec b/SPECS/git-bugzilla.spec new file mode 100644 index 0000000..5a8d249 --- /dev/null +++ b/SPECS/git-bugzilla.spec @@ -0,0 +1,113 @@ +Name: git-bugzilla +Version: 0 +Release: 0.19.20091211git%{?dist} +Summary: Attach patches to a bugzilla bug + +Group: Development/Tools +License: GPLv2+ +URL: http://git.collabora.co.uk/?p=user/cassidy/git-bugzilla +# wget -O git-bugzilla-fc2be92.tar.gz \ +# 'http://git.collabora.co.uk/?p=user/cassidy/git-bugzilla;a=snapshot;h=fc2be92;sf=tgz' +Source0: %{name}-fc2be92.tar.gz +Patch0: 0001-Do-not-default-to-GNOME-bugzilla.patch +Patch1: 0002-Fix-a-warning-about-uninitialized-value.patch +Patch2: 0003-Attach-git-am-able-patches.patch +Patch3: ersek-authenticate-fix-bugzilla.redhat.com-issues-4.4.x.patch + +BuildRequires: asciidoc +#BuildRequires: perl-generators +BuildRequires: xmlto +Requires: git-core +Requires: perl(WWW::Mechanize) +Requires: perl(Crypt::SSLeay) +Requires: perl(LWP::Protocol::https) +BuildArch: noarch + +%description +Add commits as attachments to a Bugzilla bug. + + +%prep +%setup -q -n %{name} +%patch0 -p1 -b .gnome +%patch1 -p1 -b .warn +%patch2 -p1 -b .gitam +%patch3 -p1 -b .ersek + + +%build +make %{?_smp_mflags} all doc + + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} +make -C docs install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} + + + +%files +%{_bindir}/git-send-bugzilla +%{_mandir}/man1/git-send-bugzilla.1* + + +%changelog +* Fri Jul 13 2018 Fedora Release Engineering - 0-0.19.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering - 0-0.18.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0-0.17.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0-0.16.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 03 2016 Fedora Release Engineering - 0-0.15.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 0-0.14.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Oct 09 2014 Matej Cepl - 0-0.13.20091211git +- Fix login to Bugzilla 4.4.* (patch by Laszlo Ersek, thank you) + +* Sat Jun 07 2014 Fedora Release Engineering - 0-0.12.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 0-0.11.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Jul 17 2013 Petr Pisar - 0-0.10.20091211git +- Perl 5.18 rebuild + +* Wed May 15 2013 Matěj Cepl - 0-0.9.20091211git +- add Requires: perl(LWP::Protocol::https) (RHBZ# 960289) + +* Wed Feb 13 2013 Fedora Release Engineering - 0-0.8.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 0-0.7.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jan 13 2012 Fedora Release Engineering - 0-0.6.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 0-0.5.20091211git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jul 28 2010 Lubomir Rintel (GoodData) - 0-0.4.20091211git +- Attach git-am -able patches + +* Sun Feb 21 2010 Lubomir Rintel (GoodData) - 0-0.3.20091211git +- Require Crypt::SSLeay (Bruce Cowan, #559898) + +* Sat Dec 19 2009 Lubomir Rintel (GoodData) - 0-0.2.20091211git +- Add missing Require +- Do not default to GNOME bugzilla +- Fix a subtle warning +- Use upstream generated tarball + +* Fri Dec 11 2009 Lubomir Rintel (GoodData) - 0-0.1.20091211git +- Initial packaging