Created
January 13, 2016 15:22
-
-
Save matthiasr/8333ae8536036614265a to your computer and use it in GitHub Desktop.
Extract vendored kubernetes/kubernetes client library dependencies at build time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KUBERNETES_VERSION ?= v1.1.3 | |
KUBERNETES_SOURCE_URL = https://github.com/kubernetes/kubernetes/archive/v$(KUBERNETES_VERSION).tar.gz | |
LOCAL_SOURCES := $(shell find local -type f) | |
.PHONY: prepare | |
prepare: vendor/k8s.io/kubernetes/.available vendor/k8s.io/kubernetes/.lifted_godeps $(LOCAL_SOURCES:local/%=vendor/%) | |
# Lift a source tree into the vendor tree, skipping Godeps | |
vendor/%/.available: build/$(KUBERNETES_VERSION)/%/.available | |
mkdir -p $(@D) | |
rsync -a --exclude=Godeps $(<D)/ $(@D) | |
# For a given source tree, lift all its godeps into the vendor tree | |
vendor/%/.lifted_godeps: build/$(KUBERNETES_VERSION)/%/.available | |
mkdir -p vendor/ | |
find $(<D) -type d -name Godeps -exec rsync -a '{}/_workspace/src/' vendor/ ';' | |
touch $@ | |
vendor/%: local/% | |
mkdir -p $(@D) | |
cp $< $@ | |
build/$(KUBERNETES_VERSION)/k8s.io/kubernetes/.available: | |
mkdir -p $(@D) | |
curl -sSLf $(KUBERNETES_SOURCE_URL) |\ | |
tar --wildcards -C $(@D) --strip-components=1 -zx | |
touch $@ | |
.PHONY: clean | |
clean:: | |
rm -rf build vendor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is for use with
GOVENDOREXPERIMENT=1
instead of Godeps.