Merge pull request #8211 from heitbaum/update-scan

Update update-scan
This commit is contained in:
Christian Hewitt 2023-10-30 18:04:22 +04:00 committed by GitHub
commit 9fb197203d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 40 deletions

View File

@ -2,11 +2,11 @@
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="icu" PKG_NAME="icu"
PKG_VERSION="73.2" PKG_VERSION="73-2"
PKG_SHA256="c15f704e83c221c0680640a995d9db641f5b82098fb4b258a94b7d0561493c88" PKG_SHA256="c15f704e83c221c0680640a995d9db641f5b82098fb4b258a94b7d0561493c88"
PKG_LICENSE="Custom" PKG_LICENSE="Custom"
PKG_SITE="https://icu.unicode.org" PKG_SITE="https://icu.unicode.org"
PKG_URL="https://github.com/unicode-org/icu/archive/release-${PKG_VERSION//./-}.tar.gz" PKG_URL="https://github.com/unicode-org/icu/archive/release-${PKG_VERSION}.tar.gz"
PKG_DEPENDS_HOST="toolchain:host" PKG_DEPENDS_HOST="toolchain:host"
PKG_DEPENDS_TARGET="toolchain icu:host" PKG_DEPENDS_TARGET="toolchain icu:host"
PKG_LONGDESC="International Components for Unicode library." PKG_LONGDESC="International Components for Unicode library."

View File

@ -23,7 +23,7 @@ test_github_api() {
if [[ -n "${github_token}" || -n "${github_user}" ]]; then if [[ -n "${github_token}" || -n "${github_user}" ]]; then
github_api_token="-u ${github_user}:${github_token}" github_api_token="-u ${github_user}:${github_token}"
# check if token works # check if token works
if curl -sL -I "${github_api_token}" https://api.github.com/user | grep -q -e "^[Ss]tatus: 200" -e "^HTTP/2 200"; then if curl -m 5 -sL -I "${github_api_token}" https://api.github.com/user | grep -q -e "^[Ss]tatus: 200" -e "^HTTP/2 200"; then
echo "Github api usage activated" echo "Github api usage activated"
github_api="yes" github_api="yes"
else else
@ -57,19 +57,31 @@ check_for_update() {
return return
fi fi
# check if package exists at tracker upstream_version=""
RMO_API_RESPONSE=$(curl -sL "https://release-monitoring.org/api/project/LibreELEC/${PKG_NAME}" || true)
upstream_version=$(echo "${RMO_API_RESPONSE}" | jq -r '.version' || true)
# special handling based on release-monitoring formatting if [[ "${github_api}" = "yes" ]]; then
case ${PKG_NAME} in case ${PKG_NAME} in
icu) aspnet6-runtime)
upstream_version=${upstream_version/-/.} upstream_version="$(curl -m 5 -sL ${github_api_token} https://api.github.com/repos/dotnet/runtime/releases | jq -r '[.[] | select(.prerelease==false) | select(.tag_name | match("v6.0")) | .tag_name][0] | sub("v";"")')"
;; ;;
lm_sensors) aspnet8-runtime)
upstream_version=${upstream_version//-/.} upstream_version="$(curl -m 5 -sL ${github_api_token} https://api.github.com/repos/dotnet/runtime/releases | jq -r '[.[] | select(.tag_name | match("v8.0")) | .tag_name][0] | sub("v";"")')"
;; ;;
esac esac
fi
if [ -z "${upstream_version}" ]; then
# check if package exists at tracker
RMO_API_RESPONSE=$(curl -m 5 -sL "https://release-monitoring.org/api/project/LibreELEC/${PKG_NAME}" || true)
upstream_version=$(echo "${RMO_API_RESPONSE}" | jq -r '.version' || true)
# special handling based on release-monitoring formatting
case ${PKG_NAME} in
lm_sensors)
upstream_version=${upstream_version//-/.}
;;
esac
fi
# if pkg_version is a githash on github and github api available - always check against latest # if pkg_version is a githash on github and github api available - always check against latest
if [[ ${PKG_VERSION} =~ ^[a-z0-9]{40} ]] && if [[ ${PKG_VERSION} =~ ^[a-z0-9]{40} ]] &&
@ -77,14 +89,14 @@ check_for_update() {
[[ "${github_api}" = "yes" ]]; then [[ "${github_api}" = "yes" ]]; then
github_repos=$(echo "${PKG_URL}" | grep -oP '(?<=https:\/\/github.com\/)?[0-9A-Za-z._-]+\/[0-9A-Za-z._-]+(?=/archive|/tags|/releases)') github_repos=$(echo "${PKG_URL}" | grep -oP '(?<=https:\/\/github.com\/)?[0-9A-Za-z._-]+\/[0-9A-Za-z._-]+(?=/archive|/tags|/releases)')
le_master_version_date="Commit date: $(curl -sL ${github_api_token} https://api.github.com/repos/${github_repos}/git/commits/${PKG_VERSION} | jq -r '.committer.date')" le_master_version_date="Commit date: $(curl -m 5 -sL ${github_api_token} https://api.github.com/repos/${github_repos}/git/commits/${PKG_VERSION} | jq -r '.committer.date')"
upstream_default_branch=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}" | jq -r '.default_branch') upstream_default_branch=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}" | jq -r '.default_branch')
upstream_latest_commit=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/${upstream_default_branch}" | jq -r '.object.url') upstream_latest_commit=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/${upstream_default_branch}" | jq -r '.object.url')
upstream_latest_commit_date=$(curl -sL "${github_api_token}" "${upstream_latest_commit}" | jq -r '.committer.date') upstream_latest_commit_date=$(curl -m 5 -sL "${github_api_token}" "${upstream_latest_commit}" | jq -r '.committer.date')
GH_API_TAG=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/tags") GH_API_TAG=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/tags")
upstream_latest_tag=$(echo "${GH_API_TAG}" | jq -r '.[0].name') upstream_latest_tag=$(echo "${GH_API_TAG}" | jq -r '.[0].name')
upstream_latest_tag_url=$(echo "${GH_API_TAG}" | jq -r '.[0].commit.url') upstream_latest_tag_url=$(echo "${GH_API_TAG}" | jq -r '.[0].commit.url')
upstream_latest_tag_date=$(curl -sL "${github_api_token}" "${upstream_latest_tag_url}" | jq -r '.commit.committer.date') upstream_latest_tag_date=$(curl -m 5 -sL "${github_api_token}" "${upstream_latest_tag_url}" | jq -r '.commit.committer.date')
# compare upstream with local version # compare upstream with local version
if [ "${PKG_VERSION}" != "${upstream_latest_commit##*/}" ]; then if [ "${PKG_VERSION}" != "${upstream_latest_commit##*/}" ]; then
@ -112,7 +124,9 @@ check_for_update() {
fi fi
# print version output line # print version output line
if [ "${PKG_VERSION}" != "${upstream_version}" ]; then if [ ! -z "${API}" ]; then
printf "%s %s %s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}"; printf '\n'
elif [ "${PKG_VERSION}" != "${upstream_version}" ]; then
printf "%-35s | %-40s | %-20s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}"; printf '\n' printf "%-35s | %-40s | %-20s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}"; printf '\n'
else else
PACKAGES_CURRENT+="${PKG_NAME} " PACKAGES_CURRENT+="${PKG_NAME} "
@ -136,25 +150,31 @@ else
)" )"
fi fi
# test github api availability if [ -z "${API}" ]; then
test_github_api # test github api availability
test_github_api
# output # output
echo -e "\nUpdates found:\n" echo -e "\nUpdates found:\n"
printf "%-35s | %-40s | %-20s" "Package" "LE git master" "upstream location"; printf '\n' printf "%-35s | %-40s | %-20s" "Package" "LE git master" "upstream location"; printf '\n'
echo -e ''$_{1..140}'\b-' echo -e ''$_{1..140}'\b-'
for check_version in ${PACKAGE_LIST}; do for check_version in ${PACKAGE_LIST}; do
check_for_update "${check_version}" check_for_update "${check_version}"
done done
echo "" echo ""
if [ -n "${PACKAGES_CURRENT}" ]; then if [ -n "${PACKAGES_CURRENT}" ]; then
echo -e "\nCurrent $(echo ${PACKAGES_CURRENT} | wc -w):\n${PACKAGES_CURRENT}\n" echo -e "\nCurrent $(echo ${PACKAGES_CURRENT} | wc -w):\n${PACKAGES_CURRENT}\n"
fi fi
if [ -n "${PACKAGES_IGNORED}" ]; then if [ -n "${PACKAGES_IGNORED}" ]; then
echo -e "\nIgnored $(echo ${PACKAGES_IGNORED} | wc -w):\n${PACKAGES_IGNORED}" echo -e "\nIgnored $(echo ${PACKAGES_IGNORED} | wc -w):\n${PACKAGES_IGNORED}"
fi fi
if [ -n "${PACKAGES_NOT_REGISTERED}" ]; then if [ -n "${PACKAGES_NOT_REGISTERED}" ]; then
echo -e "\nPackages not known at tracker $(echo ${PACKAGES_NOT_REGISTERED} | wc -w):\n${PACKAGES_NOT_REGISTERED}\n" echo -e "\nPackages not known at tracker $(echo ${PACKAGES_NOT_REGISTERED} | wc -w):\n${PACKAGES_NOT_REGISTERED}\n"
fi
else
for check_version in ${PACKAGE_LIST}; do
check_for_update "${check_version}"
done
fi fi