Skip to content

Commit

Permalink
buildsys: teach package boostrap to use curl if available
Browse files Browse the repository at this point in the history
This allows people to do a package bootstrap on macOS without installing wget,
as curl is installed there by default but wget is not.
  • Loading branch information
fingolfin committed Jun 16, 2019
1 parent ce16a7d commit 0396136
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -1105,13 +1105,13 @@ PKG_BRANCH = master
PKG_BOOTSTRAP_URL = https://www.gap-system.org/pub/gap/gap4pkgs/
PKG_MINIMAL = packages-required-$(PKG_BRANCH).tar.gz
PKG_FULL = packages-$(PKG_BRANCH).tar.gz
WGET = wget -N
DOWNLOAD = etc/download.sh

bootstrap-pkg-minimal:
@if test -e pkg; then \
echo "The pkg directory already exists. Please move or remove it to proceed."; \
else \
$(WGET) $(PKG_BOOTSTRAP_URL)$(PKG_MINIMAL) && \
$(DOWNLOAD) $(PKG_BOOTSTRAP_URL)$(PKG_MINIMAL) && \
mkdir pkg && \
cd pkg && \
tar xzf ../$(PKG_MINIMAL) ; \
Expand All @@ -1121,7 +1121,7 @@ bootstrap-pkg-full:
@if test -e pkg; then \
echo "The pkg directory already exists. Please move or remove it to proceed" ; \
else \
$(WGET) $(PKG_BOOTSTRAP_URL)$(PKG_FULL) && \
$(DOWNLOAD) $(PKG_BOOTSTRAP_URL)$(PKG_FULL) && \
mkdir pkg && \
cd pkg && \
tar xzf ../$(PKG_FULL) ; \
Expand Down
6 changes: 3 additions & 3 deletions etc/ci-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ time make V=1 -j4

# download packages; instruct wget to retry several times if the
# connection is refused, to work around intermittent failures
WGET="wget -N --no-check-certificate --tries=5 --waitretry=5 --retry-connrefused"
WGET="wget --tries=5 --waitretry=5 --retry-connrefused"
if [[ $(uname) == Darwin ]]
then
# Travis OSX builders seem to have very small download bandwidth,
# so as a workaround, we only test the minimal set of packages there.
# On the upside, it's good to test that, too!
make bootstrap-pkg-minimal WGET="$WGET"
make bootstrap-pkg-minimal DOWNLOAD="$WGET"
else
make bootstrap-pkg-full WGET="$WGET"
make bootstrap-pkg-full DOWNLOAD="$WGET"
fi

# check that GAP is at least able to start
Expand Down
6 changes: 6 additions & 0 deletions etc/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#/bin/sh
set -e
command -v wget >/dev/null 2>&1 && exec wget -N "$@"
command -v curl >/dev/null 2>&1 && exec curl -O "$@"
echo "Error, failed to download: neither wget nor curl available"
exit 1

0 comments on commit 0396136

Please sign in to comment.