Package importer fixed
This commit is contained in:
parent
a7c8f08972
commit
c67f3062dc
2 changed files with 35 additions and 30 deletions
|
|
@ -150,7 +150,7 @@ module DebImporter
|
|||
end # def
|
||||
|
||||
class Version
|
||||
attr_reader :epoch, :version, :revision
|
||||
attr_reader :epoch, :version, :revision, :version_string
|
||||
|
||||
def initialize(version_string)
|
||||
@version_string = version_string
|
||||
|
|
@ -164,14 +164,15 @@ module DebImporter
|
|||
end # /def
|
||||
|
||||
def to_s
|
||||
@version
|
||||
@version_string
|
||||
end
|
||||
|
||||
def >(other)
|
||||
dpkg_compare_version(@version_string, other)
|
||||
# return true if a.epoch > b.epoch
|
||||
# return true if version_compare(a.version, b.version)
|
||||
# return true if version_compare(a.revision, b.revision)
|
||||
dpkg_compare_version(@version_string, other, 'gt')
|
||||
end
|
||||
|
||||
def <(other)
|
||||
dpkg_compare_version(@version_string, other, 'lt')
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -184,7 +185,7 @@ module DebImporter
|
|||
# The algorithm is described in the Debian Policy at
|
||||
# https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
|
||||
# The reference implementation is "dpkg --compare-versions …"
|
||||
def dpkg_compare_version(v1, v2, op: 'gt')
|
||||
def dpkg_compare_version(v1, v2, op)
|
||||
system("dpkg --compare-versions #{v1} #{op} #{v2}")
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue