[r-base] 01/01: WIP: Generate reproducible output independently of the build path

Ximin Luo infinity0 at debian.org
Tue May 2 12:03:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch pu/reproducible-builds
in repository r-base.

commit dd12ca12c0dd07419d41ca673868447b7d54fed7
Author: Ximin Luo <infinity0 at debian.org>
Date:   Tue May 2 14:03:02 2017 +0200

    WIP: Generate reproducible output independently of the build path
    
    Work In Progress; this causes 460/477 packages to be reproducible but also causes 3/477 to FTBFS
    
    https://tests.reproducible-builds.org/debian/issues/unstable/randomness_in_r_rdb_rds_databases_issue.html
---
 debian/changelog                   | 7 +++++++
 src/library/base/R/namespace.R     | 9 +++++----
 src/library/tools/R/admin.R        | 1 -
 src/library/tools/R/makeLazyLoad.R | 2 +-
 src/library/tools/R/parseRd.R      | 1 +
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 56377f8..7d3599b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+r-base (3.4.0-1.0~reproducible1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Generate output reproducibly, independently of the build path.
+
+ -- Ximin Luo <infinity0 at debian.org>  Thu, 20 Apr 2017 22:13:43 +0200
+
 r-base (3.4.0-1) unstable; urgency=medium
 
   * New upstream version released this morning
diff --git a/src/library/base/R/namespace.R b/src/library/base/R/namespace.R
index 7f4731b..e82c612 100644
--- a/src/library/base/R/namespace.R
+++ b/src/library/base/R/namespace.R
@@ -192,7 +192,8 @@ dynGet <- function(x, ifnotfound = stop(gettextf("%s not found",
 
 loadNamespace <- function (package, lib.loc = NULL,
                            keep.source = getOption("keep.source.pkgs"),
-                           partial = FALSE, versionCheck = NULL)
+                           partial = FALSE, versionCheck = NULL,
+                           relpath = FALSE)
 {
     libpath <- attr(package, "LibPath")
     package <- as.character(package)[[1L]]
@@ -248,9 +249,9 @@ loadNamespace <- function (package, lib.loc = NULL,
             attr(dimpenv, "name") <- paste0("lazydata:", name)
             setNamespaceInfo(env, "lazydata", dimpenv)
             setNamespaceInfo(env, "imports", list("base" = TRUE))
-            ## this should be an absolute path
-            setNamespaceInfo(env, "path",
-                             normalizePath(file.path(lib, name), "/", TRUE))
+            path <- if (relpath) file.path(".", name)
+            else normalizePath(file.path(lib, name), "/", TRUE)
+            setNamespaceInfo(env, "path", path)
             setNamespaceInfo(env, "dynlibs", NULL)
             setNamespaceInfo(env, "S3methods", matrix(NA_character_, 0L, 3L))
             env$.__S3MethodsTable__. <-
diff --git a/src/library/tools/R/admin.R b/src/library/tools/R/admin.R
index dba6c68..cdaa0c0 100644
--- a/src/library/tools/R/admin.R
+++ b/src/library/tools/R/admin.R
@@ -788,7 +788,6 @@ function(dir, packages)
 .install_package_Rd_objects <-
 function(dir, outDir, encoding = "unknown")
 {
-    dir <- file_path_as_absolute(dir)
     mandir <- file.path(dir, "man")
     manfiles <- if(!dir.exists(mandir)) character()
     else list_files_with_type(mandir, "docs")
diff --git a/src/library/tools/R/makeLazyLoad.R b/src/library/tools/R/makeLazyLoad.R
index ad0da95..8aeb36f 100644
--- a/src/library/tools/R/makeLazyLoad.R
+++ b/src/library/tools/R/makeLazyLoad.R
@@ -28,7 +28,7 @@ code2LazyLoadDB <-
     if (packageHasNamespace(package, dirname(pkgpath))) {
         if (! is.null(.getNamespace(as.name(package))))
             stop("namespace must not be already loaded")
-        ns <- suppressPackageStartupMessages(loadNamespace(package, lib.loc, keep.source, partial = TRUE))
+        ns <- suppressPackageStartupMessages(loadNamespace(package, lib.loc, keep.source, partial = TRUE, relpath = TRUE))
         makeLazyLoadDB(ns, dbbase, compress = compress)
     }
     else
diff --git a/src/library/tools/R/parseRd.R b/src/library/tools/R/parseRd.R
index 0ae91b2..138c634 100644
--- a/src/library/tools/R/parseRd.R
+++ b/src/library/tools/R/parseRd.R
@@ -63,6 +63,7 @@ parse_Rd <- function(file, srcfile = NULL, encoding = "unknown",
     basename <- basename(srcfile$filename)
     srcfile$encoding <- encoding
     srcfile$Enc <- "UTF-8"
+    srcfile$wd <- "."
 
     if (encoding == "ASCII") {
         if (any(is.na(iconv(lines, "", "ASCII"))))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/r-base.git



More information about the Reproducible-commits mailing list