Skip to content

Commit dd3fa63

Browse files
committed
support R 4
1 parent 8fe5916 commit dd3fa63

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

repo2docker/buildpacks/r.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ def r_version(self):
7878
"3.6": "3.6.1-3bionic",
7979
"3.6.0": "3.6.0-2bionic",
8080
"3.6.1": "3.6.1-3bionic",
81+
"4.0": "4.0.2-1.1804.0",
82+
"4.0.2": "4.0.2-1.1804.0",
8183
}
8284
# the default if nothing is specified
8385
r_version = "3.6"
@@ -238,13 +240,17 @@ def get_build_scripts(self):
238240

239241
scripts = []
240242
# For R 3.4 we want to use the default Ubuntu package but otherwise
241-
# we use the packages from a PPA
243+
# we use the packages from R's own repo
242244
if V(self.r_version) >= V("3.5"):
245+
if V(self.r_version) >= V("4"):
246+
vs = "40"
247+
else:
248+
vs = "35"
243249
scripts += [
244250
(
245251
"root",
246-
r"""
247-
echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/" > /etc/apt/sources.list.d/r3.6-ubuntu.list
252+
rf"""
253+
echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran{vs}/" > /etc/apt/sources.list.d/r-ubuntu.list
248254
""",
249255
),
250256
# Use port 80 to talk to the keyserver to increase the chances

tests/r/r4/install.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
install.packages("ggplot2")

tests/r/r4/runtime.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
r-4.0-2020-07-07

tests/r/r4/verify

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env Rscript
2+
library('ggplot2')
3+
4+
print(version)
5+
if (version$major != "4") {
6+
quit("yes", 1)
7+
}

0 commit comments

Comments
 (0)