Skip to content

Commit ca58cdf

Browse files
authored
Merge pull request #148 from s-urbaniak/vendor
Vendor dependencies, add hacking guide
2 parents b36f351 + a664feb commit ca58cdf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+11683
-3
lines changed

.tool/lint

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ ! $(command -v gometalinter) ]; then
99
gometalinter --update --install
1010
fi
1111

12-
for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool'); do
12+
for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*'); do
1313
gometalinter \
1414
--exclude='error return value not checked.*(Close|Log|Print).*\(errcheck\)$' \
1515
--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$' \

HACKING.md

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Hacking Guide
2+
3+
## Overview
4+
5+
This guide contains instructions for building artifacts contained in this repository.
6+
7+
### Go
8+
9+
This spec includes several Go packages, and a command line tool considered to be a reference implementation of the OCI image specification.
10+
11+
Prerequsites:
12+
* Go >=1.5
13+
* make
14+
15+
The following make targets are relevant for any work involving the Go packages.
16+
17+
### Linting
18+
19+
The included Go source code is being examined for any linting violations not included in the standard Go compiler. Linting is done using [gometalinter](https://github.com/alecthomas/gometalinter).
20+
21+
Invocation:
22+
```
23+
$ make lint
24+
```
25+
26+
### Tests
27+
28+
This target executes all Go based tests.
29+
30+
Invocation:
31+
```
32+
$ make test
33+
$ make validate-examples
34+
```
35+
36+
### OCI image tool
37+
38+
This target builds the `oci-image-tool` binary.
39+
40+
Invocation:
41+
```
42+
$ make oci-image-tool
43+
```
44+
45+
### Virtual schema http/FileSystem
46+
47+
The `oci-image-tool` uses a virtual [http/FileSystem](https://golang.org/pkg/net/http/#FileSystem) to load the JSON schema files for validating OCI images and/or manifests. The virtual file system is generated using the `esc` tool and compiled into the `oci-image-tool` binary so the JSON schema files don't have to be distributed along with the binary.
48+
49+
Whenever changes are being done in any of the `schema/*.json` files, one must refresh the generated virtual file system. Otherwise schema changes will not be visible inside the `oci-image-tool`.
50+
51+
Prerequisites:
52+
* [esc](https://github.com/mjibson/esc)
53+
54+
Invocation:
55+
```
56+
$ make schema-fs
57+
```
58+
59+
### JSON schema formatting
60+
61+
This target auto-formats all JSON files in the `schema` directory using the `jq` tool.
62+
63+
Prerequisites:
64+
* [jq](https://stedolan.github.io/jq/)
65+
66+
Invocation:
67+
```
68+
$ make fmt
69+
```
70+
71+
### OCI image specification PDF/HTML documentation files
72+
73+
This target generates a PDF/HTML version of the OCI image specification.
74+
75+
Prerequisites:
76+
* [Docker](https://www.docker.com/)
77+
78+
Invocation:
79+
```
80+
$ make docs
81+
```
82+
83+
### License header check
84+
85+
This target checks if the source code includes necessary headers.
86+
87+
Invocation:
88+
```
89+
$ make check-license
90+
```
91+
92+
### Update vendored dependencies
93+
94+
This target updates all vendored depencies to their newest available versions. The `glide` tools is being used for the actual management and `glide-vc` tool is being used for stripping down the vendor directory size.
95+
96+
Prerequisites:
97+
* [glide](https://github.com/Masterminds/glide)
98+
* [glide-vc](https://github.com/sgotti/glide-vc)
99+
100+
Invocation:
101+
```
102+
$ make update-deps
103+
```
104+
105+
### Clean build artifacts
106+
107+
This target cleans all generated/compiled artifacts.
108+
109+
Invocation:
110+
```
111+
$ make clean
112+
```
113+
114+
### Create PNG images from dot files
115+
116+
This target generates PNG image files from DOT source files in the `img` directory.
117+
118+
Prerequisites:
119+
* [graphviz](http://www.graphviz.org/)
120+
121+
Invocation:
122+
```
123+
$ make img/media-types.png
124+
```

Makefile

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
GO15VENDOREXPERIMENT=1
2+
export GO15VENDOREXPERIMENT
13

24
DOCKER ?= $(shell which docker)
35
# These docs are in an order that determines how they show up in the PDF/HTML docs.
@@ -24,7 +26,14 @@ help:
2426
@echo
2527
@echo " * 'docs' - produce document in the $(OUTPUT) directory"
2628
@echo " * 'fmt' - format the json with indentation"
27-
@echo " * 'validate' - build the validation tool"
29+
@echo " * 'validate-examples' - validate the examples in the specification markdown files"
30+
@echo " * 'oci-image-tool' - build the oci-image-tool binary"
31+
@echo " * 'schema-fs' - regenerate the virtual schema http/FileSystem"
32+
@echo " * 'check-license' - check license headers in source files"
33+
@echo " * 'lint' - Execute the source code linter"
34+
@echo " * 'test' - Execute the unit tests"
35+
@echo " * 'update-deps' - Update vendored dependencies"
36+
@echo " * 'img/*.png' - Generate PNG from dot file"
2837

2938
fmt:
3039
for i in schema/*.json ; do jq --indent 2 -M . "$${i}" > xx && cat xx > "$${i}" && rm xx ; done
@@ -81,7 +90,13 @@ lint:
8190
test:
8291
go test -race ./...
8392

84-
img/%.png: %.dot
93+
update-deps:
94+
glide update --strip-vcs --strip-vendor --update-vendored --delete
95+
glide-vc --only-code --no-tests
96+
# see http://sed.sourceforge.net/sed1line.txt
97+
for f in $$(find vendor -type f); do sed -i -e :a -e '/^\n*$$/{$$d;N;ba' -e '}' $$f; done
98+
99+
img/%.png: img/%.dot
85100
dot -Tpng $^ > $@
86101

87102
.PHONY: .gitvalidation
@@ -96,13 +111,16 @@ else
96111
endif
97112

98113
.PHONY: install.tools
114+
99115
install.tools: .install.gitvalidation
100116

101117
.install.gitvalidation:
102118
go get github.com/vbatts/git-validation
103119

104120
clean:
105121
rm -rf *~ $(OUTPUT)
122+
rm -f oci-image-tool
123+
106124
.PHONY: \
107125
validate-examples \
108126
oci-image-tool \

glide.lock

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package: github.com/opencontainers/image-spec
2+
import:
3+
- package: github.com/opencontainers/runtime-spec
4+
version: ^1.0.0-rc1
5+
subpackages:
6+
- specs-go
7+
- package: github.com/pkg/errors
8+
version: ">=0.7.0"
9+
- package: github.com/spf13/cobra
10+
- package: github.com/xeipuuv/gojsonschema
11+
version: d5336c75940ef31c9ceeb0ae64cf92944bccb4ee

vendor/github.com/inconshreveable/mousetrap/LICENSE

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/inconshreveable/mousetrap/trap_others.go

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/inconshreveable/mousetrap/trap_windows.go

+98
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)