[Pkg-puppet-devel] Bug#891263: puppet: please make the build reproducible

Chris Lamb lamby at debian.org
Fri Feb 23 22:40:19 UTC 2018


Source: puppet
Version: 5.4.0-1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps hostname
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that puppet could not be built reproducibly. This is because it
includes the current time in the manpages, as well as the build
host's domain name.

Patch attached.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/lib/puppet/defaults.rb	2018-02-23 22:03:04.353812204 +0000
--- b/lib/puppet/defaults.rb	2018-02-23 22:32:13.241364756 +0000
@@ -703,7 +703,7 @@
     # We have to downcase the fqdn, because the current ssl stuff (as opposed to in master) doesn't have good facilities for
     # manipulating naming.
     :certname => {
-      :default => lambda { Puppet::Settings.default_certname.downcase },
+      :default => lambda { ENV.has_key?('SOURCE_DATE_EPOCH') ? '(node\'s fully qualified domain name)' : Puppet::Settings.default_certname.downcase },
       :desc => "The name to use when handling certificates. When a node
         requests a certificate from the CA puppet master, it uses the value of the
         `certname` setting as its requested Subject CN.
--- a/lib/puppet/util/reference.rb	2018-02-23 22:03:04.349812169 +0000
--- b/lib/puppet/util/reference.rb	2018-02-23 22:25:12.937581256 +0000
@@ -2,6 +2,12 @@
 require 'puppet/util/methodhelper'
 require 'fileutils'
 
+if ENV['SOURCE_DATE_EPOCH'].nil?
+  $now = Time.now
+else
+  $now = Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime
+end
+
 # Manage Reference Documentation.
 class Puppet::Util::Reference
   include Puppet::Util
@@ -13,7 +19,7 @@
   instance_load(:reference, 'puppet/reference')
 
   def self.footer
-    "\n\n----------------\n\n" + _("*This page autogenerated on %{current_time}*\n") % { current_time: Time.now.to_s }
+    "\n\n----------------\n\n" + _("*This page autogenerated on %{current_time}*\n") % { current_time: $now.to_s }
   end
 
   def self.modes
@@ -112,7 +118,7 @@
     # First the header
     text = markdown_header(@title, 1)
     #TRANSLATORS message accompanied by date of generation
-    text << _("\n\n**This page is autogenerated; any changes will get overwritten** *(last generated on %{current_time})*\n\n") % { current_time: Time.now.to_s }
+    text << _("\n\n**This page is autogenerated; any changes will get overwritten** *(last generated on %{current_time})*\n\n") % { current_time: $now.to_s }
 
     text << @header
 


More information about the Pkg-puppet-devel mailing list