Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #364 Add rpm --rpm-ignore-iteration-in-dependencies dependency handling flag #508

Merged
merged 1 commit into from Aug 1, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/fpm/package/rpm.rb
Expand Up @@ -113,6 +113,11 @@ class FPM::Package::RPM < FPM::Package
next rpmbuild_filter_from_requires
end

option "--ignore-iteration-in-dependencies", :flag,
"For '=' (equal) dependencies, allow iterations on the specified " \
"version. Default is to be specific. This option allows the same " \
"version of a package but any iteration is permitted"

private

# Fix path name
Expand Down Expand Up @@ -229,6 +234,23 @@ def converted_from(origin)
end
end

# if --ignore-iteration-in-dependencies is true convert foo = X, to
# foo >= X , foo < X+1
if self.attributes[:rpm_ignore_iteration_in_dependencies?]
self.dependencies = self.dependencies.collect do |dep|
name, op, version = dep.split(/\s+/)
if op == '='
nextversion = version.split('.').collect { |v| v.to_i }
nextversion[-1] += 1
nextversion = nextversion.join(".")
@logger.warn("Converting dependency #{dep} to #{name} >= #{version}, #{name} < #{nextversion}")
["#{name} >= #{version}", "#{name} < #{nextversion}"]
else
dep
end
end.flatten
end

end # def converted

def input(path)
Expand Down