Skip to content

Commit

Permalink
Replace the build system
Browse files Browse the repository at this point in the history
Replace the bundle-targeted build system with simpler Makefile targets
and fewer helper scripts.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed May 25, 2017
1 parent 29d2c86 commit 230b9ab
Show file tree
Hide file tree
Showing 74 changed files with 183 additions and 2,978 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
# a .bashrc may be added to customize the build environment
.bashrc
.gopath/
autogen/
bundles/
cmd/dockerd/dockerd
cmd/docker/docker
dockerversion/version_autogen.go
docs/AWS_S3_BUCKET
docs/GITCOMMIT
docs/GIT_BRANCH
Expand All @@ -29,4 +24,3 @@ man/man5
man/man8
vendor/pkg/
.vagrant
storageversion/version_autogen.go
19 changes: 0 additions & 19 deletions .tool/lint

This file was deleted.

8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ before_install:
- sudo apt-get -qq install btrfs-tools libdevmapper-dev
script:
- make install.tools
- ./hack/make.sh validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet
- make .gitvalidation
- make build-binary
- ./hack/make.sh cross
- sudo -E env "PATH=${PATH}" ./hack/make.sh test-unit
- make docs
- make local-binary docs local-cross local-validate
- sudo PATH="$PATH" make local-test-unit local-test-integration
103 changes: 45 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,85 +1,72 @@
.PHONY: all binary build build-binary build-gccgo bundles cross default docs gccgo test test-integration-cli test-unit validate help win tgz

# set the graph driver as the current graphdriver if not set
DRIVER := $(if $(STORAGE_DRIVER),$(STORAGE_DRIVER),$(if $(DOCKER_GRAPHDRIVER),DOCKER_GRAPHDRIVER),$(shell docker info 2>&1 | grep "Storage Driver" | sed 's/.*: //'))
.PHONY: all binary build build-binary build-gccgo cross default docs gccgo test test-integration-cli test-unit validate help win tgz

PACKAGE := github.com/containers/storage
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
EPOCH_TEST_COMMIT := 0418ebf59f9e1f564831c0ba9378b7f8e40a1c73
SYSTEM_GOPATH := ${GOPATH}
NATIVETAGS := exclude_graphdriver_devicemapper exclude_graphdriver_btrfs
AUTOTAGS := $(shell ./hack/btrfs_tag.sh) $(shell ./hack/libdm_tag.sh)
BUILDFLAGS := -tags "$(AUTOTAGS) $(TAGS)" $(FLAGS)
GO := go

RUNINVM := vagrant/runinvm.sh

default all: build ## validate all checks, build linux binaries, run all tests\ncross build non-linux binaries and generate archives\nusing VMs
$(RUNINVM) hack/make.sh

build build-binary: bundles ## build using go on the host
hack/make.sh binary
default all: local-binary docs local-validate local-cross local-gccgo test-unit test-integration ## validate all checks, build and cross-build\nbinaries and docs, run tests in a VM

build-gccgo: bundles ## build using gccgo on the host
hack/make.sh gccgo
clean: ## remove all built files
$(RM) -f oci-storage oci-storage.* docs/*.1

binary: bundles
$(RUNINVM) hack/make.sh binary
binary local-binary: ## build using gc on the host
$(GO) build -compiler gc $(BUILDFLAGS) ./cmd/oci-storage

bundles:
mkdir -p bundles
local-gccgo: ## build using gccgo on the host
GCCGO=$(PWD)/hack/gccgo-wrapper.sh $(GO) build -compiler gccgo $(BUILDFLAGS) -o oci-storage.gccgo ./cmd/oci-storage

cross: build ## cross build the binaries for darwin, freebsd and windows\nusing VMs
$(RUNINVM) hack/make.sh binary cross
local-cross: ## cross build the binaries for arm, darwin, and\nfreebsd
@for target in linux/amd64 linux/386 linux/arm darwin/amd64 ; do \
os=`echo $${target} | cut -f1 -d/` ; \
arch=`echo $${target} | cut -f2 -d/` ; \
suffix=$${os}.$${arch} ; \
$(MAKE) GOOS=$${os} GOARCH=$${arch} FLAGS="-o oci-storage.$${suffix}" AUTOTAGS="$(NATIVETAGS)" local-binary; \
done

win: build ## cross build the binary for windows using VMs
$(RUNINVM) hack/make.sh win

tgz: build ## build the archives (.zip on windows and .tgz otherwise)\ncontaining the binaries on the host
hack/make.sh binary cross tgz
cross: ## cross build the binaries for arm, darwin, and\nfreebsd using VMs
$(RUNINVM) make local-$@

docs: ## build the docs on the host
$(MAKE) -C docs docs

gccgo: build-gccgo ## build the gcc-go linux binaries using VMs
$(RUNINVM) hack/make.sh gccgo

test: build ## run the unit and integration tests using VMs
$(RUNINVM) hack/make.sh binary cross test-unit
gccgo: ## build using gccgo using VMs
$(RUNINVM) make local-$@

test-unit: build ## run the unit tests using VMs
$(RUNINVM) hack/make.sh test-unit
test: local-binary ## build the binaries and run the tests using VMs
$(RUNINVM) make local-binary local-cross local-test-unit local-test-integration

validate: build ## validate DCO, Seccomp profile generation, gofmt,\n./pkg/ isolation, golint, tests, tomls, go vet and vendor\nusing VMs
$(RUNINVM) hack/make.sh validate-dco validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet
local-test-unit: local-binary ## run the unit tests on the host (requires\nsuperuser privileges)
@$(GO) test $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)

lint:
@which gometalinter > /dev/null 2>/dev/null || (echo "ERROR: gometalinter not found. Consider 'make install.tools' target" && false)
@echo "checking lint"
@./.tool/lint
test-unit: local-binary ## run the unit tests using VMs
$(RUNINVM) make local-$@

.PHONY: .gitvalidation
# When this is running in travis, it will only check the travis commit range
.gitvalidation:
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
ifeq ($(TRAVIS_EVENT_TYPE),pull_request)
git-validation -q -run DCO,short-subject
else ifeq ($(TRAVIS_EVENT_TYPE),push)
git-validation -q -run DCO,short-subject -no-travis -range $(EPOCH_TEST_COMMIT)..$(TRAVIS_BRANCH)
else
git-validation -q -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD
endif
local-test-integration: local-binary ## run the integration tests on the host (requires\nsuperuser privileges)
@cd tests; ./test_runner.sh

.PHONY: install.tools

install.tools: .install.gitvalidation .install.gometalinter .install.md2man
test-integration: local-binary ## run the integration tests using VMs
$(RUNINVM) make local-$@

.install.gitvalidation:
GOPATH=${SYSTEM_GOPATH} go get github.com/vbatts/git-validation
local-validate: ## validate DCO and gofmt on the host
@./hack/git-validation.sh
@./hack/gofmt.sh

.install.gometalinter:
GOPATH=${SYSTEM_GOPATH} go get github.com/alecthomas/gometalinter
GOPATH=${SYSTEM_GOPATH} gometalinter --install
validate: ## validate DCO, gofmt, ./pkg/ isolation, golint,\ngo vet and vendor using VMs
$(RUNINVM) make local-$@

.install.md2man:
GOPATH=${SYSTEM_GOPATH} go get github.com/cpuguy83/go-md2man
.PHONY: install.tools
install.tools:
go get -u $(BUILDFLAGS) github.com/cpuguy83/go-md2man
go get -u $(BUILDFLAGS) github.com/vbatts/git-validation
go get -u $(BUILDFLAGS) gopkg.in/alecthomas/gometalinter.v1
gometalinter.v1 -i

help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-z A-Z_-]+:.*?## / {gsub(" ",",",$$1);gsub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-21s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

4 changes: 2 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Vagrant.configure("2") do |config|
config.vm.define "fedora" do |c|
c.vm.box = "fedora/25-cloud-base"
c.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: "bundles", rsync__args: "-vadz"
rsync__exclude: "bundles", rsync__args: ["-vadz", "--delete"]
c.vm.provision "shell", inline: <<-SHELL
sudo /vagrant/vagrant/provision.sh
SHELL
end
config.vm.define "debian" do |c|
c.vm.box = "debian/jessie64"
c.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: "bundles", rsync__args: "-vadz"
rsync__exclude: "bundles", rsync__args: ["-vadz", "--delete"]
c.vm.provision "shell", inline: <<-SHELL
sudo /vagrant/vagrant/provision.sh
SHELL
Expand Down
23 changes: 11 additions & 12 deletions drivers/devmapper/deviceset.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/containers/storage/pkg/loopback"
"github.com/containers/storage/pkg/mount"
"github.com/containers/storage/pkg/parsers"
"github.com/containers/storage/storageversion"
"github.com/docker/go-units"

"github.com/opencontainers/selinux/go-selinux/label"
Expand Down Expand Up @@ -1668,17 +1667,17 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
}

// https://github.com/docker/docker/issues/4036
if supported := devicemapper.UdevSetSyncSupport(true); !supported {
if storageversion.IAmStatic == "true" {
logrus.Errorf("devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a dynamic binary to use devicemapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/daemon/#daemon-storage-driver-option")
} else {
logrus.Errorf("devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a more recent version of libdevmapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/daemon/#daemon-storage-driver-option")
}

if !devices.overrideUdevSyncCheck {
return graphdriver.ErrNotSupported
}
}
// if supported := devicemapper.UdevSetSyncSupport(true); !supported {
// if storageversion.IAmStatic == "true" {
// logrus.Errorf("devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a dynamic binary to use devicemapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/daemon/#daemon-storage-driver-option")
// } else {
// logrus.Errorf("devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a more recent version of libdevmapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/daemon/#daemon-storage-driver-option")
// }
//
// if !devices.overrideUdevSyncCheck {
// return graphdriver.ErrNotSupported
// }
// }

//create the root dir of the devmapper driver ownership to match this
//daemon's remapped root uid/gid so containers can start properly
Expand Down
35 changes: 0 additions & 35 deletions hack/Jenkins/W2L/postbuild.sh

This file was deleted.

Loading

0 comments on commit 230b9ab

Please sign in to comment.