Skip to content

Commit

Permalink
Merge pull request #312 from r4um/fix_263
Browse files Browse the repository at this point in the history
* Fix #263 Convert != dependency as Conflict =, as rpm doesn't understand it
  • Loading branch information
jordansissel committed Jan 2, 2013
2 parents 2eadb83 + d62662b commit f62470f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fpm/package/python.rb
Expand Up @@ -190,13 +190,14 @@ def load_package_info(setup_py)
# requirements.txt can have dependencies, flags, and comments. # requirements.txt can have dependencies, flags, and comments.
# We only want the comments, so remove comment and flag lines. # We only want the comments, so remove comment and flag lines.
metadata["dependencies"] = File.read(requirements_txt).split("\n") \ metadata["dependencies"] = File.read(requirements_txt).split("\n") \
.reject { |l| l =~ /^\s*$/ } \
.reject { |l| l =~ /^\s*#/ } \ .reject { |l| l =~ /^\s*#/ } \
.reject { |l| l =~ /^-/ } \ .reject { |l| l =~ /^-/ } \
.map(&:strip) .map(&:strip)
end end


self.dependencies += metadata["dependencies"].collect do |dep| self.dependencies += metadata["dependencies"].collect do |dep|
dep_re = /^([^<>= ]+)\s*(?:([<>=]{1,2})\s*(.*))?$/ dep_re = /^([^<>!= ]+)\s*(?:([<>!=]{1,2})\s*(.*))?$/
match = dep_re.match(dep) match = dep_re.match(dep)
if match.nil? if match.nil?
@logger.error("Unable to parse dependency", :dependency => dep) @logger.error("Unable to parse dependency", :dependency => dep)
Expand Down
13 changes: 13 additions & 0 deletions lib/fpm/package/rpm.rb
Expand Up @@ -143,6 +143,19 @@ def converted_from(origin)
end end
#self.provides << "rubygem(#{self.name})" #self.provides << "rubygem(#{self.name})"
end 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 end # def converted


def input(path) def input(path)
Expand Down

0 comments on commit f62470f

Please sign in to comment.