Package: ruby-prawn / 2.4.0+dfsg-1~

0800_enable_manual_to_be_built_reproducibly.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Description: Enable manual to be built reproducibly
 In order to make the manual build reproducibly, we need a way to stop
 writing the current build time in it.
 .
 The following patch will allow this in two ways: if BUILD_DATE is set
 in the environment, the date will be taken from there; otherwise, if
 the Git index is available, the date of the last commit will be used.
Author: Jérémy Bobbio <lunar@debian.org>
Forwarded: https://github.com/prawnpdf/prawn/pull/844
Last-Update: 2019-01-07

--- a/manual/cover.rb
+++ b/manual/cover.rb
@@ -23,6 +23,8 @@
   )
 
   unless ENV['CI']
+    last_update = Time.at(ENV['BUILD_EPOCH'].to_i) if ENV['BUILD_EPOCH']
+    last_update ||= Time.at(`git log -1 --pretty='%ct'`.to_i)
     git_commit =
       if Dir.exist?("#{Prawn::BASEDIR}/.git")
         commit = `git show --pretty=%h`
@@ -33,7 +35,7 @@
 
     formatted_text_box(
       [{
-        text: "Last Update: #{Time.now.strftime('%Y-%m-%d')}\n" \
+        text: "Last Update: #{last_update.utc.strftime("%Y-%m-%d")}\n" \
           "Prawn Version: #{Prawn::VERSION}\n#{git_commit}",
         size: 12
       }],
--- a/manual/document_and_page_options/metadata.rb
+++ b/manual/document_and_page_options/metadata.rb
@@ -16,7 +16,7 @@
   Keywords: 'test metadata ruby pdf dry',
   Creator: 'ACME Soft App',
   Producer: 'Prawn',
-  CreationDate: Time.now
+  CreationDate: creation_date.utc
 }
 
 Prawn::Document.generate(filename, info: info) do