Merge pull request #9195 from heitbaum/tools13

update_binary-addons: add -x option to skip no tag updates
This commit is contained in:
Matthias Reichl 2024-08-17 12:56:20 +02:00 committed by GitHub
commit 58ae4a642d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,11 +6,13 @@
BUMP_PKG_REV="" BUMP_PKG_REV=""
KEEP_GIT_DIRS="yes" KEEP_GIT_DIRS="yes"
UPDATE_TO_HASH="yes"
usage() { usage() {
echo "Usage: $0 [options] <kodi-branch> [<unofficial-addon-branch>]" echo "Usage: $0 [options] <kodi-branch> [<unofficial-addon-branch>]"
echo " -b, --bump-pkg-rev: bump PKG_REV if package was not updated" echo " -b, --bump-pkg-rev: bump PKG_REV if package was not updated"
echo " -d, --delete-git-dirs: delete cloned git dirs after update" echo " -d, --delete-git-dirs: delete cloned git dirs after update"
echo " -x, --no-update-to-hash: do not update to hash if tag is not set"
echo " -h, --help: display help and exit" echo " -h, --help: display help and exit"
exit 1 exit 1
} }
@ -25,6 +27,10 @@ while [ $# -ne 0 ]; do
KEEP_GIT_DIRS="" KEEP_GIT_DIRS=""
shift shift
;; ;;
-x | --no-update-to-hash)
UPDATE_TO_HASH="no"
shift
;;
-h | --help) -h | --help)
usage usage
exit 1 exit 1
@ -135,17 +141,23 @@ for addontxt in ${ADDONS_REPO_LOCATION}/*-addons.txt; do
if [ -z "${NEW_VERSION}" ]; then if [ -z "${NEW_VERSION}" ]; then
NO_TAG="yes" NO_TAG="yes"
echo "========================================================================"
msg_warn "WARNING: no tag found for addon ${ADDON}, falling back to HEAD"
echo "========================================================================"
if [ -z "${GITHUB_API_TOKEN}" ]; then if [ -z "${GITHUB_API_TOKEN}" ]; then
PARAMS="resolve_hash_in_branch ${GIT_DIR} ${GIT_BRANCH}" PARAMS="resolve_hash_in_branch ${GIT_DIR} ${GIT_BRANCH}"
else else
PARAMS="resolve_hash_on_gh ${GIT_REPO} ${GIT_BRANCH}" PARAMS="resolve_hash_on_gh ${GIT_REPO} ${GIT_BRANCH}"
fi fi
echo "========================================================================"
if [ "${UPDATE_TO_HASH}" != "yes" ]; then
msg_warn "WARNING: no tag found for addon ${ADDON}, and UPDATE_TO_HASH=no so not updating"
NEW_VERSION=""
else
msg_warn "WARNING: no tag found for addon ${ADDON}, falling back to HEAD"
NEW_VERSION=$(${PARAMS}) NEW_VERSION=$(${PARAMS})
fi fi
echo "========================================================================"
fi
if [ ! -z "${NEW_VERSION}" ]; then
echo "Resolved version for ${ADDON}: ${GIT_BRANCH} => ${NEW_VERSION}" echo "Resolved version for ${ADDON}: ${GIT_BRANCH} => ${NEW_VERSION}"
if update_pkg "${ADDON_PATH}" ${ADDON} ${NEW_VERSION}; then if update_pkg "${ADDON_PATH}" ${ADDON} ${NEW_VERSION}; then
@ -162,6 +174,7 @@ for addontxt in ${ADDONS_REPO_LOCATION}/*-addons.txt; do
if [ "${KEEP_GIT_DIRS}" != "yes" ]; then if [ "${KEEP_GIT_DIRS}" != "yes" ]; then
[ -d "${GIT_DIR}" ] && rm -rf "${GIT_DIR}" [ -d "${GIT_DIR}" ] && rm -rf "${GIT_DIR}"
fi fi
fi
else else
echo "[mkpkg] Skipped $ADDON" echo "[mkpkg] Skipped $ADDON"
SKIPPED_ADDONS="$SKIPPED_ADDONS $ADDON" SKIPPED_ADDONS="$SKIPPED_ADDONS $ADDON"
@ -188,6 +201,9 @@ for ADDON in $(ls -1 "${ROOT}/packages/mediacenter/kodi-binary-addons"); do
check_package_excluded "${ADDON}" "${EXCLUDED_PACKAGES}" && continue check_package_excluded "${ADDON}" "${EXCLUDED_PACKAGES}" && continue
# always continue when UPDATE_TO_HASH=no as the below code does not work on tags
[ "${UPDATE_TO_HASH}" != "yes" ] && continue
ADDON_PATH="${ROOT}/packages/mediacenter/kodi-binary-addons/${ADDON}/" ADDON_PATH="${ROOT}/packages/mediacenter/kodi-binary-addons/${ADDON}/"
# Obtain git url - ignore if not a suitable repo # Obtain git url - ignore if not a suitable repo
GIT_DIR="${ADDON}.git" GIT_DIR="${ADDON}.git"