Source: libavg
Version: 1.8.1-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps username hostname uname
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that libavg could not be built reproducibly.
The building username, hostname, platform and build time are embedded into
a binary.

The attached patch fixes this by using the date from the latest changelog entry
and replacing the username/hostname with a static value.

Regards,
 Reiner

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

diff --git a/debian/patches/reproducible_build.patch b/debian/patches/reproducible_build.patch
new file mode 100644
index 0000000..44e1f77
--- /dev/null
+++ b/debian/patches/reproducible_build.patch
@@ -0,0 +1,31 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Use reproducible values for builder and buildtime
+
+Index: libavg-1.8.1/CreateVersionFile.py
+===================================================================
+--- libavg-1.8.1.orig/CreateVersionFile.py
++++ libavg-1.8.1/CreateVersionFile.py
+@@ -113,10 +113,7 @@ def getSvnBranch():
+     return (url, branch)
+ 
+ def getBuilder():
+-    user = getpass.getuser()
+-    hostname = socket.gethostname()
+-    
+-    return '%s@%s %s' % (user, hostname, platform.platform())
++    return "debian"
+ 
+ def extractComponentFromM4(text, component):
+     match = re.search(r'%s\s*\].*\[\s*([A-Za-z0-9\.]+)\s*\]' % component, text, re.M)
+@@ -142,7 +139,10 @@ def assembleVersionInfo(major, minor, mi
+     revision = getSvnRevision()
+     branchurl, branch = getSvnBranch()
+     builder = getBuilder()
+-    buildtime = datetime.datetime.now().isoformat()
++    try:
++        buildtime = datetime.datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH'])).isoformat()
++    except (KeyError, ValueError):
++        buildtime = datetime.datetime.now().isoformat()
+     
+     if revision and branch:
+         fullVersion = '%s-%s/r%s' % (releaseVersion, branch, revision)
diff --git a/debian/patches/series b/debian/patches/series
index d3b650a..abe4148 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 foreign.patch
+reproducible_build.patch

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to