File: make-output-reproducible.patch

package info (click to toggle)
ruby-ronn 0.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 764 kB
  • sloc: ruby: 1,587; sh: 22; makefile: 9
file content (23 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From 7361d1e535cf4c07e4a9fa352e27e76e3cfaca58 Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Sat, 2 Jul 2016 21:11:41 +0200
Subject: [PATCH] Make the output reproducible.

When a document has not explicit date set, fallback to the SOURCE_DATE_EPOCH[0]
environment variable before using the current time.

 [0] https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
Signed-off-by: Antonio Terceiro <terceiro@debian.org>
--- a/lib/ronn/document.rb
+++ b/lib/ronn/document.rb
@@ -187,6 +187,8 @@
 
       return Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime if ENV['SOURCE_DATE_EPOCH']
 
+      return Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime if ENV['SOURCE_DATE_EPOCH']
+
       return File.mtime(path) if File.exist?(path)
 
       Time.now