1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Also trim "~..." from AppArmor versions

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
(cherry picked from commit 654cad4d9d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Tianon Gravi 2020-10-08 15:39:52 -07:00 committed by Sebastiaan van Stijn
parent ecd3baca25
commit 88eec2e811
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 10 additions and 0 deletions

View file

@ -58,6 +58,8 @@ func parseVersion(output string) (int, error) {
// trim "-beta1" suffix from version="3.0.0-beta1" if exists
version = strings.SplitN(version, "-", 2)[0]
// also trim "~..." suffix used historically (https://gitlab.com/apparmor/apparmor/-/commit/bca67d3d27d219d11ce8c9cc70612bd637f88c10)
version = strings.SplitN(version, "~", 2)[0]
// split by major minor version
v := strings.Split(version, ".")

View file

@ -43,6 +43,14 @@ Copyright 2009-2012 Canonical Ltd.
`,
version: 205000,
},
{
output: `AppArmor parser version 2.2.0~rc2
Copyright (C) 1999-2008 Novell Inc.
Copyright 2009-2012 Canonical Ltd.
`,
version: 202000,
},
{
output: `AppArmor parser version 2.9.95
Copyright (C) 1999-2008 Novell Inc.