Browse code

Re-vendoring notary in order to deal with a canonical JSON serialization issue.

Signed-off-by: cyli <cyli@twistedmatrix.com>

cyli authored on 2016/01/09 09:44:10
Showing 7 changed files
... ...
@@ -153,7 +153,7 @@ RUN set -x \
153 153
 	&& rm -rf "$GOPATH"
154 154
 
155 155
 # Install notary server
156
-ENV NOTARY_VERSION docker-v1.10-1
156
+ENV NOTARY_VERSION docker-v1.10-2
157 157
 RUN set -x \
158 158
 	&& export GOPATH="$(mktemp -d)" \
159 159
 	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
... ...
@@ -47,7 +47,7 @@ clone git github.com/docker/distribution 568bf038af6d65b376165d02886b1c7fcaef1f6
47 47
 clone git github.com/vbatts/tar-split v0.9.11
48 48
 
49 49
 # get desired notary commit, might also need to be updated in Dockerfile
50
-clone git github.com/docker/notary docker-v1.10-1
50
+clone git github.com/docker/notary docker-v1.10-2
51 51
 
52 52
 clone git google.golang.org/grpc 174192fc93efcb188fc8f46ca447f0da606b6885 https://github.com/grpc/grpc-go.git
53 53
 clone git github.com/miekg/pkcs11 80f102b5cac759de406949c47f0928b99bd64cdf
... ...
@@ -2,6 +2,7 @@ package client
2 2
 
3 3
 import (
4 4
 	"bytes"
5
+	"encoding/json"
5 6
 	"fmt"
6 7
 	"io/ioutil"
7 8
 	"net/http"
... ...
@@ -12,8 +13,6 @@ import (
12 12
 	"time"
13 13
 
14 14
 	"github.com/Sirupsen/logrus"
15
-	"github.com/jfrazelle/go/canonical/json"
16
-
17 15
 	"github.com/docker/notary/certs"
18 16
 	"github.com/docker/notary/client/changelist"
19 17
 	"github.com/docker/notary/cryptoservice"
... ...
@@ -324,7 +323,7 @@ func (r *NotaryRepository) AddDelegation(name string, threshold int,
324 324
 	logrus.Debugf(`Adding delegation "%s" with threshold %d, and %d keys\n`,
325 325
 		name, threshold, len(delegationKeys))
326 326
 
327
-	tdJSON, err := json.MarshalCanonical(&changelist.TufDelegation{
327
+	tdJSON, err := json.Marshal(&changelist.TufDelegation{
328 328
 		NewThreshold: threshold,
329 329
 		AddKeys:      data.KeyList(delegationKeys),
330 330
 		AddPaths:     paths,
... ...
@@ -386,7 +385,7 @@ func (r *NotaryRepository) AddTarget(target *Target, roles ...string) error {
386 386
 	logrus.Debugf("Adding target \"%s\" with sha256 \"%x\" and size %d bytes.\n", target.Name, target.Hashes["sha256"], target.Length)
387 387
 
388 388
 	meta := data.FileMeta{Length: target.Length, Hashes: target.Hashes}
389
-	metaJSON, err := json.MarshalCanonical(meta)
389
+	metaJSON, err := json.Marshal(meta)
390 390
 	if err != nil {
391 391
 		return err
392 392
 	}
... ...
@@ -690,7 +689,7 @@ func (r *NotaryRepository) saveMetadata(ignoreSnapshot bool) error {
690 690
 		if err != nil {
691 691
 			return err
692 692
 		}
693
-		targetsJSON, err := json.MarshalCanonical(signedTargets)
693
+		targetsJSON, err := json.Marshal(signedTargets)
694 694
 		if err != nil {
695 695
 			return err
696 696
 		}
... ...
@@ -838,7 +837,7 @@ func (r *NotaryRepository) rootFileKeyChange(role, action string, key data.Publi
838 838
 		RoleName: role,
839 839
 		Keys:     kl,
840 840
 	}
841
-	metaJSON, err := json.MarshalCanonical(meta)
841
+	metaJSON, err := json.Marshal(meta)
842 842
 	if err != nil {
843 843
 		return err
844 844
 	}
... ...
@@ -1,14 +1,13 @@
1 1
 package client
2 2
 
3 3
 import (
4
+	"encoding/json"
4 5
 	"fmt"
5 6
 	"net/http"
6 7
 	"path"
7 8
 	"time"
8 9
 
9 10
 	"github.com/Sirupsen/logrus"
10
-	"github.com/jfrazelle/go/canonical/json"
11
-
12 11
 	"github.com/docker/notary/client/changelist"
13 12
 	tuf "github.com/docker/notary/tuf"
14 13
 	"github.com/docker/notary/tuf/data"
... ...
@@ -262,5 +261,5 @@ func serializeCanonicalRole(tufRepo *tuf.Repo, role string) (out []byte, err err
262 262
 		return
263 263
 	}
264 264
 
265
-	return json.MarshalCanonical(s)
265
+	return json.Marshal(s)
266 266
 }
... ...
@@ -27,12 +27,12 @@ type Snapshot struct {
27 27
 // and targets objects
28 28
 func NewSnapshot(root *Signed, targets *Signed) (*SignedSnapshot, error) {
29 29
 	logrus.Debug("generating new snapshot...")
30
-	targetsJSON, err := json.MarshalCanonical(targets)
30
+	targetsJSON, err := json.Marshal(targets)
31 31
 	if err != nil {
32 32
 		logrus.Debug("Error Marshalling Targets")
33 33
 		return nil, err
34 34
 	}
35
-	rootJSON, err := json.MarshalCanonical(root)
35
+	rootJSON, err := json.Marshal(root)
36 36
 	if err != nil {
37 37
 		logrus.Debug("Error Marshalling Root")
38 38
 		return nil, err
... ...
@@ -24,7 +24,7 @@ type Timestamp struct {
24 24
 
25 25
 // NewTimestamp initializes a timestamp with an existing snapshot
26 26
 func NewTimestamp(snapshot *Signed) (*SignedTimestamp, error) {
27
-	snapshotJSON, err := json.MarshalCanonical(snapshot)
27
+	snapshotJSON, err := json.Marshal(snapshot)
28 28
 	if err != nil {
29 29
 		return nil, err
30 30
 	}
... ...
@@ -5,14 +5,13 @@ import (
5 5
 	"bytes"
6 6
 	"crypto/sha256"
7 7
 	"encoding/hex"
8
+	"encoding/json"
8 9
 	"fmt"
9 10
 	"path"
10 11
 	"strings"
11 12
 	"time"
12 13
 
13 14
 	"github.com/Sirupsen/logrus"
14
-	"github.com/jfrazelle/go/canonical/json"
15
-
16 15
 	"github.com/docker/notary/tuf/data"
17 16
 	"github.com/docker/notary/tuf/keys"
18 17
 	"github.com/docker/notary/tuf/signed"
... ...
@@ -607,7 +606,7 @@ func (tr *Repo) RemoveTargets(role string, targets ...string) error {
607 607
 
608 608
 // UpdateSnapshot updates the FileMeta for the given role based on the Signed object
609 609
 func (tr *Repo) UpdateSnapshot(role string, s *data.Signed) error {
610
-	jsonData, err := json.MarshalCanonical(s)
610
+	jsonData, err := json.Marshal(s)
611 611
 	if err != nil {
612 612
 		return err
613 613
 	}
... ...
@@ -622,7 +621,7 @@ func (tr *Repo) UpdateSnapshot(role string, s *data.Signed) error {
622 622
 
623 623
 // UpdateTimestamp updates the snapshot meta in the timestamp based on the Signed object
624 624
 func (tr *Repo) UpdateTimestamp(s *data.Signed) error {
625
-	jsonData, err := json.MarshalCanonical(s)
625
+	jsonData, err := json.Marshal(s)
626 626
 	if err != nil {
627 627
 		return err
628 628
 	}