Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- write specs to ensure the default epoch and release are always '1'

  This ensures future regressions are caught before fpm releases.

- rpm: if epoch is nil, default to 1. This fixes a regression where fpm
  0.4.3 generated rpms with an epoch of '1' and the fpm 0.4.17 (or
  somewhere in between) started generating rpms with no epoch value.
  This caused version comparisions of '15' and '10' to show '10' as
  newer if you built the version 10 one in older fpms.
  • Loading branch information...
commit d8f2ac7cb6735af44c0f356a65920bd2a96036c5 1 parent 85241b6
@jordansissel authored
Showing with 24 additions and 3 deletions.
  1. +5 −0 lib/fpm/package/rpm.rb
  2. +19 −3 spec/fpm/package/rpm_spec.rb
View
5 lib/fpm/package/rpm.rb
@@ -214,6 +214,11 @@ def build_sub_dir
#return File.join("BUILD", prefix)
end # def prefix
+ # The default epoch value must be 1 (backward compatibility for rpms built
+ # with fpm 0.4.3 and older)
+ def epoch
+ return @epoch || "1"
+ end # def epoch
def to_s(format=nil)
return super("NAME-VERSION-ITERATION.ARCH.TYPE") if format.nil?
View
22 spec/fpm/package/rpm_spec.rb
@@ -232,9 +232,7 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
@target = Tempfile.new("fpm-test-rpm").path
File.delete(@target)
subject.name = "name"
- subject.version = "123"
- subject.iteration = "100"
- subject.epoch = "5"
+ subject.version = "1.23"
end
after :each do
@@ -262,6 +260,24 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
# This will raise an exception if rpmbuild fails.
subject.output(@target)
end
+
+ it "should have some reasonable defaults that never change" do
+ subject.output(@target)
+ # Read the rpm
+ rpm = ::RPM::File.new(@target)
+
+ rpmtags = {}
+ rpm.header.tags.each do |tag|
+ rpmtags[tag.tag] = tag.value
+ end
+
+ # Default epoch must be '1'
+ # For some reason, epoch is an array of numbers in rpm?
+ insist { rpmtags[:epoch] } == [1]
+
+ # Default release must be '1'
+ insist { rpmtags[:release] } == "1"
+ end
end # regression stuff
describe "#output with digest and compression settings", :if => program_in_path?("rpmbuild") do
Please sign in to comment.
Something went wrong with that request. Please try again.