projects-dir.mk: Support CLONE_FROM_USER, PROJECTS

Add support for environment variables CLONE_FROM_USER and PROJECTS.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2015-06-12 15:22:25 +00:00
commit e49351a515

View file

@ -1,14 +1,22 @@
ifneq ($(PROJECTS),)
export PGIT_CLONE_PROJECTS = $(PROJECTS)
endif
ifneq ($(CLONE_FROM_USER),)
export PGIT_CLONE_FROM_USER = $(CLONE_FROM_USER)
endif
ifneq ($(wildcard projects.txt),) ifneq ($(wildcard projects.txt),)
PROJECTS = $(shell cat projects.txt | sed '/^ *\#/ d') PROJECTS = $(shell cat projects.txt | sed '/^ *\#/ d')
# TODO: this could be nicer # TODO: this could be nicer
CVS_PROJECTS = $(PROJECTS) CVS_PROJECTS = $(PROJECTS)
else else
PROJECTS = $(dir $(wildcard */CVS */.git)) PROJECTS ?= $(dir $(wildcard */CVS */.git))
CVS_PROJECTS = $(dir $(wildcard */CVS)) CVS_PROJECTS = $(filter $(dir $(wildcard */CVS)),$(PROJECTS))
endif endif
WHOAMI = $(shell id -un) WHOAMI = $(shell id -un)
RGIT = /bin/bash $(firstword $(wildcard ./ytools/devutil/scripts/pgit.sh /opt/ytools/bin/pgit.sh)) PGIT = CLONE_PROJECTS="$(PROJECTS)" CLONE_FROM_USER="$(shell whoami)" /bin/bash $(firstword $(wildcard ./ytools/devutil/scripts/pgit.sh /opt/ytools/bin/pgit.sh))
all: all:
for p in $(PROJECTS); do make -C $$p || break; done for p in $(PROJECTS); do make -C $$p || break; done
@ -24,22 +32,22 @@ cpp:
done done
clone diff commit push: clone diff commit push:
$(RGIT) $@ $(PGIT) $@
git-push: git-push:
$(RGIT) push $(PGIT) push
update pull: update pull:
cvs update -dP $(CVS_PROJECTS) cvs update -dP $(CVS_PROJECTS)
$(RGIT) pull $(PGIT) pull
git-pull: git-pull:
$(RGIT) pull $(PGIT) pull
status: status:
for p in $(CVS_PROJECTS); do test -f $$d/CVS || echo $$p; done for p in $(CVS_PROJECTS); do test -f $$d/CVS || echo $$p; done
cvs status $(addsuffix VERSION,$(CVS_PROJECTS)) cvs status $(addsuffix VERSION,$(CVS_PROJECTS))
$(RGIT) status $(PGIT) status
git-conv-%: git-conv-%:
mv $* old/ mv $* old/