Skip to content

Commit

Permalink
feat: support comparing Alpine versions locally (#980)
Browse files Browse the repository at this point in the history
This introduces support for comparing Alpine versions locally using the
same logic as the `apk` package manager, along with a generator for
generating fixtures.

There is a bit of fuzziness in the behaviour across different versions
of `apk` - the `alpine:3.x` docker images all use `apk` v2.x, which is
what the fixture generator uses too and at least `apk` v2.14 (which is
used by `alpine:3.19`) and v2.10 pass; however the current latest
upcoming version of `apk` technically fails on approximately 30 fixtures
which I think is because it has fixed
https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10088.

Beyond that I was able to find a handful of other edge cases where the
comparison results between these versions was different, but they all
seemed to be primarily around the handling of invalid versions which are
not expected to be present in OSV data anyway and they look to be the
result of bugfixes meaning we'd need special "anti" handling to support
in a way that ensures valid versions are still compared correctly, so I
think it's good enough to ship.

Resolves #952
  • Loading branch information
G-Rath committed May 28, 2024
1 parent 588dda2 commit 0550916
Show file tree
Hide file tree
Showing 6 changed files with 15,387 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/semantic/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ func TestVersion_Compare_Ecosystems(t *testing.T) {
name: "CRAN",
file: "cran-versions-generated.txt",
},
{
name: "Alpine",
file: "alpine-versions.txt",
},
{
name: "Alpine",
file: "alpine-versions-generated.txt",
},
}
for _, tt := range tests {
tt := tt
Expand Down
Loading

0 comments on commit 0550916

Please sign in to comment.