Class: Puppet::Util::Package::Version::Debian Private
- Includes:
- Comparable
- Defined in:
- lib/puppet/util/package/version/debian.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: ValidationFailure
Constant Summary collapse
- REGEX_EPOCH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Version string matching regexes
'(?:([0-9]+):)?'- REGEX_UPSTREAM_VERSION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
alphanumerics and the characters . + - ~ , starts with a digit, ~ only of debian_revision is present
'([\.\+~0-9a-zA-Z-]+?)'- REGEX_DEBIAN_REVISION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
alphanumerics and the characters + . ~
'(?:-([\.\+~0-9a-zA-Z]*))?'- REGEX_FULL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
REGEX_EPOCH + REGEX_UPSTREAM_VERSION + REGEX_DEBIAN_REVISION.freeze
- REGEX_FULL_RX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/\A#{REGEX_FULL}\Z/
Instance Attribute Summary collapse
- #debian_revision ⇒ Object readonly private
- #epoch ⇒ Object readonly private
- #upstream_version ⇒ Object readonly private
Class Method Summary collapse
- .parse(ver) ⇒ Object private
Instance Method Summary collapse
- #<=>(other) ⇒ Object private
- #eql?(other) ⇒ Boolean (also: #==) private
- #to_s ⇒ Object (also: #inspect) private
Instance Attribute Details
#debian_revision ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 |
# File 'lib/puppet/util/package/version/debian.rb', line 56 def debian_revision @debian_revision end |
#epoch ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 |
# File 'lib/puppet/util/package/version/debian.rb', line 56 def epoch @epoch end |
#upstream_version ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 |
# File 'lib/puppet/util/package/version/debian.rb', line 56 def upstream_version @upstream_version end |
Class Method Details
.parse(ver) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 |
# File 'lib/puppet/util/package/version/debian.rb', line 18 def self.parse(ver) raise ValidationFailure, "Unable to parse '#{ver}' as a string" unless ver.is_a?(String) match, epoch, upstream_version, debian_revision = *ver.match(REGEX_FULL_RX) raise ValidationFailure, "Unable to parse '#{ver}' as a debian version identifier" unless match new(epoch.to_i, upstream_version, debian_revision).freeze end |
Instance Method Details
#<=>(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/puppet/util/package/version/debian.rb', line 44 def <=>(other) return nil unless other.is_a?(self.class) cmp = @epoch <=> other.epoch if cmp == 0 cmp = compare_upstream_version(other) if cmp == 0 cmp = compare_debian_revision(other) end end cmp end |
#eql?(other) ⇒ Boolean Also known as: ==
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 |
# File 'lib/puppet/util/package/version/debian.rb', line 36 def eql?(other) other.is_a?(self.class) && @epoch.eql?(other.epoch) && @upstream_version.eql?(other.upstream_version) && @debian_revision.eql?(other.debian_revision) end |
#to_s ⇒ Object Also known as: inspect
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 |
# File 'lib/puppet/util/package/version/debian.rb', line 28 def to_s s = @upstream_version s = "#{@epoch}:#{s}" if @epoch != 0 s = "#{s}-#{@debian_revision}" if @debian_revision s end |