Bugzilla – Attachment 178116 Details for
Bug 39106
Improve the auto-rebase script to retrieve patches from bugzilla
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39106: Use LWP::UserAgent and add error checking
Bug-39106-Use-LWPUserAgent-and-add-error-checking.patch (text/plain), 3.57 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-02-14 17:53:31 UTC
(
hide
)
Description:
Bug 39106: Use LWP::UserAgent and add error checking
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-02-14 17:53:31 UTC
Size:
3.57 KB
patch
obsolete
>From 8315d677306b9ca2af0f5ca5cc255ecd3b8bcc66 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 14 Feb 2025 14:47:40 -0300 >Subject: [PATCH] Bug 39106: Use LWP::UserAgent and add error checking > >This patch replaces the (newly introduced use of) REST::Client library >with (the already existing in the dependencies) LWP::UserAgent. > >Bonus 1: validation on the response status is added to print a proper >error message and die if bugzilla is not available > >Bonus 2: License added to the file > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > cpanfile | 1 - > misc/devel/auto_rebase.pl | 37 ++++++++++++++++++++++++++++--------- > 2 files changed, 28 insertions(+), 10 deletions(-) > >diff --git a/cpanfile b/cpanfile >index 1614a392cd5..31f4d8bf1fd 100644 >--- a/cpanfile >+++ b/cpanfile >@@ -166,7 +166,6 @@ recommends 'Net::SFTP::Foreign', '1.73'; > recommends 'Net::Server', '0.97'; > recommends 'Net::Z3950::SimpleServer', '1.15'; > recommends 'PDF::FromHTML', '0.31'; >-recommends 'REST::Client', '281'; > recommends 'SMS::Send', '0.05'; > recommends 'Selenium::Remote::Driver', '1.27'; > recommends 'Starman', '0.4014'; >diff --git a/misc/devel/auto_rebase.pl b/misc/devel/auto_rebase.pl >index 80c92f5c9ee..e9707361173 100755 >--- a/misc/devel/auto_rebase.pl >+++ b/misc/devel/auto_rebase.pl >@@ -1,5 +1,22 @@ > #!/usr/bin/env perl >+ >+# 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 3 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, see <http://www.gnu.org/licenses>. >+ > use Modern::Perl; >+ > use Term::ANSIColor qw(:constants); > use Git::Wrapper; > use File::Slurp qw( write_file ); >@@ -7,10 +24,10 @@ use File::Temp qw( tempfile ); > use File::Basename qw(dirname); > use File::Path qw(make_path); > use List::Util qw( first ); >+use LWP::UserAgent (); > use Getopt::Long; > use Pod::Usage; > use Try::Tiny; >-use REST::Client; > use JSON qw( decode_json ); > $Term::ANSIColor::AUTOLOCAL = 1; > >@@ -85,17 +102,19 @@ switch_branch($tmp_src_branch); > > if ($bug_number) { > say BLUE sprintf "Guessing a date to use from bugzilla's bug %s", $bug_number; >- my $client = REST::Client->new( >- { >- host => 'https://bugs.koha-community.org/bugzilla3/rest', >- } >- ); >+ my $client = LWP::UserAgent->new(); >+ my $response = $client->get( 'https://bugs.koha-community.org/bugzilla3/rest' >+ . "/bug/$bug_number/attachment?include_fields=is_patch,is_obsolete,creation_time,summary" ); >+ >+ if ( !$response->is_success ) { >+ say RED sprintf "Request to Bugzilla returned an error: %s", $response->status_line; >+ exit 2; >+ } > >- $client->GET("/bug/$bug_number/attachment?include_fields=is_patch,is_obsolete,creation_time,summary"); >- my $response = decode_json( $client->responseContent ); >+ my $bz_response = decode_json( $response->decoded_content ); > > my $time; >- foreach my $attachment ( @{ $response->{bugs}->{$bug_number} } ) { >+ foreach my $attachment ( @{ $bz_response->{bugs}->{$bug_number} } ) { > next if ( $attachment->{is_obsolete} ); > next if ( !$attachment->{is_patch} ); > >-- >2.48.1
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 39106
:
177829
|
177830
|
178104
|
178105
|
178114
|
178115
| 178116