mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #41542 from thaJeztah/19.03_backport_fix_41517
This commit is contained in:
commit
b27122246a
2 changed files with 27 additions and 0 deletions
|
@ -56,6 +56,11 @@ func parseVersion(output string) (int, error) {
|
|||
words := strings.Split(lines[0], " ")
|
||||
version := words[len(words)-1]
|
||||
|
||||
// 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, ".")
|
||||
if len(v) == 0 || len(v) > 3 {
|
||||
|
|
|
@ -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.
|
||||
|
@ -59,6 +67,20 @@ Copyright 2009-2012 Canonical Ltd.
|
|||
`,
|
||||
version: 314159,
|
||||
},
|
||||
{
|
||||
output: `AppArmor parser version 3.0.0-beta1
|
||||
Copyright (C) 1999-2008 Novell Inc.
|
||||
Copyright 2009-2018 Canonical Ltd.
|
||||
`,
|
||||
version: 300000,
|
||||
},
|
||||
{
|
||||
output: `AppArmor parser version 3.0.0-beta1-foo-bar
|
||||
Copyright (C) 1999-2008 Novell Inc.
|
||||
Copyright 2009-2018 Canonical Ltd.
|
||||
`,
|
||||
version: 300000,
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range versions {
|
||||
|
|
Loading…
Reference in a new issue