Skip to content

Commit

Permalink
try these weird case statements
Browse files Browse the repository at this point in the history
  • Loading branch information
samansmink committed Sep 18, 2024
1 parent b9e7a74 commit 6843ed2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/_extension_distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ jobs:
docker build \
--build-arg 'vcpkg_url=${{ inputs.vcpkg_url }}' \
--build-arg 'vcpkg_commit=${{ inputs.vcpkg_commit }}' \
--build-arg 'extra_toolchains=${{ format(';{0};', inputs.extra_toolchains) }}' \
--build-arg 'enable_rust=${{ inputs.enable_rust && '1' || '0' }}' \
--build-arg 'extra_toolchains=${{ inputs.enable_rust && format(';{0};rust;', inputs.extra_toolchains) || format(';{0};', inputs.extra_toolchains) }}' \
-t duckdb/${{ matrix.duckdb_arch }} \
./extension-ci-tools/docker/${{ matrix.duckdb_arch }}
Expand Down
35 changes: 21 additions & 14 deletions docker/linux_amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,35 @@ ENV CCACHE_MAXSIZE=400M
# a `;` separated list of extra toolchains to install (passed in like this to makes things easier through GitHub Actions)
# Note that it should start and end with a `;`
ARG extra_toolchains
ARG enable_rust

RUN echo "$extra_toolchains" > ~/extra_toolchains.txt
# NOTE: the weird case conditionals are because of bash limitations in the ubuntu image used (see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash)

# Install Parser tools
RUN if [ "$extra_toolchains" == *";parser-tools;"* ]; then \
apt-get install -y -qq bison flex; \
fi
RUN case "$extra_toolchains" in \
*\;parser-tools\;*) \
apt-get install -y -qq bison flex \
;; \
esac

# Install Fortran
RUN if [ "$extra_toolchains" == *";fortran;"* ]; then \
apt-get install -y -qq gfortran gfortran-aarch64-linux-gnu; \
fi
RUN case "$extra_toolchains" in \
*\;fortran\;*) \
apt-get install -y -qq gfortran gfortran-aarch64-linux-gnu \
;; \
esac

# Configure Rust
RUN if [ "$extra_toolchains" == *";rust;"* ] || [ "$enable_rust" = "1" ]; then \
curl https://sh.rustup.rs -sSf | bash -s -- -y ;\
fi
RUN case "$extra_toolchains" in \
*\;rust\;*) \
curl https://sh.rustup.rs -sSf | bash -s -- -y \
;; \
esac
ENV PATH="/root/.cargo/bin:${PATH}"

# Configure go
RUN if [ "$extra_toolchains" == *";go;"* ]; then \
apt-get install -y -qq golang-go; \
fi
RUN case "$extra_toolchains" in \
*\;go\;*) \
capt-get install -y -qq golang-go \
;; \
esac \
ENV PATH="/usr/local/go/bin:${PATH}"
1 change: 0 additions & 1 deletion docker/linux_amd64_gcc4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ ENV CCACHE_MAXSIZE=400M
# a `;` separated list of extra toolchains to install (passed in like this to makes things easier through GitHub Actions)
# Note that it should start and end with a `;`
ARG extra_toolchains
ARG enable_rust

RUN echo "$extra_toolchains" > ~/extra_toolchains.txt

Expand Down
35 changes: 21 additions & 14 deletions docker/linux_arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,35 @@ ENV CCACHE_MAXSIZE=400M
# a `;` separated list of extra toolchains to install (passed in like this to makes things easier through GitHub Actions)
# Note that it should start and end with a `;`
ARG extra_toolchains
ARG enable_rust

RUN echo "$extra_toolchains" > ~/extra_toolchains.txt
# NOTE: the weird case conditionals are because of bash limitations in the ubuntu image used (see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash)

# Install Parser tools
RUN if [ "$extra_toolchains" == *";parser-tools;"* ]; then \
apt-get install -y -qq bison flex; \
fi
RUN case "$extra_toolchains" in \
*\;parser-tools\;*) \
apt-get install -y -qq bison flex \
;; \
esac

# Install Fortran
RUN if [ "$extra_toolchains" == *";fortran;"* ]; then \
apt-get install -y -qq gfortran gfortran-aarch64-linux-gnu; \
fi
RUN case "$extra_toolchains" in \
*\;fortran\;*) \
apt-get install -y -qq gfortran gfortran-aarch64-linux-gnu \
;; \
esac

# Configure Rust
RUN if [ "$extra_toolchains" == *";rust;"* ] || [ "$enable_rust" = "1" ]; then \
curl https://sh.rustup.rs -sSf | bash -s -- -y ;\
fi
RUN case "$extra_toolchains" in \
*\;rust\;*) \
curl https://sh.rustup.rs -sSf | bash -s -- -y \
;; \
esac
ENV PATH="/root/.cargo/bin:${PATH}"

# Configure go
RUN if [ "$extra_toolchains" == *";go;"* ]; then \
apt-get install -y -qq golang-go; \
fi
RUN case "$extra_toolchains" in \
*\;go\;*) \
capt-get install -y -qq golang-go \
;; \
esac \
ENV PATH="/usr/local/go/bin:${PATH}"

0 comments on commit 6843ed2

Please sign in to comment.