Commit d93a1849 authored by Antonio Terceiro's avatar Antonio Terceiro

dh_ruby: always use changelog date in gemspecs

parent 8f0dc106
......@@ -4,6 +4,9 @@ gem2deb (0.26.3) UNRELEASED; urgency=medium
- with -w/--overwrite, never overwrite debian/copyright, since it will be
always replace a human-reviewed debian/copyright with a completely dumb
boilerplate.
* dh_ruby:
- force generated gemspecs to use the date from debian/changelog to help
with build reproducibility
-- Antonio Terceiro <terceiro@debian.org> Wed, 02 Mar 2016 16:26:58 -0300
......
......@@ -15,6 +15,7 @@
require 'rubygems'
require 'rubygems/specification'
require 'time'
require 'yaml'
module Gem2Deb
......@@ -30,6 +31,7 @@ module Gem2Deb
Dir.chdir(source_dir) do
load_gemspec
end
set_gemspec_date
end
def has_native_extensions?
......@@ -113,6 +115,12 @@ module Gem2Deb
end
end
def set_gemspec_date
if @gemspec && File.exist?('debian/changelog')
@gemspec.date = Time.parse(`dpkg-parsechangelog -SDate`.strip)
end
end
# FIXME duplicated logic (see below)
def read_name_from(directory)
return nil if directory.nil?
......
......@@ -149,5 +149,15 @@ class MetaDataTest < Gem2DebTestCase
end
context 'timestamps' do
should 'use date from changelog if available' do
Dir.chdir('test/sample/install_as_gem') do
@metadata = Gem2Deb::Metadata.new('.')
end
# the gemspec only stores the date and zeroes the hour
assert_equal Time.parse('2015-11-20 00:00:00 UTC'), @metadata.gemspec.date
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment