Package: r-base-dev
Version: 3.1.2-2
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: toolchain username timestamps

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that R packages could not be built reproducibly.

The username and build time gets written to the `Packaged` field in
`package.rds`. The build time also gets written to the `Built` field of
the `DESCRIPTION` file.

This data does not look very useful in the context of Debian packages.
The attached patch simply stops writing the `Packaged` field entirely
and remove the build time from the `Built` field. R packages can then be
built reproducibly according to some preliminary tests.

If this approach is seen as too broad, using the timestamp in the latest
debian/changelog entry through an environment variable would allow to
keep a timestamp. My current R skills are not up to such task, though.
The username should probably be removed or made constant in any cases.

 [1]: https://wiki.debian.org/ReproducibleBuilds

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
diff -u r-base-3.1.2/debian/changelog r-base-3.1.2/debian/changelog
--- r-base-3.1.2/debian/changelog
+++ r-base-3.1.2/debian/changelog
@@ -1,3 +1,11 @@
+r-base (3.1.2-2.0~reproducible1) UNRELEASED; urgency=low
+
+  * Stop writing a Packaged field when building a package as it was writing the
+    username and current time, preventing reproducible builds.
+  * Remove the build timestamp from the Built field for the same reason.
+
+ -- Jérémy Bobbio <lu...@debian.org>  Sat, 27 Dec 2014 17:23:50 +0000
+
 r-base (3.1.2-2) unstable; urgency=low
 
   * debian/control: Upgrade Build-Depends: to tcl and tk 8.6
only in patch2:
unchanged:
--- r-base-3.1.2.orig/src/library/tools/R/admin.R
+++ r-base-3.1.2/src/library/tools/R/admin.R
@@ -65,11 +65,7 @@
 	       paste(R.version[c("major", "minor")], collapse = "."),
 	       "; ",
 	       if(file_test("-d", file.path(dir, "src"))) OStype else "",
-	       "; ",
-	       ## Prefer date in ISO 8601 format, UTC.
-	       format(Sys.time(), tz = "UTC", usetz = TRUE),
-	       ## Sys.time(),
-	       "; ",
+	       "; ; ",
 	       .OStype())
 
     ## At some point of time, we had:
only in patch2:
unchanged:
--- r-base-3.1.2.orig/src/library/tools/R/build.R
+++ r-base-3.1.2/src/library/tools/R/build.R
@@ -149,18 +149,6 @@
             "Report bugs at bugs.r-project.org .", sep = "\n")
     }
 
-    add_build_stamp_to_description_file <- function(ldpath) {
-        db <- .read_description(ldpath)
-        ## this is an optional function, so could fail
-        user <- Sys.info()["user"]
-        if(user == "unknown") user <- Sys.getenv("LOGNAME")
-        db["Packaged"] <-
-            sprintf("%s; %s",
-                    format(Sys.time(), '', tz = 'UTC', usetz = TRUE),
-                    user)
-        .write_description(db, ldpath)
-    }
-
     ## <FIXME>
     ## This should really be combined with
     ## add_build_stamp_to_description_file().
@@ -930,9 +918,6 @@
         ## Fix permissions for all files to be at least 644, and dirs 755
         ## Not restricted by umask.
 	if (!WINDOWS) .Call(dirchmod, pkgname, group.writable=FALSE)
-        ## Add build stamp to the DESCRIPTION file.
-        add_build_stamp_to_description_file(file.path(pkgname,
-                                                      "DESCRIPTION"))
         ## Add expanded R fields to the DESCRIPTION file.
         add_expanded_R_fields_to_description_file(file.path(pkgname,
                                                             "DESCRIPTION"))

Attachment: signature.asc
Description: Digital signature

Reply via email to