Skip to content

Commit ef739e9

Browse files
Merge pull request #758 from ackama:semantic/support-dots
PiperOrigin-RevId: 760563477
2 parents bed9869 + 103db05 commit ef739e9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

semantic/testdata/alpine-versions.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212

1313
1.2.3b > 1.2.0d
1414

15+
0.r1 < 0r2
16+
0..1..0 < 0..1..1
17+
0...1...0 < 0...1...1
18+
0...1...0.r1 < 0...1...0.r2
19+
0...1...0r1 < 0...1...0r2
20+
0..8 = 0..8
21+
0..8 > 0...8
22+
0.8.21.r2 > 0.8.21.r1
23+
10.2.24.r0 > 10.2.22.r0
24+
0.8.21.r2 < 0.8.21r2
25+
1526
# letters (invalid) - note on latest apk these are "<" but on 3.x line they're ">"
1627
1.2.0A < 1.2.0d
1728
1.2.0D < 1.2.0d

semantic/version-alpine.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ func parseAlpineNumberComponents(v *alpineVersion, str string) (string, error) {
255255
}
256256

257257
for i, d := range strings.Split(sub, ".") {
258+
// while technically not allowed by the spec, currently apk does not
259+
// consider it invalid to have a dot that isn't followed by a digit
260+
if d == "" {
261+
break
262+
}
263+
258264
value, err := convertToBigInt(d)
259265

260266
if err != nil {

0 commit comments

Comments
 (0)