Update godeps.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
55545ef83f
commit
48118ae086
31
Godeps/Godeps.json
generated
31
Godeps/Godeps.json
generated
@ -18,8 +18,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/blang/semver",
|
"ImportPath": "github.com/blang/semver",
|
||||||
"Comment": "v3.0.1",
|
"Comment": "v3.1.0",
|
||||||
"Rev": "31b736133b98f26d5e078ec9eb591666edfd091f"
|
"Rev": "aea32c919a18e5ef4537bbd283ff29594b1b0165"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/boltdb/bolt",
|
"ImportPath": "github.com/boltdb/bolt",
|
||||||
@ -153,12 +153,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/distribution/digestset",
|
"ImportPath": "github.com/docker/distribution/digestset",
|
||||||
"Comment": "v2.6.0-rc.1-130-gb38e5838",
|
"Comment": "v2.6.0-rc.1-130-gb38e583",
|
||||||
"Rev": "b38e5838b7b2f2ad48e06ec4b500011976080621"
|
"Rev": "b38e5838b7b2f2ad48e06ec4b500011976080621"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/distribution/reference",
|
"ImportPath": "github.com/docker/distribution/reference",
|
||||||
"Comment": "v2.6.0-rc.1-130-gb38e5838",
|
"Comment": "v2.6.0-rc.1-130-gb38e583",
|
||||||
"Rev": "b38e5838b7b2f2ad48e06ec4b500011976080621"
|
"Rev": "b38e5838b7b2f2ad48e06ec4b500011976080621"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -178,27 +178,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/gogoproto",
|
"ImportPath": "github.com/gogo/protobuf/gogoproto",
|
||||||
"Comment": "v0.3-150-gd2e1ade2",
|
"Comment": "v0.3-150-gd2e1ade",
|
||||||
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/proto",
|
"ImportPath": "github.com/gogo/protobuf/proto",
|
||||||
"Comment": "v0.3-150-gd2e1ade2",
|
"Comment": "v0.3-150-gd2e1ade",
|
||||||
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/descriptor",
|
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/descriptor",
|
||||||
"Comment": "v0.3-150-gd2e1ade2",
|
"Comment": "v0.3-150-gd2e1ade",
|
||||||
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/sortkeys",
|
"ImportPath": "github.com/gogo/protobuf/sortkeys",
|
||||||
"Comment": "v0.3-150-gd2e1ade2",
|
"Comment": "v0.3-150-gd2e1ade",
|
||||||
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/types",
|
"ImportPath": "github.com/gogo/protobuf/types",
|
||||||
"Comment": "v0.3-150-gd2e1ade2",
|
"Comment": "v0.3-150-gd2e1ade",
|
||||||
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
"Rev": "d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -238,7 +238,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/opencontainers/runc/libcontainer/system",
|
"ImportPath": "github.com/opencontainers/runc/libcontainer/system",
|
||||||
"Comment": "v1.0.0-rc3-21-g50401b5b",
|
"Comment": "v1.0.0-rc3-21-g50401b5",
|
||||||
"Rev": "50401b5b4c2e01e4f1372b73a021742deeaf4e2d"
|
"Rev": "50401b5b4c2e01e4f1372b73a021742deeaf4e2d"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -248,15 +248,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/opencontainers/runtime-tools/generate",
|
"ImportPath": "github.com/opencontainers/runtime-tools/generate",
|
||||||
"Rev": "8addcc695096a0fc61010af8766952546bba7cd0"
|
"Rev": "68c195c3f2fa04a9a298b839eb2d94f31141271a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/opencontainers/runtime-tools/generate/seccomp",
|
"ImportPath": "github.com/opencontainers/runtime-tools/generate/seccomp",
|
||||||
"Rev": "8addcc695096a0fc61010af8766952546bba7cd0"
|
"Rev": "68c195c3f2fa04a9a298b839eb2d94f31141271a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/opencontainers/runtime-tools/validate",
|
"ImportPath": "github.com/opencontainers/runtime-tools/validate",
|
||||||
"Rev": "8addcc695096a0fc61010af8766952546bba7cd0"
|
"Rev": "68c195c3f2fa04a9a298b839eb2d94f31141271a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/pkg/errors",
|
"ImportPath": "github.com/pkg/errors",
|
||||||
@ -265,6 +265,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/pmezard/go-difflib/difflib",
|
"ImportPath": "github.com/pmezard/go-difflib/difflib",
|
||||||
|
"Comment": "v1.0.0",
|
||||||
"Rev": "792786c7400a136282c1664665ae0a8db921c6c2"
|
"Rev": "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -399,12 +400,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime",
|
"ImportPath": "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime",
|
||||||
"Comment": "v1.7.0-alpha.1-493-g32e927f4d8",
|
"Comment": "v1.7.0-alpha.1-493-g32e927f",
|
||||||
"Rev": "32e927f4d86cfe7d3a7ad3c231fc445fb01463f5"
|
"Rev": "32e927f4d86cfe7d3a7ad3c231fc445fb01463f5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/kubernetes/pkg/util/interrupt",
|
"ImportPath": "k8s.io/kubernetes/pkg/util/interrupt",
|
||||||
"Comment": "v1.7.0-alpha.1-493-g32e927f4d8",
|
"Comment": "v1.7.0-alpha.1-493-g32e927f",
|
||||||
"Rev": "32e927f4d86cfe7d3a7ad3c231fc445fb01463f5"
|
"Rev": "32e927f4d86cfe7d3a7ad3c231fc445fb01463f5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
77
vendor/github.com/blang/semver/README.md
generated
vendored
77
vendor/github.com/blang/semver/README.md
generated
vendored
@ -40,10 +40,52 @@ Features
|
|||||||
- Comparator-like comparisons
|
- Comparator-like comparisons
|
||||||
- Compare Helper Methods
|
- Compare Helper Methods
|
||||||
- InPlace manipulation
|
- InPlace manipulation
|
||||||
|
- Ranges `>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1`
|
||||||
- Sortable (implements sort.Interface)
|
- Sortable (implements sort.Interface)
|
||||||
- database/sql compatible (sql.Scanner/Valuer)
|
- database/sql compatible (sql.Scanner/Valuer)
|
||||||
- encoding/json compatible (json.Marshaler/Unmarshaler)
|
- encoding/json compatible (json.Marshaler/Unmarshaler)
|
||||||
|
|
||||||
|
Ranges
|
||||||
|
------
|
||||||
|
|
||||||
|
A `Range` is a set of conditions which specify which versions satisfy the range.
|
||||||
|
|
||||||
|
A condition is composed of an operator and a version. The supported operators are:
|
||||||
|
|
||||||
|
- `<1.0.0` Less than `1.0.0`
|
||||||
|
- `<=1.0.0` Less than or equal to `1.0.0`
|
||||||
|
- `>1.0.0` Greater than `1.0.0`
|
||||||
|
- `>=1.0.0` Greater than or equal to `1.0.0`
|
||||||
|
- `1.0.0`, `=1.0.0`, `==1.0.0` Equal to `1.0.0`
|
||||||
|
- `!1.0.0`, `!=1.0.0` Not equal to `1.0.0`. Excludes version `1.0.0`.
|
||||||
|
|
||||||
|
A `Range` can link multiple `Ranges` separated by space:
|
||||||
|
|
||||||
|
Ranges can be linked by logical AND:
|
||||||
|
|
||||||
|
- `>1.0.0 <2.0.0` would match between both ranges, so `1.1.1` and `1.8.7` but not `1.0.0` or `2.0.0`
|
||||||
|
- `>1.0.0 <3.0.0 !2.0.3-beta.2` would match every version between `1.0.0` and `3.0.0` except `2.0.3-beta.2`
|
||||||
|
|
||||||
|
Ranges can also be linked by logical OR:
|
||||||
|
|
||||||
|
- `<2.0.0 || >=3.0.0` would match `1.x.x` and `3.x.x` but not `2.x.x`
|
||||||
|
|
||||||
|
AND has a higher precedence than OR. It's not possible to use brackets.
|
||||||
|
|
||||||
|
Ranges can be combined by both AND and OR
|
||||||
|
|
||||||
|
- `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
|
||||||
|
|
||||||
|
Range usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
v, err := semver.Parse("1.2.3")
|
||||||
|
range, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0")
|
||||||
|
if range(v) {
|
||||||
|
//valid
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-----
|
-----
|
||||||
@ -103,23 +145,30 @@ if err != nil {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Benchmarks
|
Benchmarks
|
||||||
-----
|
-----
|
||||||
|
|
||||||
BenchmarkParseSimple 5000000 328 ns/op 49 B/op 1 allocs/op
|
BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op
|
||||||
BenchmarkParseComplex 1000000 2105 ns/op 263 B/op 7 allocs/op
|
BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op
|
||||||
BenchmarkParseAverage 1000000 1301 ns/op 168 B/op 4 allocs/op
|
BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op
|
||||||
BenchmarkStringSimple 10000000 130 ns/op 5 B/op 1 allocs/op
|
BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op
|
||||||
BenchmarkStringLarger 5000000 280 ns/op 32 B/op 2 allocs/op
|
BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op
|
||||||
BenchmarkStringComplex 3000000 512 ns/op 80 B/op 3 allocs/op
|
BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op
|
||||||
BenchmarkStringAverage 5000000 387 ns/op 47 B/op 2 allocs/op
|
BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op
|
||||||
BenchmarkValidateSimple 500000000 7.92 ns/op 0 B/op 0 allocs/op
|
BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkValidateComplex 2000000 923 ns/op 0 B/op 0 allocs/op
|
BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkValidateAverage 5000000 452 ns/op 0 B/op 0 allocs/op
|
BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkCompareSimple 100000000 11.2 ns/op 0 B/op 0 allocs/op
|
BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkCompareComplex 50000000 40.9 ns/op 0 B/op 0 allocs/op
|
BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkCompareAverage 50000000 43.8 ns/op 0 B/op 0 allocs/op
|
BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkSort 5000000 436 ns/op 259 B/op 2 allocs/op
|
BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op
|
||||||
|
BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op
|
||||||
|
BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op
|
||||||
|
BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op
|
||||||
|
BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op
|
||||||
|
BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op
|
||||||
|
BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op
|
||||||
|
|
||||||
See benchmark cases at [semver_test.go](semver_test.go)
|
See benchmark cases at [semver_test.go](semver_test.go)
|
||||||
|
|
||||||
|
224
vendor/github.com/blang/semver/range.go
generated
vendored
Normal file
224
vendor/github.com/blang/semver/range.go
generated
vendored
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
package semver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"unicode"
|
||||||
|
)
|
||||||
|
|
||||||
|
type comparator func(Version, Version) bool
|
||||||
|
|
||||||
|
var (
|
||||||
|
compEQ comparator = func(v1 Version, v2 Version) bool {
|
||||||
|
return v1.Compare(v2) == 0
|
||||||
|
}
|
||||||
|
compNE = func(v1 Version, v2 Version) bool {
|
||||||
|
return v1.Compare(v2) != 0
|
||||||
|
}
|
||||||
|
compGT = func(v1 Version, v2 Version) bool {
|
||||||
|
return v1.Compare(v2) == 1
|
||||||
|
}
|
||||||
|
compGE = func(v1 Version, v2 Version) bool {
|
||||||
|
return v1.Compare(v2) >= 0
|
||||||
|
}
|
||||||
|
compLT = func(v1 Version, v2 Version) bool {
|
||||||
|
return v1.Compare(v2) == -1
|
||||||
|
}
|
||||||
|
compLE = func(v1 Version, v2 Version) bool {
|
||||||
|
return v1.Compare(v2) <= 0
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
type versionRange struct {
|
||||||
|
v Version
|
||||||
|
c comparator
|
||||||
|
}
|
||||||
|
|
||||||
|
// rangeFunc creates a Range from the given versionRange.
|
||||||
|
func (vr *versionRange) rangeFunc() Range {
|
||||||
|
return Range(func(v Version) bool {
|
||||||
|
return vr.c(v, vr.v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Range represents a range of versions.
|
||||||
|
// A Range can be used to check if a Version satisfies it:
|
||||||
|
//
|
||||||
|
// range, err := semver.ParseRange(">1.0.0 <2.0.0")
|
||||||
|
// range(semver.MustParse("1.1.1") // returns true
|
||||||
|
type Range func(Version) bool
|
||||||
|
|
||||||
|
// OR combines the existing Range with another Range using logical OR.
|
||||||
|
func (rf Range) OR(f Range) Range {
|
||||||
|
return Range(func(v Version) bool {
|
||||||
|
return rf(v) || f(v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// AND combines the existing Range with another Range using logical AND.
|
||||||
|
func (rf Range) AND(f Range) Range {
|
||||||
|
return Range(func(v Version) bool {
|
||||||
|
return rf(v) && f(v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseRange parses a range and returns a Range.
|
||||||
|
// If the range could not be parsed an error is returned.
|
||||||
|
//
|
||||||
|
// Valid ranges are:
|
||||||
|
// - "<1.0.0"
|
||||||
|
// - "<=1.0.0"
|
||||||
|
// - ">1.0.0"
|
||||||
|
// - ">=1.0.0"
|
||||||
|
// - "1.0.0", "=1.0.0", "==1.0.0"
|
||||||
|
// - "!1.0.0", "!=1.0.0"
|
||||||
|
//
|
||||||
|
// A Range can consist of multiple ranges separated by space:
|
||||||
|
// Ranges can be linked by logical AND:
|
||||||
|
// - ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0"
|
||||||
|
// - ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2
|
||||||
|
//
|
||||||
|
// Ranges can also be linked by logical OR:
|
||||||
|
// - "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x"
|
||||||
|
//
|
||||||
|
// AND has a higher precedence than OR. It's not possible to use brackets.
|
||||||
|
//
|
||||||
|
// Ranges can be combined by both AND and OR
|
||||||
|
//
|
||||||
|
// - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
|
||||||
|
func ParseRange(s string) (Range, error) {
|
||||||
|
parts := splitAndTrim(s)
|
||||||
|
orParts, err := splitORParts(parts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var orFn Range
|
||||||
|
for _, p := range orParts {
|
||||||
|
var andFn Range
|
||||||
|
for _, ap := range p {
|
||||||
|
opStr, vStr, err := splitComparatorVersion(ap)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
vr, err := buildVersionRange(opStr, vStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Could not parse Range %q: %s", ap, err)
|
||||||
|
}
|
||||||
|
rf := vr.rangeFunc()
|
||||||
|
|
||||||
|
// Set function
|
||||||
|
if andFn == nil {
|
||||||
|
andFn = rf
|
||||||
|
} else { // Combine with existing function
|
||||||
|
andFn = andFn.AND(rf)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if orFn == nil {
|
||||||
|
orFn = andFn
|
||||||
|
} else {
|
||||||
|
orFn = orFn.OR(andFn)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return orFn, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitORParts splits the already cleaned parts by '||'.
|
||||||
|
// Checks for invalid positions of the operator and returns an
|
||||||
|
// error if found.
|
||||||
|
func splitORParts(parts []string) ([][]string, error) {
|
||||||
|
var ORparts [][]string
|
||||||
|
last := 0
|
||||||
|
for i, p := range parts {
|
||||||
|
if p == "||" {
|
||||||
|
if i == 0 {
|
||||||
|
return nil, fmt.Errorf("First element in range is '||'")
|
||||||
|
}
|
||||||
|
ORparts = append(ORparts, parts[last:i])
|
||||||
|
last = i + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if last == len(parts) {
|
||||||
|
return nil, fmt.Errorf("Last element in range is '||'")
|
||||||
|
}
|
||||||
|
ORparts = append(ORparts, parts[last:])
|
||||||
|
return ORparts, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildVersionRange takes a slice of 2: operator and version
|
||||||
|
// and builds a versionRange, otherwise an error.
|
||||||
|
func buildVersionRange(opStr, vStr string) (*versionRange, error) {
|
||||||
|
c := parseComparator(opStr)
|
||||||
|
if c == nil {
|
||||||
|
return nil, fmt.Errorf("Could not parse comparator %q in %q", opStr, strings.Join([]string{opStr, vStr}, ""))
|
||||||
|
}
|
||||||
|
v, err := Parse(vStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Could not parse version %q in %q: %s", vStr, strings.Join([]string{opStr, vStr}, ""), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &versionRange{
|
||||||
|
v: v,
|
||||||
|
c: c,
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitAndTrim splits a range string by spaces and cleans leading and trailing spaces
|
||||||
|
func splitAndTrim(s string) (result []string) {
|
||||||
|
last := 0
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
if s[i] == ' ' {
|
||||||
|
if last < i-1 {
|
||||||
|
result = append(result, s[last:i])
|
||||||
|
}
|
||||||
|
last = i + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if last < len(s)-1 {
|
||||||
|
result = append(result, s[last:])
|
||||||
|
}
|
||||||
|
// parts := strings.Split(s, " ")
|
||||||
|
// for _, x := range parts {
|
||||||
|
// if s := strings.TrimSpace(x); len(s) != 0 {
|
||||||
|
// result = append(result, s)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitComparatorVersion splits the comparator from the version.
|
||||||
|
// Spaces between the comparator and the version are not allowed.
|
||||||
|
// Input must be free of leading or trailing spaces.
|
||||||
|
func splitComparatorVersion(s string) (string, string, error) {
|
||||||
|
i := strings.IndexFunc(s, unicode.IsDigit)
|
||||||
|
if i == -1 {
|
||||||
|
return "", "", fmt.Errorf("Could not get version from string: %q", s)
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(s[0:i]), s[i:], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseComparator(s string) comparator {
|
||||||
|
switch s {
|
||||||
|
case "==":
|
||||||
|
fallthrough
|
||||||
|
case "":
|
||||||
|
fallthrough
|
||||||
|
case "=":
|
||||||
|
return compEQ
|
||||||
|
case ">":
|
||||||
|
return compGT
|
||||||
|
case ">=":
|
||||||
|
return compGE
|
||||||
|
case "<":
|
||||||
|
return compLT
|
||||||
|
case "<=":
|
||||||
|
return compLE
|
||||||
|
case "!":
|
||||||
|
fallthrough
|
||||||
|
case "!=":
|
||||||
|
return compNE
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
6
vendor/github.com/opencontainers/runtime-tools/generate/generate.go
generated
vendored
6
vendor/github.com/opencontainers/runtime-tools/generate/generate.go
generated
vendored
@ -912,35 +912,30 @@ func (g *Generator) DropProcessCapability(c string) error {
|
|||||||
for i, cap := range g.spec.Process.Capabilities.Bounding {
|
for i, cap := range g.spec.Process.Capabilities.Bounding {
|
||||||
if strings.ToUpper(cap) == cp {
|
if strings.ToUpper(cap) == cp {
|
||||||
g.spec.Process.Capabilities.Bounding = append(g.spec.Process.Capabilities.Bounding[:i], g.spec.Process.Capabilities.Bounding[i+1:]...)
|
g.spec.Process.Capabilities.Bounding = append(g.spec.Process.Capabilities.Bounding[:i], g.spec.Process.Capabilities.Bounding[i+1:]...)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, cap := range g.spec.Process.Capabilities.Effective {
|
for i, cap := range g.spec.Process.Capabilities.Effective {
|
||||||
if strings.ToUpper(cap) == cp {
|
if strings.ToUpper(cap) == cp {
|
||||||
g.spec.Process.Capabilities.Effective = append(g.spec.Process.Capabilities.Effective[:i], g.spec.Process.Capabilities.Effective[i+1:]...)
|
g.spec.Process.Capabilities.Effective = append(g.spec.Process.Capabilities.Effective[:i], g.spec.Process.Capabilities.Effective[i+1:]...)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, cap := range g.spec.Process.Capabilities.Inheritable {
|
for i, cap := range g.spec.Process.Capabilities.Inheritable {
|
||||||
if strings.ToUpper(cap) == cp {
|
if strings.ToUpper(cap) == cp {
|
||||||
g.spec.Process.Capabilities.Inheritable = append(g.spec.Process.Capabilities.Inheritable[:i], g.spec.Process.Capabilities.Inheritable[i+1:]...)
|
g.spec.Process.Capabilities.Inheritable = append(g.spec.Process.Capabilities.Inheritable[:i], g.spec.Process.Capabilities.Inheritable[i+1:]...)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, cap := range g.spec.Process.Capabilities.Permitted {
|
for i, cap := range g.spec.Process.Capabilities.Permitted {
|
||||||
if strings.ToUpper(cap) == cp {
|
if strings.ToUpper(cap) == cp {
|
||||||
g.spec.Process.Capabilities.Permitted = append(g.spec.Process.Capabilities.Permitted[:i], g.spec.Process.Capabilities.Permitted[i+1:]...)
|
g.spec.Process.Capabilities.Permitted = append(g.spec.Process.Capabilities.Permitted[:i], g.spec.Process.Capabilities.Permitted[i+1:]...)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, cap := range g.spec.Process.Capabilities.Ambient {
|
for i, cap := range g.spec.Process.Capabilities.Ambient {
|
||||||
if strings.ToUpper(cap) == cp {
|
if strings.ToUpper(cap) == cp {
|
||||||
g.spec.Process.Capabilities.Ambient = append(g.spec.Process.Capabilities.Ambient[:i], g.spec.Process.Capabilities.Ambient[i+1:]...)
|
g.spec.Process.Capabilities.Ambient = append(g.spec.Process.Capabilities.Ambient[:i], g.spec.Process.Capabilities.Ambient[i+1:]...)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1046,6 +1041,7 @@ func (g *Generator) RemoveDevice(path string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearLinuxDevices clears g.spec.Linux.Devices
|
||||||
func (g *Generator) ClearLinuxDevices() {
|
func (g *Generator) ClearLinuxDevices() {
|
||||||
if g.spec == nil || g.spec.Linux == nil || g.spec.Linux.Devices == nil {
|
if g.spec == nil || g.spec.Linux == nil || g.spec.Linux.Devices == nil {
|
||||||
return
|
return
|
||||||
|
6
vendor/github.com/opencontainers/runtime-tools/validate/validate.go
generated
vendored
6
vendor/github.com/opencontainers/runtime-tools/validate/validate.go
generated
vendored
@ -259,7 +259,7 @@ func (v *Validator) CheckProcess() (msgs []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs = append(msgs, v.CheckCapablities()...)
|
msgs = append(msgs, v.CheckCapabilities()...)
|
||||||
msgs = append(msgs, v.CheckRlimits()...)
|
msgs = append(msgs, v.CheckRlimits()...)
|
||||||
|
|
||||||
if v.spec.Platform.OS == "linux" {
|
if v.spec.Platform.OS == "linux" {
|
||||||
@ -276,7 +276,8 @@ func (v *Validator) CheckProcess() (msgs []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Validator) CheckCapablities() (msgs []string) {
|
// CheckCapabilities checks v.spec.Process.Capabilities
|
||||||
|
func (v *Validator) CheckCapabilities() (msgs []string) {
|
||||||
process := v.spec.Process
|
process := v.spec.Process
|
||||||
if v.spec.Platform.OS == "linux" {
|
if v.spec.Platform.OS == "linux" {
|
||||||
var caps []string
|
var caps []string
|
||||||
@ -309,6 +310,7 @@ func (v *Validator) CheckCapablities() (msgs []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckRlimits checks v.spec.Process.Rlimits
|
||||||
func (v *Validator) CheckRlimits() (msgs []string) {
|
func (v *Validator) CheckRlimits() (msgs []string) {
|
||||||
process := v.spec.Process
|
process := v.spec.Process
|
||||||
for index, rlimit := range process.Rlimits {
|
for index, rlimit := range process.Rlimits {
|
||||||
|
Loading…
Reference in New Issue
Block a user