diff --git a/repo2docker/buildpacks/r.py b/repo2docker/buildpacks/r.py index 30ce3245..23ba30ab 100644 --- a/repo2docker/buildpacks/r.py +++ b/repo2docker/buildpacks/r.py @@ -75,6 +75,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" @@ -232,13 +234,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) +}