Permalink
Browse files

Merge pull request #312 from r4um/fix_263

* Fix #263 Convert != dependency as Conflict =, as rpm doesn't understand it
  • Loading branch information...
2 parents 2eadb83 + d62662b commit f62470f74172fa18ab86760730c65620930e25c9 @jordansissel committed Jan 2, 2013
Showing with 15 additions and 1 deletion.
  1. +2 −1 lib/fpm/package/python.rb
  2. +13 −0 lib/fpm/package/rpm.rb
@@ -190,13 +190,14 @@ def load_package_info(setup_py)
# requirements.txt can have dependencies, flags, and comments.
# We only want the comments, so remove comment and flag lines.
metadata["dependencies"] = File.read(requirements_txt).split("\n") \
+ .reject { |l| l =~ /^\s*$/ } \
.reject { |l| l =~ /^\s*#/ } \
.reject { |l| l =~ /^-/ } \
.map(&:strip)
end
self.dependencies += metadata["dependencies"].collect do |dep|
- dep_re = /^([^<>= ]+)\s*(?:([<>=]{1,2})\s*(.*))?$/
+ dep_re = /^([^<>!= ]+)\s*(?:([<>!=]{1,2})\s*(.*))?$/
match = dep_re.match(dep)
if match.nil?
@logger.error("Unable to parse dependency", :dependency => dep)
@@ -143,6 +143,19 @@ def converted_from(origin)
end
#self.provides << "rubygem(#{self.name})"
end
+
+ # Convert != dependency as Conflict =, as rpm doesn't understand !=
+ if origin == FPM::Package::Python
+ self.dependencies = self.dependencies.select do |dep|
+ name, op, version = dep.split(/\s+/)
+ dep_ok = true
+ if op == '!='
+ self.conflicts << "#{name} = #{version}"
+ dep_ok = false
+ end
+ dep_ok
+ end
+ end
end # def converted
def input(path)

0 comments on commit f62470f

Please sign in to comment.