From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1F0AD138334 for ; Wed, 20 Mar 2019 13:16:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 17A11E0101; Wed, 20 Mar 2019 13:16:17 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C939CE0101 for ; Wed, 20 Mar 2019 13:16:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C23FE335D06 for ; Wed, 20 Mar 2019 13:16:13 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 394714E3 for ; Wed, 20 Mar 2019 13:16:12 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1553087697.8c8b847bbe1297252667b2dbd4187c9b25a9ce92.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: scripts/bootstrap-prefix.sh X-VCS-Directories: scripts/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 8c8b847bbe1297252667b2dbd4187c9b25a9ce92 X-VCS-Branch: master Date: Wed, 20 Mar 2019 13:16:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 83f8d3b9-f068-4743-9296-feb8023d3007 X-Archives-Hash: 538a1135fba2e343a4e01d8feab5d73b commit: 8c8b847bbe1297252667b2dbd4187c9b25a9ce92 Author: Fabian Groffen gentoo org> AuthorDate: Wed Mar 20 13:14:57 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Wed Mar 20 13:14:57 2019 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=8c8b847b scripts/bootstrap-prefix: support multiple mirrors in GENTOO_MIRRORS This basically aligns behaviour with Portage. In addition to GENTOO_MIRRORS now also distfiles.gentoo.org is tried as last resort. Not sure if that's useful though. Signed-off-by: Fabian Groffen gentoo.org> scripts/bootstrap-prefix.sh | 48 ++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index fd110da16c..6f5b44f5d0 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -29,7 +29,7 @@ econf() { efetch() { if [[ ! -e ${DISTDIR}/${1##*/} ]] ; then if [[ ${OFFLINE_MODE} ]]; then - echo "I needed ${1##*/} from $1 or ${GENTOO_MIRRORS}/distfiles/${1##*/} in $DISTDIR" + echo "I need ${1##*/} from $1 in $DISTDIR, can you give it to me?" read [[ -e ${DISTDIR}/${1##*/} ]] && return 0 #Give fetch a try @@ -40,17 +40,19 @@ efetch() { # curl, FreeBSD's fetch and ftp. if [[ x$(type -t wget) == "xfile" ]] ; then FETCH_COMMAND="wget" - [[ $(wget -h) == *"--no-check-certificate"* ]] && FETCH_COMMAND+=" --no-check-certificate" + [[ $(wget -h) == *"--no-check-certificate"* ]] \ + && FETCH_COMMAND+=" --no-check-certificate" elif [[ x$(type -t curl) == "xfile" ]] ; then - einfo "WARNING: curl doesn't fail when downloading fails, please check its output carefully!" FETCH_COMMAND="curl -f -L -O" elif [[ x$(type -t fetch) == "xfile" ]] ; then FETCH_COMMAND="fetch" elif [[ x$(type -t ftp) == "xfile" ]] && - [[ ${CHOST} != *-cygwin* || ! $(type -P ftp) -ef $(cygpath -S)/ftp ]] ; then + [[ ${CHOST} != *-cygwin* || \ + ! $(type -P ftp) -ef $(cygpath -S)/ftp ]] ; then FETCH_COMMAND="ftp" else - eerror "no suitable download manager found (need wget, curl, fetch or ftp)" + eerror "no suitable download manager found!" + eerror "tried: wget, curl, fetch and ftp" eerror "could not download ${1##*/}" exit 1 fi @@ -59,10 +61,22 @@ efetch() { mkdir -p "${DISTDIR}" >& /dev/null einfo "Fetching ${1##*/}" pushd "${DISTDIR}" > /dev/null - # try for mirrors first, then try given location - ${FETCH_COMMAND} "${GENTOO_MIRRORS}/distfiles/${1##*/}" < /dev/null - [[ ! -f ${1##*/} && ${1} != ${GENTOO_MIRRORS}/distfiles/${1##*/} ]] \ - && ${FETCH_COMMAND} "$1" < /dev/null + + # try for mirrors first, fall back to distfiles, then try given location + local locs=( ) + local loc + for loc in ${GENTOO_MIRRORS} ${DISTFILES_G_O} ; do + locs=( + "${locs[@]}" + "${loc}/distfiles/${1##*/}" + ) + done + locs=( "${locs[@]}" "$1" ) + + for loc in "${locs[@]}" ; do + ${FETCH_COMMAND} "${loc}" < /dev/null + [[ -f ${1##*/} ]] && break + done if [[ ! -f ${1##*/} ]] ; then eerror "downloading ${1} failed!" return 1 @@ -751,16 +765,17 @@ bootstrap_gnu() { local p patchopts for p in \ "-p0" \ - "${GENTOO_MIRRORS}/distfiles/bash43-"{001..048} \ + "${DISTFILES_G_O}/distfiles/bash43-"{001..048} \ "-p2" \ - https://dev.gentoo.org/~haubi/distfiles/bash-4.3_p39-cygwin-r2.patch \ + "https://dev.gentoo.org/~haubi/distfiles/bash-4.3_p39-cygwin-r2.patch" \ ; do if [[ ${p} == -* ]] ; then patchopts=${p} continue fi efetch "${p}" || return 1 - patch --forward --no-backup-if-mismatch ${patchopts} < "${DISTDIR}/${p##*/}" || return 1 + patch --forward --no-backup-if-mismatch ${patchopts} \ + < "${DISTDIR}/${p##*/}" || return 1 done fi @@ -1039,7 +1054,7 @@ bootstrap_zlib_core() { einfo "Bootstrapping ${A%-*}" - efetch ${GENTOO_MIRRORS}/distfiles/${A} || return 1 + efetch ${DISTFILES_G_O}/distfiles/${A} || return 1 einfo "Unpacking ${A%%-*}" export S="${PORTAGE_TMPDIR}/zlib-${PV}" @@ -1151,7 +1166,7 @@ bootstrap_coreutils() { # 8.16 is the last version released as tar.gz # 8.18 is necessary for macOS High Sierra (darwin17) and converted # to tar.gz for this case - bootstrap_gnu coreutils 8.30 || bootstrap_gnu coreutils 8.28 || \ + bootstrap_gnu coreutils 8.30 || \ bootstrap_gnu coreutils 8.16 || bootstrap_gnu coreutils 8.17 } @@ -1223,7 +1238,7 @@ bootstrap_bzip2() { A=${PN}-${PV}.tar.gz einfo "Bootstrapping ${A%-*}" - efetch ${GENTOO_MIRRORS}/distfiles/${A} || return 1 + efetch ${DISTFILES_G_O}/distfiles/${A} || return 1 einfo "Unpacking ${A%-*}" S="${PORTAGE_TMPDIR}/${PN}-${PV}" @@ -1986,7 +2001,8 @@ set_helper_vars() { PORTAGE_TMPDIR=${PORTAGE_TMPDIR:-${ROOT}/var/tmp} DISTFILES_URL=${DISTFILES_URL:-"http://dev.gentoo.org/~grobian/distfiles"} GNU_URL=${GNU_URL:="http://ftp.gnu.org/gnu"} - GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.gentoo.org"} + DISTFILES_G_O="http://distfiles.gentoo.org" + GENTOO_MIRRORS=${GENTOO_MIRRORS:=${DISTFILES_G_O}} SNAPSHOT_HOST=$(rapx ${GENTOO_MIRRORS} http://rsync.prefix.bitzolder.nl) SNAPSHOT_URL=${SNAPSHOT_URL:-"${SNAPSHOT_HOST}/snapshots"} GCC_APPLE_URL="http://www.opensource.apple.com/darwinsource/tarballs/other"