Skip to content
Snippets Groups Projects
Commit ec181beb authored by Zbynek Slajchrt's avatar Zbynek Slajchrt
Browse files

FastR installs MRAN packages by default

parent 830e9224
No related branches found
No related tags found
No related merge requests found
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
eval(expression({
excludedPkgs <- c("rJava")
excludedPkgsMsgs <- c("CRAN rJava is not supported on FastR, but you can download and install rJava compatible replacement package from https://github.com/oracle/fastr/master/com.oracle.truffle.r.pkgs/rJava")
fastRPkgFilter <- function (av) {
# The following statement will assign the url of the FastR clone of rJava, when ready (possibly on GitHub).
#av["rJava","Repository"] <- "https://github.com/oracle/fastr/master/com.oracle.truffle.r.pkgs/rJava"
found <- rownames(av) %in% excludedPkgs
if (any(found)) {
av <- av[-which(found),]
}
av
}
options(available_packages_filters = list(add = TRUE, fastRPkgFilter))
getDependencies.original <- getDependencies
getDependencies <- function(pkgs, dependencies = NA, available = NULL, lib = .libPaths()[1L], binary = FALSE) {
res <- getDependencies.original(pkgs, dependencies, available, lib, binary)
found <- excludedPkgs %in% pkgs
if (any(found)) {
foundPkgMsgs <- excludedPkgsMsgs[which(found)]
warning(paste(foundPkgMsgs, collapse="\n"), call. = FALSE)
}
res
}
}), asNamespace("utils"))
\ No newline at end of file
......@@ -28,6 +28,7 @@ export FASTR_R_HOME=$(abspath $(TOPDIR)/..)
export FASTR_LIB_DIR=$(FASTR_R_HOME)/lib
export FASTR_NATIVE_DIR = $(TOPDIR)
export R_VERSION = 3.4.0
export DEFAULT_CRAN_MIRROR = "https://mran.microsoft.com/snapshot/2018-03-20"
export GNUR_HOME = $(TOPDIR)/gnur/patch-build
ifeq ($(FASTR_RFFI),llvm)
......
#
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -87,6 +87,9 @@ $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh
cp $(GNUR_HOME_BINARY)/etc/repositories $(FASTR_ETC_DIR)/repositories
cp $(GNUR_HOME_BINARY)/etc/ldpaths $(FASTR_ETC_DIR)/ldpaths
ed Makeconf.etc < edMakeconf.etc
echo $(DEFAULT_CRAN_MIRROR) > $(FASTR_ETC_DIR)/DEFAULT_CRAN_MIRROR
ifeq ($(FASTR_RFFI),llvm)
ed Makeconf.etc < edMakeconf.etc.llvm
cp $(LLVM_TOOLS) $(FASTR_BIN_DIR)
......
......@@ -303,6 +303,25 @@ public final class REnvVars implements RContext.ContextState {
return TimeZone.getDefault();
}
public static String getCRANMirror() {
String cranMirror = System.getenv("CRAN_MIRROR");
if (cranMirror == null) {
Path defCranMirrorPath = Paths.get(REnvVars.rHome()).resolve("etc").resolve("DEFAULT_CRAN_MIRROR");
if (!Files.exists(defCranMirrorPath)) {
throw RSuicide.rSuicide("Missing etc/DEFAULT_CRAN_MIRROR file");
}
List<String> cranMirrors;
try {
cranMirrors = Files.readAllLines(defCranMirrorPath);
} catch (IOException e) {
throw RSuicide.rSuicide("Invalid etc/DEFAULT_CRAN_MIRROR file");
}
assert !cranMirrors.isEmpty();
cranMirror = cranMirrors.get(0);
}
return cranMirror;
}
private String expandParameters(String value) {
StringBuilder result = new StringBuilder();
int x = 0;
......
......@@ -175,6 +175,11 @@ public class ROptions {
map.put("browserNLdisabled", RDataFactory.createSharedLogicalVectorFromScalar(false));
boolean cBoundsCheck = optionFromEnvVar("R_C_BOUNDS_CHECK", envVars);
map.put("CBoundsCheck", RDataFactory.createSharedLogicalVectorFromScalar(cBoundsCheck));
String cranMirror = REnvVars.getCRANMirror();
if (cranMirror != null) {
map.put("repos", cranMirror);
}
}
private static boolean optionFromEnvVar(String envVar, REnvVars envVars) {
......
#
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -304,6 +304,12 @@ set.repos <- function() {
} else if (name == "FASTR") {
# set the FastR internal repo
repos[["FASTR"]] <- paste0("file://", normalizePath("com.oracle.truffle.r.test.native/packages/repo"))
} else if (name == "SNAPSHOT") {
con <- file("etc/DEFAULT_CRAN_MIRROR", "r");
tryCatch({
cran.mirror <<- readLines(con)[[1]]
}, finally=function() close(con))
repos[["CRAN"]] <- cran.mirror
} else {
# User defined
repos[[name]] <- uri
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment