Skip to content

Commit

Permalink
Allow 4 digit version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Feb 5, 2018
1 parent 9202ee4 commit 7bf1110
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/libyui/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,21 @@ def spec_version(spec_filename)
def cmake_value(s, key)
e_key = Regexp.escape(key)
m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(s)
m[1]
m ? m[1] : nil
end

# Returns the CMake version from version file
# Returns the CMake version from the version file.
# VERSION_TWEAK is optional.
#
# @param [String] Version file (VERSION_CMAKE by default)
# @return [String] like "1.2.3"
# @return [String] like "1.2.3" or "1.2.3.4"
# @see VERSION_CMAKE
def cmake_version(file = nil)
f = File.read(file || VERSION_CMAKE)
[cmake_value(f, "VERSION_MAJOR"),
cmake_value(f, "VERSION_MINOR"),
cmake_value(f, "VERSION_PATCH")].join(".")
cmake_value(f, "VERSION_PATCH"),
cmake_value(f, "VERSION_TWEAK")].compact.join(".")
end
end
end
Expand Down

0 comments on commit 7bf1110

Please sign in to comment.