We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4e457aa + 61650e5 commit 836d9f3Copy full SHA for 836d9f3
AUTHORS
@@ -74,5 +74,6 @@ List of contributors, in chronological order:
74
* JupiterRider (https://github.com/JupiterRider)
75
* Agustin Henze (https://github.com/agustinhenze)
76
* Tobias Assarsson (https://github.com/daedaluz)
77
+* Yaksh Bariya (https://github.com/thunder-coding)
78
* Juan Calderon-Perez (https://github.com/gaby)
79
* Ato Araki (https://github.com/atotto)
deb/version.go
@@ -30,14 +30,14 @@ func CompareVersions(ver1, ver2 string) int {
30
31
// parseVersions breaks down full version to components (possibly empty)
32
func parseVersion(ver string) (epoch, upstream, debian string) {
33
- i := strings.LastIndex(ver, "-")
+ i := strings.Index(ver, ":")
34
if i != -1 {
35
- debian, ver = ver[i+1:], ver[:i]
+ epoch, ver = ver[:i], ver[i+1:]
36
}
37
38
- i = strings.Index(ver, ":")
+ i = strings.Index(ver, "-")
39
40
- epoch, ver = ver[:i], ver[i+1:]
+ debian, ver = ver[i+1:], ver[:i]
41
42
43
upstream = ver
deb/version_test.go
@@ -20,10 +20,10 @@ func (s *VersionSuite) TestParseVersion(c *C) {
20
c.Check([]string{e, u, d}, DeepEquals, []string{"", "1.3.4", "1"})
21
22
e, u, d = parseVersion("1.3-pre4-1")
23
- c.Check([]string{e, u, d}, DeepEquals, []string{"", "1.3-pre4", "1"})
+ c.Check([]string{e, u, d}, DeepEquals, []string{"", "1.3", "pre4-1"})
24
25
e, u, d = parseVersion("4:1.3-pre4-1")
26
- c.Check([]string{e, u, d}, DeepEquals, []string{"4", "1.3-pre4", "1"})
+ c.Check([]string{e, u, d}, DeepEquals, []string{"4", "1.3", "pre4-1"})
27
28
29
func (s *VersionSuite) TestCompareLexicographic(c *C) {
@@ -100,6 +100,7 @@ func (s *VersionSuite) TestCompareVersions(c *C) {
100
c.Check(CompareVersions("1.0-133-avc", "1.0"), Equals, 1)
101
102
c.Check(CompareVersions("5.2.0.3", "5.2.0.283"), Equals, -1)
103
+ c.Check(CompareVersions("4.3.5a", "4.3.5-rc3-1"), Equals, 1)
104
105
106
func (s *VersionSuite) TestParseDependency(c *C) {
0 commit comments