From 508afe2c26737e0be60a72faa9d6740a06b0914c Mon Sep 17 00:00:00 2001 From: Ellen Marie Dash Date: Sat, 17 Aug 2019 04:45:09 +0000 Subject: [rubygems/rubygems] Set SOURCE_DATE_EPOCH env var if not provided. Fixes #2290. 1. `Gem::Specification.date` returns SOURCE_DATE_EPOCH when defined, 2. this commit makes RubyGems set it _persistently_ when not provided. This combination means that you can build a gem, check the build time, and use that value to generate a new build -- and then verify they're the same. https://github.com/rubygems/rubygems/commit/d830d53f59 --- lib/rubygems/specification.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/rubygems/specification.rb') diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index c023e4f4aa..b3db311cbf 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1667,7 +1667,7 @@ class Gem::Specification < Gem::BasicSpecification # https://reproducible-builds.org/specs/source-date-epoch/ def date - @date ||= ENV["SOURCE_DATE_EPOCH"] ? Time.utc(*Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc.to_a[3..5].reverse) : TODAY + @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse) end DateLike = Object.new # :nodoc: -- cgit v1.2.3