NVR: skopeo-0.1.14-1.gitffe92ed

- build origin/master commit ffe92ed

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar 2016-08-11 09:24:17 -05:00
parent 381123ed0c
commit faa53e254f
4 changed files with 13 additions and 223 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/skopeo-8094910.tar.gz /skopeo-8094910.tar.gz
/skopeo-015f1c8.tar.gz /skopeo-015f1c8.tar.gz
/skopeo-9e971b4.tar.gz /skopeo-9e971b4.tar.gz
/skopeo-ffe92ed.tar.gz

View File

@ -1,203 +0,0 @@
diff --git a/signature/json.go b/signature/json.go
index a612db0..48f3a5c 100644
--- a/signature/json.go
+++ b/signature/json.go
@@ -1,10 +1,8 @@
package signature
import (
- "bytes"
"encoding/json"
"fmt"
- "io"
)
// jsonFormatError is returned when JSON does not match expected format.
@@ -64,28 +62,14 @@ func stringField(m map[string]interface{}, fieldName string) (string, error) {
func paranoidUnmarshalJSONObject(data []byte, fieldResolver func(string) interface{}) error {
seenKeys := map[string]struct{}{}
- dec := json.NewDecoder(bytes.NewReader(data))
- t, err := dec.Token()
- if err != nil {
+ // NOTE: This is a go 1.4 implementation, very much non-paranoid! The json.Unmarshal below
+ // already throws out duplicate keys.
+ var obj map[string]json.RawMessage
+ if err := json.Unmarshal(data, &obj); err != nil {
return jsonFormatError(err.Error())
}
- if t != json.Delim('{') {
- return jsonFormatError(fmt.Sprintf("JSON object expected, got \"%s\"", t))
- }
- for {
- t, err := dec.Token()
- if err != nil {
- return jsonFormatError(err.Error())
- }
- if t == json.Delim('}') {
- break
- }
- key, ok := t.(string)
- if !ok {
- // Coverage: This should never happen, dec.Token() rejects non-string-literals in this state.
- return jsonFormatError(fmt.Sprintf("Key string literal expected, got \"%s\"", t))
- }
+ for key, valueJSON := range obj {
if _, ok := seenKeys[key]; ok {
return jsonFormatError(fmt.Sprintf("Duplicate key \"%s\"", key))
}
@@ -95,13 +79,9 @@ func paranoidUnmarshalJSONObject(data []byte, fieldResolver func(string) interfa
if valuePtr == nil {
return jsonFormatError(fmt.Sprintf("Unknown key \"%s\"", key))
}
- // This works like json.Unmarshal, in particular it allows us to implement UnmarshalJSON to implement strict parsing of the field value.
- if err := dec.Decode(valuePtr); err != nil {
+ if err := json.Unmarshal(valueJSON, valuePtr); err != nil {
return jsonFormatError(err.Error())
}
}
- if _, err := dec.Token(); err != io.EOF {
- return jsonFormatError("Unexpected data after JSON object")
- }
return nil
}
diff --git a/signature/json_test.go b/signature/json_test.go
index 8d0f63c..80719e0 100644
--- a/signature/json_test.go
+++ b/signature/json_test.go
@@ -131,12 +131,12 @@ func TestParanoidUnmarshalJSONObject(t *testing.T) {
// Various kinds of invalid input
for _, input := range []string{
- ``, // Empty input
- `&`, // Entirely invalid JSON
- `1`, // Not an object
- `{&}`, // Invalid key JSON
- `{1:1}`, // Key not a string
- `{"b":1, "b":1}`, // Duplicate key
+ ``, // Empty input
+ `&`, // Entirely invalid JSON
+ `1`, // Not an object
+ `{&}`, // Invalid key JSON
+ `{1:1}`, // Key not a string
+ // `{"b":1, "b":1}`, // Duplicate key
`{"thisdoesnotexist":1}`, // Key rejected by resolver
`{"a":&}`, // Invalid value JSON
`{"a":1}`, // Type mismatch
@@ -144,6 +144,6 @@ func TestParanoidUnmarshalJSONObject(t *testing.T) {
} {
ts = testStruct{}
err := paranoidUnmarshalJSONObject([]byte(input), tsResolver)
- assert.Error(t, err)
+ assert.Error(t, err, input)
}
}
diff --git a/signature/policy_config_test.go b/signature/policy_config_test.go
index 63fd8c7..579aa5f 100644
--- a/signature/policy_config_test.go
+++ b/signature/policy_config_test.go
@@ -203,7 +203,7 @@ func TestPolicyUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"default", "specific"} {
+ for _, field := range []string{ /*"default", "specific"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -367,7 +367,7 @@ func TestPRInsecureAcceptAnythingUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type"} {
+ for _, field := range []string{ /*"type"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -438,7 +438,7 @@ func TestPRRejectUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type"} {
+ for _, field := range []string{ /*"type"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -601,7 +601,7 @@ func TestPRSignedByUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type", "keyType", "keyData", "signedIdentity"} {
+ for _, field := range []string{ /*"type", "keyType", "keyData", "signedIdentity"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -613,14 +613,14 @@ func TestPRSignedByUnmarshalJSON(t *testing.T) {
assert.Error(t, err)
}
// Handle "keyPath", which is not in validJSON, specially
- pathPR, err := NewPRSignedByKeyPath(SBKeyTypeGPGKeys, "/foo/bar", NewPRMMatchExact())
- require.NoError(t, err)
- testJSON, err = json.Marshal(pathPR)
- require.NoError(t, err)
- testJSON = addExtraJSONMember(t, testJSON, "keyPath", pr.KeyPath)
- pr = prSignedBy{}
- err = json.Unmarshal(testJSON, &pr)
- assert.Error(t, err)
+ // pathPR, err := NewPRSignedByKeyPath(SBKeyTypeGPGKeys, "/foo/bar", NewPRMMatchExact())
+ // require.NoError(t, err)
+ // testJSON, err = json.Marshal(pathPR)
+ // require.NoError(t, err)
+ // testJSON = addExtraJSONMember(t, testJSON, "keyPath", pr.KeyPath)
+ // pr = prSignedBy{}
+ // err = json.Unmarshal(testJSON, &pr)
+ // assert.Error(t, err)
// Various allowed modifications to the requirement
allowedModificationFns := []func(mSI){
@@ -779,7 +779,7 @@ func TestPRSignedBaseLayerUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type", "baseLayerIdentity"} {
+ for _, field := range []string{ /*"type", "baseLayerIdentity"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -881,7 +881,7 @@ func TestPRMMatchExactUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type"} {
+ for _, field := range []string{ /*"type"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -952,7 +952,7 @@ func TestPRMMatchRepositoryUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type"} {
+ for _, field := range []string{ /*"type"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -1059,7 +1059,7 @@ func TestPRMExactReferenceUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type", "baseLayerIdentity"} {
+ for _, field := range []string{ /*"type", "baseLayerIdentity"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)
@@ -1163,7 +1163,7 @@ func TestPRMExactRepositoryUnmarshalJSON(t *testing.T) {
}
// Duplicated fields
- for _, field := range []string{"type", "baseLayerIdentity"} {
+ for _, field := range []string{ /*"type", "baseLayerIdentity"*/ } {
var tmp mSI
err := json.Unmarshal(validJSON, &tmp)
require.NoError(t, err)

View File

@ -25,12 +25,12 @@
# https://github.com/projectatomic/skopeo # https://github.com/projectatomic/skopeo
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix} %global import_path %{provider_prefix}
%global commit 9e971b4937d176aa7ac3af6377b69e58bfd789eb %global commit ffe92ed2bbbf4e77fc8ef8c62d2b4c2844195c66
%global shortcommit %(c=%{commit}; echo ${c:0:7}) %global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: skopeo Name: skopeo
Version: 0.1.13 Version: 0.1.14
Release: 6%{?dist} Release: 1.git%{shortcommit}%{?dist}
Summary: Inspect Docker images and repositories on registries Summary: Inspect Docker images and repositories on registries
License: ASL 2.0 License: ASL 2.0
URL: https://%{provider_prefix} URL: https://%{provider_prefix}
@ -164,11 +164,11 @@ providing packages with %{import_path} prefix.
%endif %endif
%prep %prep
%autosetup -Sgit -n %{repo}-%{commit} %autosetup -Sgit -n %{name}-%{commit}
%build %build
mkdir -p src/github.com/projectatomic mkdir -p src/github.com/projectatomic
ln -s ../../../ src/github.com/projectatomic/skopeo ln -s ../../../ src/%{import_path}
mkdir -p vendor/src mkdir -p vendor/src
for v in vendor/*; do for v in vendor/*; do
@ -185,20 +185,9 @@ export GOPATH=$(pwd):%{gopath}
export GOPATH=$(pwd):$(pwd)/vendor:%{gopath} export GOPATH=$(pwd):$(pwd)/vendor:%{gopath}
%endif %endif
export GO15VENDOREXPERIMENT=1 make binary-local docs
%if ! 0%{?gobuild:1}
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
%endif
%gobuild -o skopeo ./cmd/skopeo
if test -f man/skopeo.1.md; then
go-md2man -in man/skopeo.1.md -out skopeo.1
fi
%install %install
mkdir -p %{buildroot}/%{_mandir}/man1
make DESTDIR=%{buildroot} install make DESTDIR=%{buildroot} install
# source codes for building projects # source codes for building projects
@ -258,12 +247,15 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%endif %endif
%files %files
%{_bindir}/skopeo %{_bindir}/%{name}
%{_mandir}/man1/skopeo.1* %{_mandir}/man1/%{name}.1*
%license LICENSE %license LICENSE
%doc README.md %doc README.md
%changelog %changelog
* Thu Aug 11 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.1.14-1.gitffe92ed
- build origin/master commit ffe92ed
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.13-6 * Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.13-6
- https://fedoraproject.org/wiki/Changes/golang1.7 - https://fedoraproject.org/wiki/Changes/golang1.7

View File

@ -1 +1 @@
078f8deabe205d19b254c317ea770f67 skopeo-9e971b4.tar.gz 98abe924e0d0d23ec4e2eed5d2571256 skopeo-ffe92ed.tar.gz