From a429e99fdf452da15a8d28765d90324a2ea07287 Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Thu, 26 Mar 2015 15:12:13 -0700 Subject: [PATCH] Godeps: bump appc to v0.5.1 --- Godeps/Godeps.json | 24 +++++++++---------- .../src/github.com/appc/spec/aci/file_test.go | 2 +- .../appc/spec/discovery/discovery_test.go | 14 ++++++----- .../github.com/appc/spec/discovery/parse.go | 16 ++++++++----- .../appc/spec/discovery/parse_test.go | 6 +++-- .../github.com/appc/spec/schema/image_test.go | 2 +- .../appc/spec/schema/types/labels.go | 11 +++++++++ .../github.com/appc/spec/schema/version.go | 2 +- 8 files changed, 48 insertions(+), 29 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 53006f6..65bb0c4 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -25,33 +25,33 @@ }, { "ImportPath": "github.com/appc/spec/aci", - "Comment": "v0.5.0-10-g3fa4247", - "Rev": "3fa4247af87697784d812b8b68efd809fcbee33e" + "Comment": "v0.5.1", + "Rev": "9a448f73b7fa765a60eade4bcca41e18bfe613aa" }, { "ImportPath": "github.com/appc/spec/actool", - "Comment": "v0.5.0-10-g3fa4247", - "Rev": "3fa4247af87697784d812b8b68efd809fcbee33e" + "Comment": "v0.5.1", + "Rev": "9a448f73b7fa765a60eade4bcca41e18bfe613aa" }, { "ImportPath": "github.com/appc/spec/discovery", - "Comment": "v0.5.0-10-g3fa4247", - "Rev": "3fa4247af87697784d812b8b68efd809fcbee33e" + "Comment": "v0.5.1", + "Rev": "9a448f73b7fa765a60eade4bcca41e18bfe613aa" }, { "ImportPath": "github.com/appc/spec/pkg/acirenderer", - "Comment": "v0.5.0-10-g3fa4247", - "Rev": "3fa4247af87697784d812b8b68efd809fcbee33e" + "Comment": "v0.5.1", + "Rev": "9a448f73b7fa765a60eade4bcca41e18bfe613aa" }, { "ImportPath": "github.com/appc/spec/pkg/tarheader", - "Comment": "v0.5.0-10-g3fa4247", - "Rev": "3fa4247af87697784d812b8b68efd809fcbee33e" + "Comment": "v0.5.1", + "Rev": "9a448f73b7fa765a60eade4bcca41e18bfe613aa" }, { "ImportPath": "github.com/appc/spec/schema", - "Comment": "v0.5.0-10-g3fa4247", - "Rev": "3fa4247af87697784d812b8b68efd809fcbee33e" + "Comment": "v0.5.1", + "Rev": "9a448f73b7fa765a60eade4bcca41e18bfe613aa" }, { "ImportPath": "github.com/camlistore/lock", diff --git a/Godeps/_workspace/src/github.com/appc/spec/aci/file_test.go b/Godeps/_workspace/src/github.com/appc/spec/aci/file_test.go index 939fd0e..f7def45 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/aci/file_test.go +++ b/Godeps/_workspace/src/github.com/appc/spec/aci/file_test.go @@ -14,7 +14,7 @@ func newTestACI(usedotslash bool) (*os.File, error) { return nil, err } - manifestBody := `{"acKind":"ImageManifest","acVersion":"0.5.0","name":"example.com/app"}` + manifestBody := `{"acKind":"ImageManifest","acVersion":"0.5.1","name":"example.com/app"}` gw := gzip.NewWriter(tf) tw := tar.NewWriter(gw) diff --git a/Godeps/_workspace/src/github.com/appc/spec/discovery/discovery_test.go b/Godeps/_workspace/src/github.com/appc/spec/discovery/discovery_test.go index 844ce16..d179360 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/discovery/discovery_test.go +++ b/Godeps/_workspace/src/github.com/appc/spec/discovery/discovery_test.go @@ -6,6 +6,8 @@ import ( "net/http" "os" "testing" + + "github.com/coreos/rocket/Godeps/_workspace/src/github.com/appc/spec/schema/types" ) func fakeHTTPGet(filename string, failures int) func(uri string) (*http.Response, error) { @@ -65,7 +67,7 @@ func TestDiscoverEndpoints(t *testing.T) { true, App{ Name: "example.com/myapp", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "version": "1.0.0", "os": "linux", "arch": "amd64", @@ -88,7 +90,7 @@ func TestDiscoverEndpoints(t *testing.T) { true, App{ Name: "example.com/myapp/foobar", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "version": "1.0.0", "os": "linux", "arch": "amd64", @@ -111,7 +113,7 @@ func TestDiscoverEndpoints(t *testing.T) { false, App{ Name: "example.com/myapp/foobar/bazzer", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "version": "1.0.0", "os": "linux", "arch": "amd64", @@ -128,7 +130,7 @@ func TestDiscoverEndpoints(t *testing.T) { true, App{ Name: "example.com/myapp", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "version": "1.0.0", }, }, @@ -147,7 +149,7 @@ func TestDiscoverEndpoints(t *testing.T) { false, App{ Name: "example.com/myapp", - Labels: map[string]string{}, + Labels: map[types.ACName]string{}, }, []ACIEndpoint{ ACIEndpoint{ @@ -163,7 +165,7 @@ func TestDiscoverEndpoints(t *testing.T) { false, App{ Name: "example.com/myapp", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "name": "labelcalledname", "version": "1.0.0", }, diff --git a/Godeps/_workspace/src/github.com/appc/spec/discovery/parse.go b/Godeps/_workspace/src/github.com/appc/spec/discovery/parse.go index 8fbff6c..d962aef 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/discovery/parse.go +++ b/Godeps/_workspace/src/github.com/appc/spec/discovery/parse.go @@ -10,12 +10,12 @@ import ( type App struct { Name types.ACName - Labels map[string]string + Labels map[types.ACName]string } -func NewApp(name string, labels map[string]string) (*App, error) { +func NewApp(name string, labels map[types.ACName]string) (*App, error) { if labels == nil { - labels = make(map[string]string, 0) + labels = make(map[types.ACName]string, 0) } acn, err := types.NewACName(name) if err != nil { @@ -35,7 +35,7 @@ func NewApp(name string, labels map[string]string) (*App, error) { func NewAppFromString(app string) (*App, error) { var ( name string - labels map[string]string + labels map[types.ACName]string ) app = strings.Replace(app, ":", ",version=", -1) @@ -44,7 +44,7 @@ func NewAppFromString(app string) (*App, error) { if err != nil { return nil, err } - labels = make(map[string]string, 0) + labels = make(map[types.ACName]string, 0) for key, val := range v { if len(val) > 1 { return nil, fmt.Errorf("label %s with multiple values %q", key, val) @@ -53,7 +53,11 @@ func NewAppFromString(app string) (*App, error) { name = val[0] continue } - labels[key] = val[0] + labelName, err := types.NewACName(key) + if err != nil { + return nil, err + } + labels[*labelName] = val[0] } a, err := NewApp(name, labels) if err != nil { diff --git a/Godeps/_workspace/src/github.com/appc/spec/discovery/parse_test.go b/Godeps/_workspace/src/github.com/appc/spec/discovery/parse_test.go index 830e06a..f3daf0f 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/discovery/parse_test.go +++ b/Godeps/_workspace/src/github.com/appc/spec/discovery/parse_test.go @@ -3,6 +3,8 @@ package discovery import ( "reflect" "testing" + + "github.com/coreos/rocket/Godeps/_workspace/src/github.com/appc/spec/schema/types" ) func TestNewAppFromString(t *testing.T) { @@ -17,7 +19,7 @@ func TestNewAppFromString(t *testing.T) { &App{ Name: "example.com/reduce-worker", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "version": "1.0.0", }, }, @@ -28,7 +30,7 @@ func TestNewAppFromString(t *testing.T) { &App{ Name: "example.com/reduce-worker", - Labels: map[string]string{ + Labels: map[types.ACName]string{ "channel": "alpha", "label": "value", }, diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go index 2d832c9..fe9d676 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go +++ b/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go @@ -6,7 +6,7 @@ func TestEmptyApp(t *testing.T) { imj := ` { "acKind": "ImageManifest", - "acVersion": "0.5.0", + "acVersion": "0.5.1", "name": "example.com/test" } ` diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels.go index 02abaef..9c7f0c2 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels.go +++ b/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels.go @@ -91,3 +91,14 @@ func (l Labels) Get(name string) (val string, ok bool) { } return "", false } + +func LabelsFromMap(labelsMap map[ACName]string) (Labels, error) { + labels := Labels{} + for n, v := range labelsMap { + labels = append(labels, Label{Name: n, Value: v}) + } + if err := labels.assertValid(); err != nil { + return nil, err + } + return labels, nil +} diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/version.go b/Godeps/_workspace/src/github.com/appc/spec/schema/version.go index be3a571..4bc085c 100644 --- a/Godeps/_workspace/src/github.com/appc/spec/schema/version.go +++ b/Godeps/_workspace/src/github.com/appc/spec/schema/version.go @@ -8,7 +8,7 @@ const ( // version represents the canonical version of the appc spec and tooling. // For now, the schema and tooling is coupled with the spec itself, so // this must be kept in sync with the VERSION file in the root of the repo. - version string = "0.5.0+git" + version string = "0.5.1" ) var (