~alpine/users

2 2

Comparing alpine versions in go

Wagde Zabit <wagde@orca.security>
Details
Message ID
<E0BF9B24-2314-4FD6-B0F9-B82AE5E9FF09@orca.security>
DKIM signature
missing
Download raw message
I am trying to find a go package that compares two alpine packages version.
I tried many packages out there
github.com/mcuadros/go-version
github.com/knqyf263/go-rpm-version
github.com/Masterminds/semver
https://github.com/hashicorp/go-version
But none of them giving the right answer if I try to compare 1.6_rc1-r0 with 1.6-r0, all of them are returing that the rc1 is Greater or some of them can not parse the 1.6_rc1-r0 version
Are you aware of go package that can do the comparison in a proper way?

Thanx
Wagde
Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<20200426144710.7231596e0dabde2c70a9b87c@gmail.com>
In-Reply-To
<E0BF9B24-2314-4FD6-B0F9-B82AE5E9FF09@orca.security> (view parent)
DKIM signature
missing
Download raw message
> Are you aware of go package that can do the comparison in a proper way?

If you have apk installed on target system you can use "apk version -t VER1 VER2".
If not you'll have to port it yourself https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/src/version.c
Wagde Zabit <wagde@orca.security>
Details
Message ID
<7F535CF2-3773-4C89-B958-E5152352DEBA@orca.security>
In-Reply-To
<20200426144710.7231596e0dabde2c70a9b87c@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Thank

It was very helpful

I will implement it in go and go with it :-)


> On 26 Apr 2020, at 14:47, Konstantin Kulikov <k.kulikov2@gmail.com> wrote:
> 
>> Are you aware of go package that can do the comparison in a proper way?
> 
> If you have apk installed on target system you can use "apk version -t VER1 VER2".
> If not you'll have to port it yourself https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/src/version.c
Reply to thread Export thread (mbox)