0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-11-23 13:46:16 +00:00
termux-packages/scripts/updates/termux_pkg_auto_update.sh
Fredrik Fornwall ada803a291 fix(main/libluajit): Fix mismatch between version and what is built
Background: luajit uses rolling releases - see
https://luajit.org/download.html

The recommended approach is to make frequent snapshots, which the termux
package is currently taking from the 2.1 branch.

The version scheme follows what arch linux is doing:
https://archlinux.org/packages/extra/x86_64/luajit/

That means that the version number "2.1.1716656478" refers to the "2.1"
branch, with "1716656478" being the timestamp of the commit built (as
displayed by `git show -s --format=%ct`).

The problem is that the termux package was hardcoded to build a specific
commit from 2021-03-10:
787736990a

We now instead look up the commit from the timestamp in the version string,
so that what is built is correct, and auto updates will start working as expected.
2024-06-02 10:17:18 +02:00

50 lines
1.2 KiB
Bash

# shellcheck shell=bash
termux_pkg_auto_update() {
if [[ -n "${__CACHED_TAG:-}" ]]; then
termux_pkg_upgrade_version ${__CACHED_TAG}
return $?
fi
local project_host
project_host="$(echo "${TERMUX_PKG_SRCURL}" | cut -d"/" -f3)"
if [[ -z "${TERMUX_PKG_UPDATE_METHOD}" ]]; then
if [[ "${project_host}" == "github.com" ]]; then
TERMUX_PKG_UPDATE_METHOD="github"
elif [[ "${project_host}" == "gitlab.com" ]]; then
TERMUX_PKG_UPDATE_METHOD="gitlab"
else
TERMUX_PKG_UPDATE_METHOD="repology"
fi
fi
local _err_msg="ERROR: source url's hostname is not ${TERMUX_PKG_UPDATE_METHOD}.com, but has been
configured to use ${TERMUX_PKG_UPDATE_METHOD}'s method."
case "${TERMUX_PKG_UPDATE_METHOD}" in
github)
if [[ "${project_host}" != "${TERMUX_PKG_UPDATE_METHOD}.com" ]]; then
termux_error_exit "${_err_msg}"
else
termux_github_auto_update
fi
;;
gitlab)
if [[ "${project_host}" != "${TERMUX_PKG_UPDATE_METHOD}.com" ]]; then
termux_error_exit "${_err_msg}"
else
termux_gitlab_auto_update
fi
;;
repology)
termux_repology_auto_update
;;
*)
termux_error_exit <<-EndOfError
ERROR: wrong value '${TERMUX_PKG_UPDATE_METHOD}' for TERMUX_PKG_UPDATE_METHOD.
Can be 'github', 'gitlab' or 'repology'
EndOfError
;;
esac
}