Bug 39106 - Improve the auto-rebase script to retrieve patches from bugzilla
Summary: Improve the auto-rebase script to retrieve patches from bugzilla
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on: 38664
Blocks:
  Show dependency treegraph
 
Reported: 2025-02-12 10:01 UTC by Jonathan Druart
Modified: 2025-02-17 12:10 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39106: The auto-rebase script - Add --bugzilla (7.41 KB, patch)
2025-02-12 10:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39106: Add REST::Client to cpanfile (725 bytes, patch)
2025-02-12 10:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39106: The auto-rebase script - Add --bugzilla (7.47 KB, patch)
2025-02-14 16:28 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39106: Add REST::Client to cpanfile (781 bytes, patch)
2025-02-14 16:28 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39106: The auto-rebase script - Add --bugzilla (7.52 KB, patch)
2025-02-14 17:53 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 39106: Add REST::Client to cpanfile (836 bytes, patch)
2025-02-14 17:53 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 39106: Use LWP::UserAgent and add error checking (3.57 KB, patch)
2025-02-14 17:53 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-02-12 10:01:12 UTC
Julian wrote a script a while ago to retrieve patches from bugzilla and checkout the good commit to make sure the patches will apply cleanly.

We could reuse the same logic for the auto-rebase script.
Comment 1 Jonathan Druart 2025-02-12 10:09:52 UTC
Created attachment 177829 [details] [review]
Bug 39106: The auto-rebase script - Add --bugzilla

Julian wrote a script a while ago to retrieve patches from bugzilla
and checkout the good commit to make sure the patches will apply cleanly.

This change reuses the same logic for the auto-rebase script.

Test plan:
0.
 a. You will need to install REST::Client using cpanm:
  `cpanm REST::Client`
 b. You need the --confirm flag from git-bz, see https://gitlab.com/koha-community/git-bz/-/issues/14
1. Pick a bug number with patches that does not apply on current main
2. Use the auto_rebase script with the --bugzilla option
3. Enjoy
Comment 2 Jonathan Druart 2025-02-12 10:09:54 UTC
Created attachment 177830 [details] [review]
Bug 39106: Add REST::Client to cpanfile
Comment 3 Tomás Cohen Arazi (tcohen) 2025-02-13 15:42:02 UTC
Not 100% a blocker, but cannot you use:

* LWP::UserAgent
* Mojo::UserAgent

both are already dependencies (LWP.. explicitly, the Mojo one as part of Mojolicious).
Comment 4 Jonathan Druart 2025-02-13 15:58:37 UTC
Yes, we could avoid the new dependency, I just reused some existing code.
Comment 5 Nick Clemens (kidclamp) 2025-02-14 16:28:42 UTC
Created attachment 178104 [details] [review]
Bug 39106: The auto-rebase script - Add --bugzilla

Julian wrote a script a while ago to retrieve patches from bugzilla
and checkout the good commit to make sure the patches will apply cleanly.

This change reuses the same logic for the auto-rebase script.

Test plan:
0.
 a. You will need to install REST::Client using cpanm:
  `cpanm REST::Client`
 b. You need the --confirm flag from git-bz, see https://gitlab.com/koha-community/git-bz/-/issues/14
1. Pick a bug number with patches that does not apply on current main
2. Use the auto_rebase script with the --bugzilla option
3. Enjoy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Nick Clemens (kidclamp) 2025-02-14 16:28:44 UTC
Created attachment 178105 [details] [review]
Bug 39106: Add REST::Client to cpanfile

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Tomás Cohen Arazi (tcohen) 2025-02-14 17:48:16 UTC
(In reply to Jonathan Druart from comment #4)
> Yes, we could avoid the new dependency, I just reused some existing code.

Lazy :-P
Comment 8 Tomás Cohen Arazi (tcohen) 2025-02-14 17:53:26 UTC
Created attachment 178114 [details] [review]
Bug 39106: The auto-rebase script - Add --bugzilla

Julian wrote a script a while ago to retrieve patches from bugzilla
and checkout the good commit to make sure the patches will apply cleanly.

This change reuses the same logic for the auto-rebase script.

Test plan:
0.
 a. You will need to install REST::Client using cpanm:
  `cpanm REST::Client`
 b. You need the --confirm flag from git-bz, see https://gitlab.com/koha-community/git-bz/-/issues/14
1. Pick a bug number with patches that does not apply on current main
2. Use the auto_rebase script with the --bugzilla option
3. Enjoy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Tomás Cohen Arazi (tcohen) 2025-02-14 17:53:28 UTC
Created attachment 178115 [details] [review]
Bug 39106: Add REST::Client to cpanfile

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Tomás Cohen Arazi (tcohen) 2025-02-14 17:53:31 UTC
Created attachment 178116 [details] [review]
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>
Comment 11 Tomás Cohen Arazi (tcohen) 2025-02-14 17:57:08 UTC
Removing the dependency keyword. I'd vote for squashing the first two patches on merging into `main`.
Comment 12 Jonathan Druart 2025-02-14 22:02:29 UTC
Thanks!
Comment 13 Katrin Fischer 2025-02-17 12:10:57 UTC
Pushed for 25.05!

Well done everyone, thank you!