-.PHONY: check-cache-validity
-check-cache-validity:
- @if [ $(git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) | awk '{print $(NF-1)}') -ne $(cat $(CACHE_DIR)/.versions | grep odl | awk '{print $NF}') ]; then @echo "Cache is not up to date, stopping!"; exit 1; fi
+.PHONY: validate-cache
+validate-cache:
+ @REMOTE_ID=$(shell git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG)^{} | awk '{print $$(NF-1)}'); \
+ if [ -z $$REMOTE_ID ] || [ $$REMOTE_ID = " " ]; \
+ then \
+ REMOTE_ID=$(shell git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) | awk '{print $$(NF-1)}'); \
+ fi; \
+ if [ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep odl | awk '{print $$NF}') ]; \
+ then \
+ echo "Cache does not match upstream OpenDaylight, cache must be rebuilt!"; \
+ exit 1; \
+ fi