Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
….html#s-depsyntax (= version) is valid and also that is sematically more correct than (>= version) and (<< version+1) because your +1 guess is just that, a guess.
  • Loading branch information
specialunderwear committed Apr 12, 2012
1 parent 4d7c5ea commit 50bd59b
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions lib/fpm/package/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,7 @@ def fix_dependency(dep)

# Convert gem ~> X.Y.Z to '>= X.Y.Z' and << X.Y+1.0
if dep =~ /\(~>/
name, version = dep.gsub(/[()~>]/, "").split(/ +/)[0..1]
nextversion = version.split(".").collect { |v| v.to_i }
l = nextversion.length
nextversion[l-2] += 1
nextversion[l-1] = 0
nextversion = nextversion.join(".")
return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
elsif (m = dep.match(/(\S+)\s+\(= (.+)\)/))
# Convert 'foo (= x)' to 'foo (>= x)' and 'foo (<< x+1)'
name, version = m[1..2]
nextversion = version.split('.').collect { |v| v.to_i }
nextversion[-1] += 1
nextversion = nextversion.join(".")
return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
return "#{name} (= #{version})"
else
# otherwise the dep is probably fine
return dep
Expand Down

0 comments on commit 50bd59b

Please sign in to comment.