From dd3fa631ddbec82a4ab11ec6948b9f4d20490540 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 14 Sep 2020 11:55:52 +0200 Subject: [PATCH] support R 4 --- repo2docker/buildpacks/r.py | 12 +++++++++--- tests/r/r4/install.R | 1 + tests/r/r4/runtime.txt | 1 + tests/r/r4/verify | 7 +++++++ 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tests/r/r4/install.R create mode 100644 tests/r/r4/runtime.txt create mode 100755 tests/r/r4/verify diff --git a/repo2docker/buildpacks/r.py b/repo2docker/buildpacks/r.py index 0173a1e4..d3f9c07e 100644 --- a/repo2docker/buildpacks/r.py +++ b/repo2docker/buildpacks/r.py @@ -78,6 +78,8 @@ class RBuildPack(PythonBuildPack): "3.6": "3.6.1-3bionic", "3.6.0": "3.6.0-2bionic", "3.6.1": "3.6.1-3bionic", + "4.0": "4.0.2-1.1804.0", + "4.0.2": "4.0.2-1.1804.0", } # the default if nothing is specified r_version = "3.6" @@ -238,13 +240,17 @@ class RBuildPack(PythonBuildPack): scripts = [] # For R 3.4 we want to use the default Ubuntu package but otherwise - # we use the packages from a PPA + # we use the packages from R's own repo if V(self.r_version) >= V("3.5"): + if V(self.r_version) >= V("4"): + vs = "40" + else: + vs = "35" scripts += [ ( "root", - r""" - echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/" > /etc/apt/sources.list.d/r3.6-ubuntu.list + rf""" + echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran{vs}/" > /etc/apt/sources.list.d/r-ubuntu.list """, ), # Use port 80 to talk to the keyserver to increase the chances diff --git a/tests/r/r4/install.R b/tests/r/r4/install.R new file mode 100644 index 00000000..df6d6a83 --- /dev/null +++ b/tests/r/r4/install.R @@ -0,0 +1 @@ +install.packages("ggplot2") diff --git a/tests/r/r4/runtime.txt b/tests/r/r4/runtime.txt new file mode 100644 index 00000000..e0b26306 --- /dev/null +++ b/tests/r/r4/runtime.txt @@ -0,0 +1 @@ +r-4.0-2020-07-07 diff --git a/tests/r/r4/verify b/tests/r/r4/verify new file mode 100755 index 00000000..6d28082b --- /dev/null +++ b/tests/r/r4/verify @@ -0,0 +1,7 @@ +#!/usr/bin/env Rscript +library('ggplot2') + +print(version) +if (version$major != "4") { + quit("yes", 1) +}