summaryrefslogtreecommitdiffstats
path: root/deps
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-03-22 10:22:25 +0100
committerHarald Welte <laforge@gnumonks.org>2018-03-22 12:56:54 +0000
commita2b5449f97b8990a88fe7286c91a67cb5d3e9b9f (patch)
tree6138d2260732a4430a86bdaa5892b96a2ae01ccf /deps
parent3716a5e364545d3c022981414e15514b2bab962e (diff)
preserve uncommitted local changes in ttcn3 deps repositories
The previous Makefile rules would always overwrite uncommitted local changes within repositories under the deps directory. Let's assume that somebody who has local changes inside dependencies knows what they are doing, and eliminate the risk of discarding results of their work. Always skip repositories which contain local changes. Only print a warning about such repositories. Nothing changes for people who do not modify dependencies. While testing this change, I noticed that the 'make distclean' target was not reachable via 'make distclean', and I've fixed this as well. Related: OS#3090 Change-Id: I0ee4ed70868b1c1efa39ad2bf200bf59ae2a2019
Diffstat (limited to 'deps')
-rw-r--r--deps/Makefile15
1 files changed, 14 insertions, 1 deletions
diff --git a/deps/Makefile b/deps/Makefile
index b448c73..d607874 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -50,7 +50,6 @@ ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
# Tag names from 'git-describe --tags'; if not available, a commit hash may be used instead.
# In order to keep local changes in the repository of a dependency, set its commit to the
# name of a local branch here (e.g. 'master').
-# CAREFUL: 'make clean' WILL DISCARD UNCOMMITTED CHANGES IN THESE REPOSITORIES!
titan.Libraries.TCCUsefulFunctions_commit= R.30.A
titan.ProtocolEmulations.M3UA_commit= R.2.A
titan.ProtocolEmulations.SCCP_commit= 724c83fd2794e8ea362d08c42d9fc10fc1885ef1
@@ -93,30 +92,44 @@ titan.TestPorts.UNIX_DOMAIN_SOCKETasp_commit= R.2.A-3-g61e5a25
all: $(foreach dir,$(ALL_REPOS),$(dir)/update)
clean: $(foreach dir,$(ALL_REPOS),$(dir)/clean)
+distclean: $(foreach dir,$(ALL_REPOS),$(dir)/distclean)
define GIT_template
$(1)_ORIGIN!= if [ -d $(1) ]; then cd $(1) && git remote get-url origin; fi
$(1)_HEAD!= if [ -d $(1) ]; then cd $(1) && git describe --tags 2>/dev/null || git rev-parse HEAD; fi
+$(1)_MODIFIED!= if [ -d $(1) ]; then cd $(1) && git diff --quiet --exit-code || echo -n "1"; fi
$(1):
git clone $(2)/$(1)
.PHONY: $(1)/update
$(1)/update: $(1)
+ifeq ($$($(1)_MODIFIED),1)
+ @echo "WARNING: $(1) skipped because it contains uncommitted modifications!"
+else
ifneq ($$($(1)_ORIGIN),$(2)/$(1))
cd $(1) && git remote set-url origin $(2)/$(1) && git fetch
endif
ifneq ($$($(1)_HEAD),$($(1)_commit))
cd $(1) && git checkout -q -f "$($(1)_commit)"
endif
+endif
.PHONY: $(1)/clean
$(1)/clean: $(1)
+ifeq ($$($(1)_MODIFIED),1)
+ @echo "WARNING: $(1) skipped because it contains uncommitted modifications!"
+else
cd $(1) && git checkout -q -f "$($(1)_commit)" && git reset --hard
+endif
.PHONY: $(1)/distclean
$(1)/distclean:
+ifeq ($$($(1)_MODIFIED),1)
+ @echo "WARNING: $(1) skipped because it contains uncommitted modifications!"
+else
@rm -rf $(1)
+endif
endef
$(foreach dir,$(ECLIPSEGIT_REPOS), \