refactor(auto update): replace `pkg_dir` with `TERMUX_PKG_BUILDER_DIR`
- this variable will store path of directory containing packages `build.sh` file. - this is a more standard approach than specifying `pkg_dir` each time Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
parent
9035487413
commit
3baa1a3a36
|
@ -23,7 +23,7 @@ termux_pkg_auto_update() {
|
||||||
tag="$(termux_github_api_get_tag "${TERMUX_PKG_SRCURL}")"
|
tag="$(termux_github_api_get_tag "${TERMUX_PKG_SRCURL}")"
|
||||||
# check if this is not an intermediate release candidate:
|
# check if this is not an intermediate release candidate:
|
||||||
if grep -qP "^OTP-${TERMUX_PKG_UPDATE_VERSION_REGEXP}\$" <<<"$tag"; then
|
if grep -qP "^OTP-${TERMUX_PKG_UPDATE_VERSION_REGEXP}\$" <<<"$tag"; then
|
||||||
pkg_dir=$(dirname "$0") termux_pkg_upgrade_version "$tag"
|
termux_pkg_upgrade_version "$tag"
|
||||||
else
|
else
|
||||||
echo "WARNING: Skipping auto-update: Not stable release($tag)"
|
echo "WARNING: Skipping auto-update: Not stable release($tag)"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -16,7 +16,7 @@ termux_pkg_auto_update() {
|
||||||
tag="$(termux_github_api_get_tag "${TERMUX_PKG_SRCURL}")"
|
tag="$(termux_github_api_get_tag "${TERMUX_PKG_SRCURL}")"
|
||||||
# check if this is not a c release:
|
# check if this is not a c release:
|
||||||
if grep -qP "^cpp-${TERMUX_PKG_UPDATE_VERSION_REGEXP}\$" <<<"$tag"; then
|
if grep -qP "^cpp-${TERMUX_PKG_UPDATE_VERSION_REGEXP}\$" <<<"$tag"; then
|
||||||
pkg_dir=$(dirname "$0") termux_pkg_upgrade_version "$tag"
|
termux_pkg_upgrade_version "$tag"
|
||||||
else
|
else
|
||||||
echo "WARNING: Skipping auto-update: Not a cpp release($tag)"
|
echo "WARNING: Skipping auto-update: Not a cpp release($tag)"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -21,7 +21,7 @@ termux_pkg_auto_update() {
|
||||||
tag="$(termux_github_api_get_tag "${TERMUX_PKG_SRCURL}")"
|
tag="$(termux_github_api_get_tag "${TERMUX_PKG_SRCURL}")"
|
||||||
# check if this is not a c++ release:
|
# check if this is not a c++ release:
|
||||||
if grep -qP "^c-${TERMUX_PKG_UPDATE_VERSION_REGEXP}\$" <<<"$tag"; then
|
if grep -qP "^c-${TERMUX_PKG_UPDATE_VERSION_REGEXP}\$" <<<"$tag"; then
|
||||||
pkg_dir=$(dirname "$0") termux_pkg_upgrade_version "$tag"
|
termux_pkg_upgrade_version "$tag"
|
||||||
else
|
else
|
||||||
echo "WARNING: Skipping auto-update: Not a C release($tag)"
|
echo "WARNING: Skipping auto-update: Not a C release($tag)"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -63,7 +63,7 @@ termux_pkg_auto_update() {
|
||||||
|
|
||||||
# since we are using a nightly build, therefore no need to check for version increment/decrement.
|
# since we are using a nightly build, therefore no need to check for version increment/decrement.
|
||||||
if [ "${TERMUX_PKG_VERSION}" != "${remote_nvim_version}" ]; then
|
if [ "${TERMUX_PKG_VERSION}" != "${remote_nvim_version}" ]; then
|
||||||
pkg_dir=$(dirname "$0") termux_pkg_upgrade_version "${remote_nvim_version}" --skip-version-check
|
termux_pkg_upgrade_version "${remote_nvim_version}" --skip-version-check
|
||||||
else
|
else
|
||||||
echo "INFO: No update available."
|
echo "INFO: No update available."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -74,6 +74,8 @@ TERMUX_SCRIPTDIR="$(realpath "$(dirname "$0")/../..")" # Script directory.
|
||||||
_update() {
|
_update() {
|
||||||
export TERMUX_PKG_NAME
|
export TERMUX_PKG_NAME
|
||||||
TERMUX_PKG_NAME="$(basename "$1")"
|
TERMUX_PKG_NAME="$(basename "$1")"
|
||||||
|
export TERMUX_PKG_BUILDER_DIR
|
||||||
|
TERMUX_PKG_BUILDER_DIR="$(realpath "$1")" # Directory containing build.sh.
|
||||||
# Avoid:
|
# Avoid:
|
||||||
# - ending on errors such as $(which prog), where prog is not installed.
|
# - ending on errors such as $(which prog), where prog is not installed.
|
||||||
# - error on unbound variable.
|
# - error on unbound variable.
|
||||||
|
|
Loading…
Reference in New Issue