Skip to content

Commit

Permalink
Merge pull request #148 from s-urbaniak/vendor
Browse files Browse the repository at this point in the history
Vendor dependencies, add hacking guide
  • Loading branch information
vbatts committed Jun 27, 2016
2 parents b36f351 + a664feb commit ca58cdf
Show file tree
Hide file tree
Showing 67 changed files with 11,683 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .tool/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ ! $(command -v gometalinter) ]; then
gometalinter --update --install
fi

for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool'); do
for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*'); do
gometalinter \
--exclude='error return value not checked.*(Close|Log|Print).*\(errcheck\)$' \
--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$' \
Expand Down
124 changes: 124 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Hacking Guide

## Overview

This guide contains instructions for building artifacts contained in this repository.

### Go

This spec includes several Go packages, and a command line tool considered to be a reference implementation of the OCI image specification.

Prerequsites:
* Go >=1.5
* make

The following make targets are relevant for any work involving the Go packages.

### Linting

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).

Invocation:
```
$ make lint
```

### Tests

This target executes all Go based tests.

Invocation:
```
$ make test
$ make validate-examples
```

### OCI image tool

This target builds the `oci-image-tool` binary.

Invocation:
```
$ make oci-image-tool
```

### Virtual schema http/FileSystem

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.

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`.

Prerequisites:
* [esc](https://github.com/mjibson/esc)

Invocation:
```
$ make schema-fs
```

### JSON schema formatting

This target auto-formats all JSON files in the `schema` directory using the `jq` tool.

Prerequisites:
* [jq](https://stedolan.github.io/jq/)

Invocation:
```
$ make fmt
```

### OCI image specification PDF/HTML documentation files

This target generates a PDF/HTML version of the OCI image specification.

Prerequisites:
* [Docker](https://www.docker.com/)

Invocation:
```
$ make docs
```

### License header check

This target checks if the source code includes necessary headers.

Invocation:
```
$ make check-license
```

### Update vendored dependencies

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.

Prerequisites:
* [glide](https://github.com/Masterminds/glide)
* [glide-vc](https://github.com/sgotti/glide-vc)

Invocation:
```
$ make update-deps
```

### Clean build artifacts

This target cleans all generated/compiled artifacts.

Invocation:
```
$ make clean
```

### Create PNG images from dot files

This target generates PNG image files from DOT source files in the `img` directory.

Prerequisites:
* [graphviz](http://www.graphviz.org/)

Invocation:
```
$ make img/media-types.png
```
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
GO15VENDOREXPERIMENT=1
export GO15VENDOREXPERIMENT

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

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

img/%.png: %.dot
update-deps:
glide update --strip-vcs --strip-vendor --update-vendored --delete
glide-vc --only-code --no-tests
# see http://sed.sourceforge.net/sed1line.txt
for f in $$(find vendor -type f); do sed -i -e :a -e '/^\n*$$/{$$d;N;ba' -e '}' $$f; done

img/%.png: img/%.dot
dot -Tpng $^ > $@

.PHONY: .gitvalidation
Expand All @@ -96,13 +111,16 @@ else
endif

.PHONY: install.tools

install.tools: .install.gitvalidation

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

clean:
rm -rf *~ $(OUTPUT)
rm -f oci-image-tool

.PHONY: \
validate-examples \
oci-image-tool \
Expand Down
26 changes: 26 additions & 0 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package: github.com/opencontainers/image-spec
import:
- package: github.com/opencontainers/runtime-spec
version: ^1.0.0-rc1
subpackages:
- specs-go
- package: github.com/pkg/errors
version: ">=0.7.0"
- package: github.com/spf13/cobra
- package: github.com/xeipuuv/gojsonschema
version: d5336c75940ef31c9ceeb0ae64cf92944bccb4ee
13 changes: 13 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/trap_others.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/trap_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca58cdf

Please sign in to comment.