Skip to content

Commit

Permalink
Merge pull request #152 from gaborcsardi/feature/arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi authored Jan 12, 2023
2 parents 1a4f8a8 + fc42122 commit 6e831a2
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 39 deletions.
8 changes: 5 additions & 3 deletions builder/Dockerfile.centos-7
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ RUN yum -y update \
RUN pip3 install awscli --upgrade --user && \
ln -s /root/.local/bin/aws /usr/bin/aws

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
yum install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
yum install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
8 changes: 5 additions & 3 deletions builder/Dockerfile.centos-8
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ RUN dnf -y upgrade \
RUN pip3 install awscli --upgrade --user \
&& ln -s /root/.local/bin/aws /usr/bin/aws

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
dnf install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
6 changes: 3 additions & 3 deletions builder/Dockerfile.debian-10
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ RUN pip3 install awscli

RUN chmod 0777 /opt

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

# Override the default pager used by R
ENV PAGER /usr/bin/pager
Expand Down
6 changes: 3 additions & 3 deletions builder/Dockerfile.debian-11
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ RUN pip3 install awscli

RUN chmod 0777 /opt

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

# Override the default pager used by R
ENV PAGER /usr/bin/pager
Expand Down
8 changes: 5 additions & 3 deletions builder/Dockerfile.opensuse-153
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ RUN zypper --non-interactive --gpg-auto-import-keys -n install \

RUN pip install awscli

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
zypper --non-interactive --no-gpg-checks install nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
zypper --non-interactive --no-gpg-checks install "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
10 changes: 6 additions & 4 deletions builder/Dockerfile.opensuse-154
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ RUN zypper --non-interactive --gpg-auto-import-keys -n install \
&& zypper clean

# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
zypper --non-interactive --no-gpg-checks install nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
zypper --non-interactive --no-gpg-checks install "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
10 changes: 6 additions & 4 deletions builder/Dockerfile.rhel-9
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ RUN dnf -y upgrade \
&& dnf clean all

# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
dnf install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
6 changes: 3 additions & 3 deletions builder/Dockerfile.ubuntu-1804
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN set -x \

RUN pip install awscli

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

RUN chmod 0777 /opt

Expand Down
6 changes: 3 additions & 3 deletions builder/Dockerfile.ubuntu-2004
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN set -x \

RUN pip3 install awscli

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

RUN chmod 0777 /opt

Expand Down
6 changes: 3 additions & 3 deletions builder/Dockerfile.ubuntu-2204
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN set -x \

RUN pip3 install awscli

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"

RUN chmod 0777 /opt

Expand Down
2 changes: 1 addition & 1 deletion builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ compile_r() {

# tools/config.guess in R versions older than 3.2.2 guess 'unknown' instead of 'pc'
# test the version and properly set the flag.
build_flag='--build=x86_64-pc-linux-gnu'
build_flag="--build=$(uname -m)-pc-linux-gnu"
if _version_is_greater_than ${R_VERSION} 3.2.2; then
build_flag=''
fi
Expand Down
3 changes: 3 additions & 0 deletions builder/package.centos-7
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ if [ -d /opt/R/${R_VERSION} ]; then
fi
EOF

if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

cat <<EOF > /tmp/nfpm.yml
name: R-${R_VERSION}
version: 1
version_schema: none
arch: $(cat /tmp/arch)
release: 1
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
3 changes: 3 additions & 0 deletions builder/package.centos-8
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ if [ -d /opt/R/${R_VERSION} ]; then
fi
EOF

if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

cat <<EOF > /tmp/nfpm.yml
name: R-${R_VERSION}
version: 1
version_schema: none
arch: $(cat /tmp/arch)
release: 1
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
1 change: 1 addition & 0 deletions builder/package.debian-10
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ name: r-${R_VERSION}
version: 1
version_schema: none
section: gnu-r
arch: $(dpkg --print-architecture)
priority: optional
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
1 change: 1 addition & 0 deletions builder/package.debian-11
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ name: r-${R_VERSION}
version: 1
version_schema: none
section: gnu-r
arch: $(dpkg --print-architecture)
priority: optional
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
3 changes: 3 additions & 0 deletions builder/package.opensuse-153
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ if [ -d /opt/R/${R_VERSION} ]; then
fi
EOF

if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

cat <<EOF > /tmp/nfpm.yml
name: R-${R_VERSION}
version: 1
version_schema: none
arch: $(cat /tmp/arch)
release: 1
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
3 changes: 3 additions & 0 deletions builder/package.opensuse-154
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ if [ -d /opt/R/${R_VERSION} ]; then
fi
EOF

if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

cat <<EOF > /tmp/nfpm.yml
name: R-${R_VERSION}
version: 1
version_schema: none
arch: $(cat /tmp/arch)
release: 1
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
3 changes: 3 additions & 0 deletions builder/package.rhel-9
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ if [ -d /opt/R/${R_VERSION} ]; then
fi
EOF

if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

cat <<EOF > /tmp/nfpm.yml
name: R-${R_VERSION}
version: 1
version_schema: none
arch: $(cat /tmp/arch)
release: 1
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
1 change: 1 addition & 0 deletions builder/package.ubuntu-1804
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ name: r-${R_VERSION}
version: 1
version_schema: none
section: universe/math
arch: $(dpkg --print-architecture)
priority: optional
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
Expand Down
1 change: 1 addition & 0 deletions builder/package.ubuntu-2004
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ version: 1
version_schema: none
section: universe/math
priority: optional
arch: $(dpkg --print-architecture)
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
GNU R statistical computation and graphics system
Expand Down
1 change: 1 addition & 0 deletions builder/package.ubuntu-2204
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ version: 1
version_schema: none
section: universe/math
priority: optional
arch: $(dpkg --print-architecture)
maintainer: Posit Software, PBC <https://github.com/rstudio/r-builds>
description: |
GNU R statistical computation and graphics system
Expand Down
23 changes: 18 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,30 @@ do_show_versions () {
done
}

# Returns the installer name for a given version and OS
# Returns the installer name for a given version, OS, arch
download_name () {
os=$1
version=$2
arch=$3
case $arch in
"x86_64" | "amd64")
rpm_arch="x86_64"
deb_arch="amd64"
;;
"aarch64")
rpm_arch="aarch64"
deb_arch="arm64"
;;
esac
case $os in
"RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky")
echo "R-${version}-1-1.x86_64.rpm"
echo "R-${version}-1-1.${rpm_arch}.rpm"
;;
"Ubuntu" | "Debian")
echo "r-${version}_1_amd64.deb"
echo "r-${version}_1_${deb_arch}.deb"
;;
"LEAP12" | "LEAP15" | "SLES12" | "SLES15")
echo "R-${version}-1-1.x86_64.rpm"
echo "R-${version}-1-1.${rpm_arch}.rpm"
;;
esac
}
Expand Down Expand Up @@ -486,8 +497,10 @@ do_install () {
prompt_version
[ -z $SELECTED_VERSION ] && { echo "Invalid version"; exit 1; }

arch=$(uname -m)

# Get the name of the installer to use
installer_file_name=$(download_name "${os}" "${SELECTED_VERSION}")
installer_file_name=$(download_name "${os}" "${SELECTED_VERSION}" "${arch}")

# Get the URL to download from. If the installer already exists in the current
# directory, this will return a blank string.
Expand Down
2 changes: 1 addition & 1 deletion jenkins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN apt-get update -qq && apt-get install -y python-pip
RUN pip install awscli

# install docker cli
RUN wget -q -O /tmp/docker-cli.deb https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce-cli_18.09.2~3-0~debian-stretch_amd64.deb \
RUN wget -q -O /tmp/docker-cli.deb https://download.docker.com/linux/debian/dists/stretch/pool/stable/$(dpkg --print-architecture)/docker-ce-cli_18.09.2~3-0~debian-stretch_$(dpkg --print-architecture).deb \
&& dpkg -i /tmp/docker-cli.deb

RUN npm install -g serverless
Expand Down

0 comments on commit 6e831a2

Please sign in to comment.