Merge pull request #7989 from heitbaum/tools

Support Tools Updates
This commit is contained in:
CvH 2023-07-21 20:42:13 +02:00 committed by GitHub
commit f0a8443034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 34 deletions

View File

@ -610,7 +610,7 @@ def main():
for i in range(threadcount):
t = MyThread(input_queue, output_queue)
threads.append(t)
t.setDaemon(False)
t.daemon = False
# Start the threads...
for t in threads: t.start()

View File

@ -52,50 +52,59 @@ check_for_update() {
eval PKG_URL="$(grep -oP -m 1 '(?<=PKG_URL=\").*(?=\")' ${1} || true)"
# check if version and url are empty or self hosted by us and ignore those packages
if [ -z "${PKG_VERSION}" ] || [ -z "${PKG_URL}" ] || [[ "${PKG_URL}" == "$DISTRO_SRC"* ]]; then
if [ -z "${PKG_VERSION}" ] || [[ ${PKG_VERSION} == '$(get_pkg_version '* ]] || [ -z "${PKG_URL}" ] || [[ "${PKG_URL}" == "$DISTRO_SRC"* ]]; then
PACKAGES_IGNORED+="${PKG_NAME} "
return
fi
# check if package exists at tracker
RMO_API_RESPONSE=$(curl -sL "https://release-monitoring.org/api/project/LibreELEC/${PKG_NAME}" || true)
upstream_version=$(echo "${RMO_API_RESPONSE}" | jq -r '.version')
upstream_version=$(echo "${RMO_API_RESPONSE}" | jq -r '.version' || true)
# look for alternative versions if necessary
if [ "${upstream_version}" = "null" ]; then
if [[ $(echo "${RMO_API_RESPONSE}" | jq -r '.error') =~ "No package" ]]; then
# pkg is on github, uses githash for version, and github api available
if [[ ${PKG_URL} =~ ^.*(github\.com).*$ ]] && \
[[ ${PKG_VERSION} =~ ^[a-z0-9]{40} ]] && \
[[ "${github_api}" = "yes" ]]; then
# special handling based on release-monitoring formatting
case ${PKG_NAME} in
icu)
upstream_version=${upstream_version/-/.}
;;
lm_sensors)
upstream_version=${upstream_version//-/.}
;;
esac
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')"
upstream_latest_commit=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/master" | jq -r '.object.url')
upstream_latest_commit_date=$(curl -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")
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_date=$(curl -sL "${github_api_token}" "${upstream_latest_tag_url}" | jq -r '.commit.committer.date')
# if pkg_version is a githash on github and github api available - always check against latest
if [[ ${PKG_VERSION} =~ ^[a-z0-9]{40} ]] &&
[[ ${PKG_URL} =~ ^.*(github\.com).*$ ]] &&
[[ "${github_api}" = "yes" ]]; then
# compare upstream with local version
if [ "${PKG_VERSION}" != "${upstream_latest_commit##*/}" ]; then
# get upstream tag informations
if [ "${upstream_latest_tag}" != "null" ]; then
tag=" | TAG: ${upstream_latest_tag} (${upstream_latest_tag_date%T*})"
else
tag=" | TAG: no tags"
fi
upstream_version="Master: ${upstream_latest_commit_date%T*}${tag}"
PKG_VERSION="${le_master_version_date%T*}"
else
upstream_version="${upstream_latest_commit##*/}"
fi
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')"
upstream_default_branch=$(curl -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_date=$(curl -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")
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_date=$(curl -sL "${github_api_token}" "${upstream_latest_tag_url}" | jq -r '.commit.committer.date')
# compare upstream with local version
if [ "${PKG_VERSION}" != "${upstream_latest_commit##*/}" ]; then
# get upstream tag informations
if [ "${upstream_latest_tag}" != "null" ]; then
tag=" | TAG: ${upstream_latest_tag} (${upstream_latest_tag_date%T*})"
else
# package is not on tracker or github
PACKAGES_NOT_REGISTERED+="${PKG_NAME} "
return
tag=" | TAG: no tags"
fi
[[ "${upstream_version}" = "null" ]] && upstream_version="" || upstream_version+=" | "
upstream_version="${upstream_version}GitHead: ${upstream_latest_commit_date%T*}${tag}"
PKG_VERSION="${le_master_version_date%T*} | ${PKG_VERSION:0:7}"
else
upstream_version="${upstream_latest_commit##*/}"
fi
elif [ "${upstream_version}" = "null" ]; then
if [[ $(echo "${RMO_API_RESPONSE}" | jq -r '.error') =~ "No package" ]]; then
# package is not on tracker or github
PACKAGES_NOT_REGISTERED+="${PKG_NAME} "
return
else
# package exist at tracker but has no version
upstream_version="! broken at release tracker !"