diff --git a/build-package.sh b/build-package.sh index 89d519389..00433ccb3 100755 --- a/build-package.sh +++ b/build-package.sh @@ -131,7 +131,6 @@ source scripts/build/termux_step_finish_build.sh termux_step_handle_arguments "$@" termux_step_setup_variables termux_step_handle_buildarch -termux_step_get_repo_files termux_step_start_build termux_step_extract_package cd "$TERMUX_PKG_SRCDIR" diff --git a/scripts/build/termux_step_get_repo_files.sh b/scripts/build/termux_get_repo_files.sh similarity index 83% rename from scripts/build/termux_step_get_repo_files.sh rename to scripts/build/termux_get_repo_files.sh index 5ef75e082..3f7ed2006 100644 --- a/scripts/build/termux_step_get_repo_files.sh +++ b/scripts/build/termux_get_repo_files.sh @@ -1,4 +1,4 @@ -termux_step_get_repo_files() { +termux_get_repo_files() { # Ensure folders present (but not $TERMUX_PKG_SRCDIR, it will be created in build) mkdir -p "$TERMUX_COMMON_CACHEDIR" \ "$TERMUX_COMMON_CACHEDIR-$TERMUX_ARCH" \ @@ -42,12 +42,10 @@ termux_step_get_repo_files() { for idx in $(seq ${#TERMUX_REPO_URL[@]}); do local TERMUX_REPO_NAME=$(echo ${TERMUX_REPO_URL[$idx-1]} | sed -e 's%https://%%g' -e 's%http://%%g' -e 's%/%-%g') - curl --fail -L "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/InRelease" \ - -o ${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-InRelease \ - || curl --fail -L "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release.gpg" \ - -o ${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-Release.gpg \ - && curl --fail -L "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release" \ - -o ${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-Release \ + local FILE_PREFIX=${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]} + curl --fail -L "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/InRelease" -o ${FILE_PREFIX}-InRelease \ + || curl --fail -L "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release.gpg" -o ${FILE_PREFIX}-Release.gpg \ + && curl --fail -L "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release" -o ${FILE_PREFIX}-Release \ || termux_error_exit "Download of InRelease and Release.gpg from ${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]} failed" if [ -f ${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-InRelease ]; then @@ -59,12 +57,12 @@ termux_step_get_repo_files() { fi for arch in all $TERMUX_ARCH; do - local packages_hash=$(./scripts/get_hash_from_file.py ${RELEASE_FILE} $arch ${TERMUX_REPO_COMPONENT[$idx-1]}) + local PACKAGES_HASH=$(./scripts/get_hash_from_file.py ${RELEASE_FILE} $arch ${TERMUX_REPO_COMPONENT[$idx-1]}) # If packages_hash = "" then the repo probably doesn't contain debs for $arch - if ! [ "$packages_hash" = "" ]; then + if [ ! -z "$PACKAGES_HASH" ]; then termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/${TERMUX_REPO_COMPONENT[$idx-1]}/binary-$arch/Packages" \ "${TERMUX_COMMON_CACHEDIR}-$arch/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-${TERMUX_REPO_COMPONENT[$idx-1]}-Packages" \ - $packages_hash + $PACKAGES_HASH fi done done diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 526e94754..e9d94066b 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -13,6 +13,8 @@ termux_step_start_build() { fi if [ "$TERMUX_SKIP_DEPCHECK" = false ] && [ "$TERMUX_INSTALL_DEPS" = true ]; then + # Download repo files + termux_get_repo_files # Download dependencies while read PKG PKG_DIR; do if [ -z $PKG ]; then