Skip to content

Commit bf99b93

Browse files
authored
Merge pull request #1117 from minrk/r-base-core
Only get R itself (r-base-core) from apt, not CRAN packages
2 parents a37a205 + ad0034c commit bf99b93

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

repo2docker/buildpacks/_r_base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ def rstudio_base_scripts(r_version):
3131
return [
3232
(
3333
"root",
34+
# we should have --no-install-recommends on all our apt-get install commands,
35+
# but here it's important because these recommend r-base,
36+
# which will upgrade the installed version of R, undoing our pinned version
3437
r"""
3538
curl --silent --location --fail {rstudio_url} > /tmp/rstudio.deb && \
3639
curl --silent --location --fail {shiny_server_url} > /tmp/shiny.deb && \
3740
echo '{rstudio_sha256sum} /tmp/rstudio.deb' | sha256sum -c - && \
3841
echo '{shiny_sha256sum} /tmp/shiny.deb' | sha256sum -c - && \
3942
apt-get update > /dev/null && \
40-
apt install -y /tmp/rstudio.deb /tmp/shiny.deb > /dev/null && \
43+
apt install -y --no-install-recommends /tmp/rstudio.deb /tmp/shiny.deb && \
4144
rm /tmp/rstudio.deb && \
4245
apt-get -qq purge && \
4346
apt-get -qq clean && \

repo2docker/buildpacks/r.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ class RBuildPack(PythonBuildPack):
3838
3939
- are needed by a specific tool
4040
41-
The `r-base` package from Ubuntu apt repositories is used to install
42-
R itself, rather than any of the methods from https://cran.r-project.org/.
41+
The `r-base-core` package from Ubuntu or "Ubuntu packages for R"
42+
apt repositories is used to install R itself,
43+
rather than any of the methods from https://cran.r-project.org/.
4344
4445
The `r-base-dev` package is installed as advised in RStudio instructions.
4546
"""
@@ -291,11 +292,14 @@ def get_build_scripts(self):
291292
),
292293
(
293294
"root",
295+
# we should have --no-install-recommends on all our apt-get install commands,
296+
# but here it's important because it will pull in CRAN packages
297+
# via r-recommends, which is only guaranteed to be compatible with the latest r-base-core
294298
r"""
295299
apt-get update > /dev/null && \
296-
apt-get install --yes r-base={R_version} r-base-core={R_version} \
300+
apt-get install --yes --no-install-recommends \
301+
r-base-core={R_version} \
297302
r-base-dev={R_version} \
298-
r-recommended={R_version} \
299303
libclang-dev \
300304
libzmq3-dev > /dev/null && \
301305
apt-get -qq purge && \

tests/unit/test_r.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_custom_cran_apt_repo(tmpdir):
147147

148148
# check that we install the right package
149149
for user, script in scripts:
150-
if "r-base=3.5" in script:
150+
if "r-base-core=3.5" in script:
151151
break
152152
else:
153153
assert False, "Should have installed base R"

0 commit comments

Comments
 (0)