Skip to content

Instantly share code, notes, and snippets.

@matthiasr
Created January 13, 2016 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthiasr/8333ae8536036614265a to your computer and use it in GitHub Desktop.
Save matthiasr/8333ae8536036614265a to your computer and use it in GitHub Desktop.
Extract vendored kubernetes/kubernetes client library dependencies at build time
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
@matthiasr
Copy link
Author

This is for use with GOVENDOREXPERIMENT=1 instead of Godeps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment