Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Add --rpm-os flag for #309

- Add tests to cover
  • Loading branch information...
commit dfd032a4c3bce21c761f59d04436ca5b750f6ce5 1 parent 5f07687
@jordansissel authored
Showing with 16 additions and 1 deletion.
  1. +11 −1 lib/fpm/package/rpm.rb
  2. +5 −0 spec/fpm/package/rpm_spec.rb
View
12 lib/fpm/package/rpm.rb
@@ -66,6 +66,11 @@ class FPM::Package::RPM < FPM::Package
value.downcase
end
+ # TODO(sissel): Try to be smart about the default OS.
+ # issue #309
+ option "--os", "OS", "The operating system to target this rpm for. " \
+ "You want to set this to 'linux' if you are using fpm on OS X, for example"
+
private
# Handle any architecture naming conversions.
@@ -190,7 +195,12 @@ def output(output_path)
"--define", "buildroot #{build_path}/BUILD",
"--define", "_topdir #{build_path}",
"--define", "_sourcedir #{build_path}",
- "--define", "_rpmdir #{build_path}/RPMS"]
+ "--define", "_rpmdir #{build_path}/RPMS",
+ ]
+
+ # issue #309
+ rpm_target = "#{architecture}-unknown-#{attributes[:rpm_os]}"
+ args += ["--target", rpm_target]
(attributes[:rpm_rpmbuild_define] or []).each do |define|
args += ["--define", define]
View
5 spec/fpm/package/rpm_spec.rb
@@ -117,6 +117,7 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
subject.dependencies << "something > 10"
subject.dependencies << "hello >= 20"
subject.conflicts << "bad < 2"
+ subject.attributes[:rpm_os] = "fancypants"
# Make sure multi-line licenses are hacked to work in rpm (#252)
subject.license = "this\nis\nan\example"
@@ -149,6 +150,10 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
insist { @rpmtags[:name] } == subject.name
end
+ it "should obey the os attribute" do
+ insist { @rpmtags[:os] } == subject.attributes[:rpm_os]
+ end
+
it "should have the correct version" do
insist { @rpmtags[:version] } == subject.version
end
Please sign in to comment.
Something went wrong with that request. Please try again.