scripts(update-packages): add an option to opt-out updates

This commit is contained in:
Twaik Yont 2023-10-15 00:17:04 +03:00
parent c9eb56b80d
commit 00fea0a9de
2 changed files with 9 additions and 3 deletions

View File

@ -155,9 +155,13 @@ _should_update() {
termux_error_exit "ERROR: directory '${pkg_dir}' is not a package."
fi
if { [[ "${PACKAGES_OPT_OUT:-}" == "true" ]] && grep -q '^TERMUX_PKG_AUTO_UPDATE=false$' "${pkg_dir}/build.sh"; } || \
{ [[ "${PACKAGES_OPT_OUT:-}" != "true" ]] && ! grep -q '^TERMUX_PKG_AUTO_UPDATE=true$' "${pkg_dir}/build.sh"; }; then
return 1 # Skip.
fi
# shellcheck disable=SC2076
if ! grep -q '^TERMUX_PKG_AUTO_UPDATE=true$' "${pkg_dir}/build.sh" ||
[[ " ${_ALREADY_SEEN[*]} ${!_FAILED_UPDATES[*]} " =~ " $(basename "${pkg_dir}") " ]]; then
if [[ " ${_ALREADY_SEEN[*]} ${!_FAILED_UPDATES[*]} " =~ " $(basename "${pkg_dir}") " ]]; then
return 1 # Skip.
fi
if [[ "${GITHUB_ACTIONS:-}" == "true" ]] && _gh_check_issue_exists "$(basename "${pkg_dir}")"; then

View File

@ -16,7 +16,9 @@ termux_repology_api_get_latest_version() {
fi
if [[ ! -s "${TERMUX_REPOLOGY_DATA_FILE}" ]]; then
pip3 install bs4 requests >/dev/null # Install python dependencies.
# We should not install them in the case if python packages are externally managed.
find /usr/lib/python3.* -name EXTERNALLY-MANAGED -print -quit | grep -q . ||
pip3 install bs4 requests >/dev/null # Install python dependencies.
python3 "${TERMUX_SCRIPTDIR}"/scripts/updates/api/dump-repology-data \
"${TERMUX_REPOLOGY_DATA_FILE}" >/dev/null
fi