scripts: use git+[...] instead of [...].git for git urls
Not all source code hosters support the .git suffix (for example sourcehut). Use a git+ prefix instead to indicate that a url is a git repo.
This commit is contained in:
parent
c0f0f90409
commit
20bd0f0dc0
|
@ -121,14 +121,14 @@ check() {
|
|||
local url="$2"
|
||||
local return_code=0
|
||||
|
||||
if [[ ! $src_url =~ ^https?://${from_where}.com ]]; then
|
||||
warn "Not a ${from_where} url: ${src_url}"
|
||||
if [[ ! ${src_url#git+} =~ ^https?://${from_where}.com ]]; then
|
||||
warn "Not a ${from_where} url: ${src_url#git+}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
_check "$from_where" "$url" || return_code="$?"
|
||||
|
||||
if [[ "${url: -4}" != ".git" ]] && [[ "$return_code" == "2" ]]; then
|
||||
if [[ "${url:0:4}" != "git+" ]] && [[ "$return_code" == "2" ]]; then
|
||||
warn "No 'latest-release-tag' found. Checking for 'newest-tag'..."
|
||||
return_code=3 # Set return code to 3 to indicate that TERMUX_PKG_UPDATE_TAG_TYPE='newest-tag'
|
||||
# should also be written to build.sh if we find 'newest-tag' in next line.
|
||||
|
|
|
@ -10,7 +10,7 @@ termux_git_clone_src() {
|
|||
rm -rf $TMP_CHECKOUT
|
||||
git clone --depth 1 \
|
||||
--branch $TERMUX_PKG_GIT_BRANCH \
|
||||
$TERMUX_PKG_SRCURL \
|
||||
${TERMUX_PKG_SRCURL:4} \
|
||||
$TMP_CHECKOUT
|
||||
|
||||
pushd $TMP_CHECKOUT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
termux_step_get_source() {
|
||||
: "${TERMUX_PKG_SRCURL:=""}"
|
||||
|
||||
if [ "${TERMUX_PKG_SRCURL: -4}" == ".git" ]; then
|
||||
if [ "${TERMUX_PKG_SRCURL:0:4}" == "git+" ]; then
|
||||
termux_git_clone_src
|
||||
else
|
||||
if [ -z "${TERMUX_PKG_SRCURL}" ] || [ "${TERMUX_PKG_SKIP_SRC_EXTRACT-false}" = "true" ] || [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
|
||||
|
|
|
@ -206,7 +206,7 @@ lint_package() {
|
|||
urls_ok=true
|
||||
for url in "${TERMUX_PKG_SRCURL[@]}"; do
|
||||
if [ -n "$url" ]; then
|
||||
if ! grep -qP '^https://.+' <<< "$url"; then
|
||||
if ! grep -qP '^git\+https://.+' <<< "$url" && ! grep -qP '^https://.+' <<< "$url"; then
|
||||
echo "NON-HTTPS (acceptable)"
|
||||
urls_ok=false
|
||||
break
|
||||
|
@ -248,7 +248,7 @@ lint_package() {
|
|||
echo "LENGTHS OF 'TERMUX_PKG_SRCURL' AND 'TERMUX_PKG_SHA256' ARE NOT EQUAL"
|
||||
pkg_lint_error=true
|
||||
fi
|
||||
elif [ "${TERMUX_PKG_SRCURL: -4}" == ".git" ]; then
|
||||
elif [ "${TERMUX_PKG_SRCURL:0:4}" == "git+" ]; then
|
||||
echo "NOT SET (acceptable since TERMUX_PKG_SRCURL is git repo)"
|
||||
else
|
||||
echo "NOT SET"
|
||||
|
|
|
@ -17,10 +17,10 @@ termux_github_api_get_tag() {
|
|||
|
||||
local project
|
||||
project="$(echo "${PKG_SRCURL}" | cut -d'/' -f4-5)"
|
||||
project="${project%.git}"
|
||||
project="${project#git+}"
|
||||
|
||||
if [[ -z "${TAG_TYPE}" ]]; then # If not set, then decide on the basis of url.
|
||||
if [[ "${PKG_SRCURL: -4}" == ".git" ]]; then
|
||||
if [[ "${PKG_SRCURL:0:4}" == "git+" ]]; then
|
||||
# Get newest tag.
|
||||
TAG_TYPE="newest-tag"
|
||||
else
|
||||
|
|
|
@ -13,10 +13,10 @@ termux_gitlab_api_get_tag() {
|
|||
|
||||
local project
|
||||
project="$(echo "${PKG_SRCURL}" | cut -d'/' -f4-5)"
|
||||
project="${project%.git}"
|
||||
project="${project#git+}"
|
||||
|
||||
if [[ -z "${TAG_TYPE}" ]]; then # If not set, then decide on the basis of url.
|
||||
if [[ "${PKG_SRCURL: -4}" == ".git" ]]; then
|
||||
if [[ "${PKG_SRCURL:0:4}" == "git+" ]]; then
|
||||
# Get newest tag.
|
||||
TAG_TYPE="newest-tag"
|
||||
else
|
||||
|
|
|
@ -54,7 +54,7 @@ termux_pkg_upgrade_version() {
|
|||
"${TERMUX_PKG_BUILDER_DIR}/build.sh"
|
||||
|
||||
# Update checksum
|
||||
if [[ "${TERMUX_PKG_SHA256[*]}" != "SKIP_CHECKSUM" ]] && [[ "${TERMUX_PKG_SRCURL: -4}" != ".git" ]]; then
|
||||
if [[ "${TERMUX_PKG_SHA256[*]}" != "SKIP_CHECKSUM" ]] && [[ "${TERMUX_PKG_SRCURL:0:4}" != "git+" ]]; then
|
||||
echo n | "${TERMUX_SCRIPTDIR}/scripts/bin/update-checksum" "${TERMUX_PKG_NAME}" || {
|
||||
git checkout -- "${TERMUX_PKG_BUILDER_DIR}"
|
||||
git pull --rebase
|
||||
|
|
Loading…
Reference in New Issue