diff --git a/scripts/build/termux_get_repo_files.sh b/scripts/build/termux_get_repo_files.sh index f9f4028da..8f79d5976 100644 --- a/scripts/build/termux_get_repo_files.sh +++ b/scripts/build/termux_get_repo_files.sh @@ -17,24 +17,12 @@ termux_get_repo_files() { rm -f /data/data/.built-packages/* fi - # Import signing keys from files - gpg --import ${TERMUX_REPO_SIGNING_KEYS} - 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') - 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" + local RELEASE_FILE=${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-Release - if [ -f ${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-InRelease ]; then - local RELEASE_FILE=${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-InRelease - gpg --verify $RELEASE_FILE - else - local RELEASE_FILE=${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-Release - gpg --verify ${RELEASE_FILE}.gpg $RELEASE_FILE - fi + termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release" \ + "$RELEASE_FILE" SKIP_CHECKSUM for arch in all $TERMUX_ARCH; do local PACKAGES_HASH=$(./scripts/get_hash_from_file.py ${RELEASE_FILE} $arch ${TERMUX_REPO_COMPONENT[$idx-1]}) diff --git a/scripts/build/termux_step_setup_variables.sh b/scripts/build/termux_step_setup_variables.sh index f666926ba..92dbc790c 100644 --- a/scripts/build/termux_step_setup_variables.sh +++ b/scripts/build/termux_step_setup_variables.sh @@ -13,22 +13,35 @@ termux_step_setup_variables() { : "${TERMUX_DEBDIR:="${TERMUX_SCRIPTDIR}/debs"}" : "${TERMUX_SKIP_DEPCHECK:="false"}" : "${TERMUX_INSTALL_DEPS:="false"}" - : "${TERMUX_REPO_SIGNING_KEYS:="packages/apt/trusted.gpg packages/termux-keyring/grimler.gpg packages/termux-keyring/xeffyr.gpg"}" : "${TERMUX_PKG_MAINTAINER:="Fredrik Fornwall @fornwall"}" : "${TERMUX_PACKAGES_DIRECTORIES:="packages"}" - if [ -z ${TERMUX_REPO_URL+x} ]; then - TERMUX_REPO_URL=(https://termux.net) - # TERMUX_REPO_URL=(https://termux.net https://grimler.se https://dl.bintray.com/xeffyr/unstable-packages) - fi - if [ -z ${TERMUX_REPO_DISTRIBUTION+x} ]; then - TERMUX_REPO_DISTRIBUTION=(stable) - # TERMUX_REPO_DISTRIBUTION=(stable root unstable) - fi - if [ -z ${TERMUX_REPO_COMPONENT+x} ]; then - TERMUX_REPO_COMPONENT=(main) - # TERMUX_REPO_COMPONENT=(main stable main) - fi + TERMUX_REPO_URL=( + https://termux.net + https://dl.bintray.com/grimler/game-packages-21 + https://dl.bintray.com/grimler/science-packages-21 + https://dl.bintray.com/grimler/termux-root-packages-21 + https://dl.bintray.com/xeffyr/unstable-packages-21 + https://dl.bintray.com/xeffyr/x11-packages-21 + ) + + TERMUX_REPO_DISTRIBUTION=( + stable + games + science + root + unstable + x11 + ) + + TERMUX_REPO_COMPONENT=( + main + stable + stable + stable + main + main + ) if [ "x86_64" = "$TERMUX_ARCH" ] || [ "aarch64" = "$TERMUX_ARCH" ]; then TERMUX_ARCH_BITS=64 diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 1b950ae07..b162f7468 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -12,6 +12,32 @@ termux_step_start_build() { exit 0 fi + TERMUX_PKG_FULLVERSION=$TERMUX_PKG_VERSION + if [ "$TERMUX_PKG_REVISION" != "0" ] || [ "$TERMUX_PKG_FULLVERSION" != "${TERMUX_PKG_FULLVERSION/-/}" ]; then + # "0" is the default revision, so only include it if the upstream versions contains "-" itself + TERMUX_PKG_FULLVERSION+="-$TERMUX_PKG_REVISION" + fi + + if [ "$TERMUX_DEBUG" = true ]; then + if [ "$TERMUX_PKG_HAS_DEBUG" == "yes" ]; then + DEBUG="-dbg" + else + echo "Skipping building debug build for $TERMUX_PKG_NAME" + exit 0 + fi + else + DEBUG="" + fi + + if [ -z "$TERMUX_DEBUG" ] && + [ -z "${TERMUX_FORCE_BUILD+x}" ] && + [ -e "/data/data/.built-packages/$TERMUX_PKG_NAME" ]; then + if [ "$(cat "/data/data/.built-packages/$TERMUX_PKG_NAME")" = "$TERMUX_PKG_FULLVERSION" ]; then + echo "$TERMUX_PKG_NAME@$TERMUX_PKG_FULLVERSION built - skipping (rm /data/data/.built-packages/$TERMUX_PKG_NAME to force rebuild)" + exit 0 + fi + fi + if [ "$TERMUX_SKIP_DEPCHECK" = false ] && [ "$TERMUX_INSTALL_DEPS" = true ]; then # Download repo files termux_get_repo_files @@ -29,6 +55,13 @@ termux_step_start_build() { if [ ! "$TERMUX_QUIET_BUILD" = true ]; then echo "Downloading dependency $PKG@$DEP_VERSION if necessary..." fi + + if [ -e "/data/data/.built-packages/$PKG" ]; then + if [ "$(cat "/data/data/.built-packages/$PKG")" = "$DEP_VERSION" ]; then + continue + fi + fi + if ! termux_download_deb $PKG $DEP_ARCH $DEP_VERSION; then echo "Download of $PKG@$DEP_VERSION from $TERMUX_REPO_URL failed, building instead" TERMUX_BUILD_IGNORE_LOCK=true ./build-package.sh -a $TERMUX_ARCH -I "${PKG_DIR}" @@ -59,32 +92,6 @@ termux_step_start_build() { done<<<$(./scripts/buildorder.py "$TERMUX_PKG_BUILDER_DIR" $TERMUX_PACKAGES_DIRECTORIES || echo "ERROR") fi - TERMUX_PKG_FULLVERSION=$TERMUX_PKG_VERSION - if [ "$TERMUX_PKG_REVISION" != "0" ] || [ "$TERMUX_PKG_FULLVERSION" != "${TERMUX_PKG_FULLVERSION/-/}" ]; then - # "0" is the default revision, so only include it if the upstream versions contains "-" itself - TERMUX_PKG_FULLVERSION+="-$TERMUX_PKG_REVISION" - fi - - if [ "$TERMUX_DEBUG" = true ]; then - if [ "$TERMUX_PKG_HAS_DEBUG" == "yes" ]; then - DEBUG="-dbg" - else - echo "Skipping building debug build for $TERMUX_PKG_NAME" - exit 0 - fi - else - DEBUG="" - fi - - if [ -z "$TERMUX_DEBUG" ] && - [ -z "${TERMUX_FORCE_BUILD+x}" ] && - [ -e "/data/data/.built-packages/$TERMUX_PKG_NAME" ]; then - if [ "$(cat "/data/data/.built-packages/$TERMUX_PKG_NAME")" = "$TERMUX_PKG_FULLVERSION" ]; then - echo "$TERMUX_PKG_NAME@$TERMUX_PKG_FULLVERSION built - skipping (rm /data/data/.built-packages/$TERMUX_PKG_NAME to force rebuild)" - exit 0 - fi - fi - # Cleanup old state: rm -Rf "$TERMUX_PKG_BUILDDIR" \ "$TERMUX_PKG_PACKAGEDIR" \