Refactor gitlab auto update method
- closes #27566
- supersedes(?) #27365
Right, I need to just put this up for the time being.
The refactoring in scripts/ needs to be broken out into separate commits.
I'm way too tired to do that today...
Everything[^1] is working as expected.
It took @MrAdityaAlok's changes to the GitHub auto-update method from #27365 and applied them to this branch as the base for my changes to the Gitlab one. Those changes have been touched pretty minimally and might need another look.
[^1]: Except wordgrinder, oma, hangover-wine, iverilog, openssh, mdbook-katex. But I think those already had issues previously.
I didn't review my own code. Maybe something I missed. Give me some time to review it. Or, did you review it?
I'll take a look at the version currently on this PR branch in a bit.
This is what merge commit induced insanity looks like...
- On the bright side, I think we finally have a solution for the issue from #27168 Which I inadvertently caused to happen on this branch for a reason I am not entirely sure on.
I think hangover-wine will need to get split out into a separate PR.
termux_github_api_get_tag and termux_gitlab_api_get_tag are now as similar to one another as reasonably possible.
One interesting package that manages to get rid of its auto-update function is artalk.
https://github.com/termux/termux-packages/blob/ad5a3419813b722cb336b844a033cbf728602bc9/packages/artalk/build.sh#L16-L53
The existing one is "badly behaved" in that it ignores BUILD_PACKAGES != true.
It always tries to modify the build script.
But everything it does is now supported out of the box, including the SRCURL array.
There's a couple other packages that don't respect BUILD_PACKAGES != true.
browsh for example.
https://github.com/termux/termux-packages/blob/ad5a3419813b722cb336b844a033cbf728602bc9/x11-packages/browsh/build.sh#L17-L45
That hunch about cmake and rust was correct on both counts.
https://github.com/termux/termux-packages/blob/dc5784b7083ab0b2a53b38a071c4efd33a052176/packages/cmake/build.sh#L45-L56
https://github.com/termux/termux-packages/blob/dc5784b7083ab0b2a53b38a071c4efd33a052176/packages/rust/build.sh#L57-L71
I'll just insert a;
if [[ "${BUILD_PACKAGES}" == "false" ]]; then
echo "INFO: package needs to be updated to ${latest_version}."
return
fi
before the sed in both cases and we can think about a generalized solution at a later point.
Although the generalized solution might just have to be.
"If you're modifying files in an auto-update function, make sure it only does so after checking ${BUILD_PACKAGES}."
Edit: Found more examples https://github.com/termux/termux-packages/blob/dc5784b7083ab0b2a53b38a071c4efd33a052176/packages/texinfo/build.sh#L65-L83 https://github.com/termux/termux-packages/blob/dc5784b7083ab0b2a53b38a071c4efd33a052176/packages/emscripten/build.sh#L141-L157 https://github.com/termux/termux-packages/blob/dc5784b7083ab0b2a53b38a071c4efd33a052176/packages/tree-sitter/build.sh#L40-L52 https://github.com/termux/termux-packages/blob/dc5784b7083ab0b2a53b38a071c4efd33a052176/packages/v2ray/build.sh#L24-L42 https://github.com/termux/termux-packages/blob/d7530d9fd4aa127bda35b4485ac0362c7739febd/packages/tinygo/build.sh#L77-L94 https://github.com/termux/termux-packages/blob/d7530d9fd4aa127bda35b4485ac0362c7739febd/packages/clvk/build.sh#L81-L88
Not this issue, but probably trivial enough to drop for a TERMUX_PKG_UPDATE_VERSION_REGEXP or TERMUX_PKG_UPDATE_VERSION_SED_REGEXP.
https://github.com/termux/termux-packages/blob/d7530d9fd4aa127bda35b4485ac0362c7739febd/packages/libvigra/build.sh#L18-L22
OpenJDK's function also falls into this category.
https://github.com/termux/termux-packages/blob/d7530d9fd4aa127bda35b4485ac0362c7739febd/packages/openjdk-21/build.sh#L21-L51
I've added some additional reporting to scripts/bin/update-packages.
I'm not entirely happy with the way I came up with for extracting the fully parsed $LATEST_VERSION from termux_pkg_upgrade_version().
But I couldn't come up with a less janky solution to get that internal variable out.
Alright, that's all the feedback addressed and I'm reasonably satisfied with my own testing.
I'd like to force the @all path in the dry-run on the CI for one last test, I'm getting some slightly flakey results for that locally, and I wanna make sure that it's just me hitting my personal ratelimit.
Okay those failures are real. https://github.com/termux/termux-packages/actions/runs/20287378850/job/58264138514?pr=27576#step:4:2244
I'm guessing this has to be GraphQL related then.