Permalink
Browse files

- fix #280 and hae a test verify it.

  • Loading branch information...
1 parent c0df808 commit d2e40bd38a0f65451d0556d18d3f1ac37c0f0759 @jordansissel committed Oct 26, 2012
Showing with 18 additions and 2 deletions.
  1. +9 −1 lib/fpm/package.rb
  2. +1 −0 lib/fpm/package/deb.rb
  3. +7 −0 spec/fpm/package/deb_spec.rb
  4. +1 −1 templates/deb.erb
View
@@ -502,9 +502,17 @@ def output_check(output_path)
end
end # def output_path
+ def provides=(value)
+ if !value.is_a?(Array)
+ @provides = [value]
+ else
+ @provides = value
+ end
+ end
+
# General public API
public(:type, :initialize, :convert, :input, :output, :to_s, :cleanup, :files,
- :version, :script)
+ :version, :script, :provides=)
# Package internal public api
public(:cleanup_staging, :cleanup_build, :staging_path, :converted_from,
@@ -170,6 +170,7 @@ def extract_info(package)
self.name = parse.call("Package")
self.url = parse.call("Homepage")
self.vendor = parse.call("Vendor") || self.vendor
+ self.provides = parse.call("Provides") || self.provides
# The description field is a special flower, parse it that way.
# The description is the first line as a normal Description field, but also continues
@@ -116,6 +116,8 @@
@original.architecture = "all"
@original.dependencies << "something > 10"
@original.dependencies << "hello >= 20"
+ @original.provides = "#{@original.name} = #{@original.version}"
+
@original.attributes[:deb_priority] = "fizzle"
@original.output(@target)
@@ -150,6 +152,11 @@
insist { @input.dependencies }.include?(dep)
end
end
+
+ it "should ignore versions and conditions in 'provides' (#280)" do
+ # Provides is an array because rpm supports multiple 'provides'
+ insist { @input.provides } == [ @original.name ]
+ end
end # package attributes
# This section mainly just verifies that 'dpkg-deb' can parse the package.
View
@@ -18,7 +18,7 @@ Conflicts: <%= conflicts.join(", ") %>
<% if !provides.empty? -%>
<%# Turn each provides from 'foo = 123' to simply 'foo' because Debian :\ -%>
<%# http://www.debian.org/doc/debian-policy/ch-relationships.html %>
-Provides: <%= provides.collect { |d| d.split(" ").first }.join(", ") %>
+Provides: <%= provides.first.split(" ").first %>
<% end -%>
<% if !replaces.empty? -%>
Replaces: <%= replaces.join(", ") %>

0 comments on commit d2e40bd

Please sign in to comment.