From 0286b7b667720a11cc2e5cc5917239e622618eff Mon Sep 17 00:00:00 2001 From: Florian Angerer <florian.angerer@oracle.com> Date: Mon, 27 Nov 2017 10:45:16 +0100 Subject: [PATCH] Fix: Actual return value is different to documentation for 'install.packages'. --- .../r/install.cache.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/com.oracle.truffle.r.test.packages/r/install.cache.R b/com.oracle.truffle.r.test.packages/r/install.cache.R index 9361c6903a..28ba55acc7 100644 --- a/com.oracle.truffle.r.test.packages/r/install.cache.R +++ b/com.oracle.truffle.r.test.packages/r/install.cache.R @@ -324,6 +324,7 @@ transitive.dependencies <- function(pkg, lib, pl = available.packages(), deptype unique(deps) } +# Fetches the package from the cache or installs it. This is also done for all transitive dependencies. pkg.cache.internal.install <- function(pkg.cache.env, pkgname, contriburl, lib.install) { tryCatch({ # determine available packages @@ -336,17 +337,16 @@ pkg.cache.internal.install <- function(pkg.cache.env, pkgname, contriburl, lib.i # apply pkg cache to fetch cached packages first cached.pkgs <- sapply(transitive.pkg.list, function(pkgname) pkg.cache.get(pkg.cache.env, pkgname, lib.install)) + log.message("Number of uncached pacakges:", length(transitive.pkg.list[!cached.pkgs]), level=1) # if there was at least one non-cached package if (any(!cached.pkgs) || length(cached.pkgs) == 0L) { # install the package (and the transitive dependencies implicitly) - res <- install.packages(pkgname, contriburl=contriburl, type="source", lib=lib.install, INSTALL_opts="--install-tests") - if (res == NULL) { - # cache packages that were not in the cache before - lapply(transitive.pkg.list[!cached.pkgs], function(pkgname) pkg.cache.insert(pkg.cache.env, pkgname, lib.install)) - } else { - return (1L) - } + install.packages(pkgname, contriburl=contriburl, type="source", lib=lib.install, INSTALL_opts="--install-tests") + + # cache packages that were not in the cache before + log.message("Caching uncached dependencies:", transitive.pkg.list[!cached.pkgs], level=1) + lapply(transitive.pkg.list[!cached.pkgs], function(pkgname) pkg.cache.insert(pkg.cache.env, pkgname, lib.install)) } # if we reach here, installation was a success -- GitLab