From 6a56d0aa9f49c8442e3f6663c2047bd5fb372fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sat, 17 Jun 2023 09:47:41 +0200 Subject: [PATCH 1/3] Add support for Debian 12 --- Makefile | 2 +- README.md | 5 ++- builder/Dockerfile.debian-12 | 29 +++++++++++++++ builder/docker-compose.yml | 12 +++++++ builder/package.debian-12 | 70 ++++++++++++++++++++++++++++++++++++ serverless-resources.yml | 14 ++++++++ serverless.yml | 4 ++- test/docker-compose.yml | 8 +++++ 8 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 builder/Dockerfile.debian-12 create mode 100644 builder/package.debian-12 diff --git a/Makefile b/Makefile index 7e9be6b..c67fe72 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PLATFORMS := ubuntu-1804 ubuntu-2004 ubuntu-2204 debian-10 debian-11 centos-7 centos-8 rhel-9 opensuse-153 opensuse-154 +PLATFORMS := ubuntu-1804 ubuntu-2004 ubuntu-2204 debian-10 debian-11 debian-12 centos-7 centos-8 rhel-9 opensuse-153 opensuse-154 SLS_BINARY ?= ./node_modules/serverless/bin/serverless.js deps: diff --git a/README.md b/README.md index 0521f7c..2bbd2c4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ bug, or ask questions on [Posit Community](https://community.rstudio.com). R binaries are built for the following Linux operating systems: - Ubuntu 18.04, 20.04, 22.04 -- Debian 10, 11 +- Debian 10, 11, 12 - CentOS 7 - Red Hat Enterprise Linux 7, 8, 9 - openSUSE 15.3, 15.4 @@ -70,6 +70,9 @@ curl -O https://cdn.posit.co/r/debian-10/pkgs/r-${R_VERSION}_1_amd64.deb # Debian 11 curl -O https://cdn.posit.co/r/debian-11/pkgs/r-${R_VERSION}_1_amd64.deb + +# Debian 12 +curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_amd64.deb ``` Then install the package: diff --git a/builder/Dockerfile.debian-12 b/builder/Dockerfile.debian-12 new file mode 100644 index 0000000..62f95a2 --- /dev/null +++ b/builder/Dockerfile.debian-12 @@ -0,0 +1,29 @@ +FROM debian:bullseye + +ENV OS_IDENTIFIER debian-12 + +RUN set -x \ + && export DEBIAN_FRONTEND=noninteractive \ + && echo 'deb-src http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list \ + && apt-get update \ + && apt-get install -y curl gcc libcurl4-openssl-dev libicu-dev \ + libopenblas-base libpcre2-dev make python3-pip wget \ + && apt-get build-dep -y r-base + +RUN pip3 install awscli + +RUN chmod 0777 /opt + +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 + +# R 3.x requires PCRE2 for Pango support on Debian 12 +ENV INCLUDE_PCRE2_IN_R_3 yes + +COPY package.debian-12 /package.sh +COPY build.sh . +ENTRYPOINT ./build.sh diff --git a/builder/docker-compose.yml b/builder/docker-compose.yml index 889cb28..30fd55b 100644 --- a/builder/docker-compose.yml +++ b/builder/docker-compose.yml @@ -59,6 +59,18 @@ services: image: r-builds:debian-11 volumes: - ./integration/tmp:/tmp/output + debian-12: + command: ./build.sh + environment: + - R_VERSION=${R_VERSION} + - R_INSTALL_PATH=${R_INSTALL_PATH} + - LOCAL_STORE=/tmp/output + build: + context: . + dockerfile: Dockerfile.debian-12 + image: r-builds:debian-12 + volumes: + - ./integration/tmp:/tmp/output centos-7: command: ./build.sh environment: diff --git a/builder/package.debian-12 b/builder/package.debian-12 new file mode 100644 index 0000000..8db52a5 --- /dev/null +++ b/builder/package.debian-12 @@ -0,0 +1,70 @@ +#!/bin/bash + +if [[ ! -d /tmp/output/${OS_IDENTIFIER} ]]; then + mkdir -p "/tmp/output/${OS_IDENTIFIER}" +fi + +# R 3.x requires PCRE1. On Debian 12, R 3.x also requires PCRE2 for Pango support. +pcre_libs='- libpcre2-dev' +if [[ "${R_VERSION}" =~ ^3 ]]; then + pcre_libs='- libpcre2-dev +- libpcre3-dev' +fi + +cat < /tmp/nfpm.yml +name: r-${R_VERSION} +version: 1 +version_schema: none +section: gnu-r +arch: $(dpkg --print-architecture) +priority: optional +maintainer: Posit Software, PBC +description: | + GNU R statistical computation and graphics system +vendor: Posit Software, PBC +homepage: https://www.r-project.org +license: GPL-2 +deb: + fields: + Bugs: https://github.com/rstudio/r-builds/issues +depends: +- ca-certificates +- g++ +- gcc +- gfortran +- libbz2-dev +- libc6 +- libcairo2 +- libcurl4-openssl-dev +- libglib2.0-0 +- libgomp1 +- libicu-dev +- liblzma-dev +- libopenblas-dev +- libpango-1.0-0 +- libpangocairo-1.0-0 +- libpaper-utils +${pcre_libs} +- libpng16-16 +- libreadline8 +- libtcl8.6 +- libtiff5 +- libtk8.6 +- libx11-6 +- libxt6 +- make +- ucf +- unzip +- zip +- zlib1g-dev +contents: +- src: ${R_INSTALL_PATH} + dst: ${R_INSTALL_PATH} +EOF + +nfpm package \ + -f /tmp/nfpm.yml \ + -p deb \ + -t "/tmp/output/${OS_IDENTIFIER}" + +export PKG_FILE=$(ls /tmp/output/${OS_IDENTIFIER}/r-${R_VERSION}*.deb | head -1) diff --git a/serverless-resources.yml b/serverless-resources.yml index efb43b2..207b2c9 100644 --- a/serverless-resources.yml +++ b/serverless-resources.yml @@ -201,6 +201,20 @@ rBuildsBatchJobDefinitionDebian11: Image: "#{AWS::AccountId}.dkr.ecr.#{AWS::Region}.amazonaws.com/r-builds:debian-11" Timeout: AttemptDurationSeconds: 7200 +rBuildsBatchJobDefinitionDebian12: + Type: AWS::Batch::JobDefinition + Properties: + Type: container + ContainerProperties: + Command: + - ./build.sh + Vcpus: 4 + Memory: 4096 + JobRoleArn: + "Fn::GetAtt": [ rBuildsEcsTaskIamRole, Arn ] + Image: "#{AWS::AccountId}.dkr.ecr.#{AWS::Region}.amazonaws.com/r-builds:debian-12" + Timeout: + AttemptDurationSeconds: 7200 rBuildsBatchJobDefinitionCentos7: Type: AWS::Batch::JobDefinition Properties: diff --git a/serverless.yml b/serverless.yml index f7d93d8..6f54bb2 100644 --- a/serverless.yml +++ b/serverless.yml @@ -52,6 +52,8 @@ provider: Ref: rBuildsBatchJobDefinitionDebian10 JOB_DEFINITION_ARN_debian_11: Ref: rBuildsBatchJobDefinitionDebian11 + JOB_DEFINITION_ARN_debian_12: + Ref: rBuildsBatchJobDefinitionDebian12 JOB_DEFINITION_ARN_centos_7: Ref: rBuildsBatchJobDefinitionCentos7 JOB_DEFINITION_ARN_centos_8: @@ -62,7 +64,7 @@ provider: Ref: rBuildsBatchJobDefinitionOpensuse153 JOB_DEFINITION_ARN_opensuse_154: Ref: rBuildsBatchJobDefinitionOpensuse154 - SUPPORTED_PLATFORMS: ubuntu-1804,ubuntu-2004,ubuntu-2204,debian-10,debian-11,centos-7,centos-8,rhel-9,opensuse-153,opensuse-154 + SUPPORTED_PLATFORMS: ubuntu-1804,ubuntu-2004,ubuntu-2204,debian-10,debian-11,debian-12,centos-7,centos-8,rhel-9,opensuse-153,opensuse-154 functions: queueBuilds: diff --git a/test/docker-compose.yml b/test/docker-compose.yml index db2dc3f..920c1d8 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -23,6 +23,14 @@ services: - R_VERSION=${R_VERSION} volumes: - ../:/r-builds + debian-12: + image: debian:bookworm + command: /r-builds/test/test-apt.sh + environment: + - OS_IDENTIFIER=debian-12 + - R_VERSION=${R_VERSION} + volumes: + - ../:/r-builds debian-11: image: debian:bullseye command: /r-builds/test/test-apt.sh From 4fdb5a8154b2532d9b9be9d8ac3888f99709465b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sat, 17 Jun 2023 11:07:09 +0200 Subject: [PATCH 2/3] Fix libtiff package name for Debian 12 --- builder/package.debian-12 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/package.debian-12 b/builder/package.debian-12 index 8db52a5..c7673d5 100644 --- a/builder/package.debian-12 +++ b/builder/package.debian-12 @@ -48,7 +48,7 @@ ${pcre_libs} - libpng16-16 - libreadline8 - libtcl8.6 -- libtiff5 +- libtiff6 - libtk8.6 - libx11-6 - libxt6 From 2058bd650374f2c50e188d90f8de9a461e93b105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sat, 17 Jun 2023 15:29:33 +0200 Subject: [PATCH 3/3] Fix Dockerfile for Debian-12 --- builder/Dockerfile.debian-12 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/Dockerfile.debian-12 b/builder/Dockerfile.debian-12 index 62f95a2..47cba63 100644 --- a/builder/Dockerfile.debian-12 +++ b/builder/Dockerfile.debian-12 @@ -1,16 +1,16 @@ -FROM debian:bullseye +FROM debian:bookworm ENV OS_IDENTIFIER debian-12 RUN set -x \ && export DEBIAN_FRONTEND=noninteractive \ - && echo 'deb-src http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list \ + && echo 'deb-src http://deb.debian.org/debian bookworm main' >> /etc/apt/sources.list \ && apt-get update \ && apt-get install -y curl gcc libcurl4-openssl-dev libicu-dev \ - libopenblas-base libpcre2-dev make python3-pip wget \ + libopenblas0 libpcre2-dev make pipx wget \ && apt-get build-dep -y r-base -RUN pip3 install awscli +RUN pipx install awscli && pipx ensurepath RUN chmod 0777 /opt