Use package upstream version. Skip revision. Improve regexp parsing.
This commit is contained in:
parent
56750c3884
commit
4a9fe8772e
3 changed files with 33 additions and 6 deletions
|
|
@ -150,16 +150,16 @@ module DebImporter
|
|||
end # def
|
||||
|
||||
class Version
|
||||
attr_reader :epoch, :version, :revision, :version_string
|
||||
attr_reader :epoch, :upstream, :revision, :version_string
|
||||
|
||||
def initialize(version_string)
|
||||
@version_string = version_string
|
||||
# Split into "[epoch:]version[-revision]"
|
||||
unless /^(?<epoch>(\d+)\:)?(?<version>.+)(?<revision>\-[\+\.~]+)?/ =~ version_string
|
||||
unless /^((?<epoch>\d+)\:)?(?<upstream>.+?)(\-(?<revision>.+))?$/ =~ version_string
|
||||
raise ArgumentError, "Cannot parse version string: #{version_string}"
|
||||
end
|
||||
@epoch = epoch ? epoch : 0
|
||||
@version = version
|
||||
@epoch = epoch ? epoch : '0'
|
||||
@upstream = upstream
|
||||
@revision = revision if revision
|
||||
end # /def
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue