@matheusbsbs / matheus-bagliano / commits / ea925196f1
Fork 0

build dashless "bin-wrappers" directory similar to installed bindir

The new bin-wrappers directory contains wrapper scripts for executables that will be installed into the standard bindir. It explicitly does not contain most dashed-commands. The scripts automatically set environment variables to run out of the source tree, not the installed directory. This will allow running the test suite without dashed commands in the PATH. It also provides a simplified way to test run custom built git executables without installing them first. bin-wrappers also contains wrappers for some test suite support executables, where the test suite will soon make use of them. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthew Ogilvie committed Dec 2, 2009 at 22:14 UTC ea925196f1bd3acaabaeaf384cc694337db97b2b
3 files changed +52 -13
.gitignore
+1
@@ -2,6 +2,7 @@
2 /GIT-CFLAGS
3 /GIT-GUI-VARS
4 /GIT-VERSION-FILE
5 +/bin-wrappers/
6 /git
7 /git-add
8 /git-add--interactive
Makefile
+36 -13
@@ -416,6 +416,15 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
416 # what 'all' will build but not install in gitexecdir
417 OTHER_PROGRAMS = git$X
418
419 +# what test wrappers are needed and 'install' will install, in bindir
420 +BINDIR_PROGRAMS_NEED_X += git
421 +BINDIR_PROGRAMS_NEED_X += git-upload-pack
422 +BINDIR_PROGRAMS_NEED_X += git-receive-pack
423 +BINDIR_PROGRAMS_NEED_X += git-upload-archive
424 +BINDIR_PROGRAMS_NEED_X += git-shell
425 +
426 +BINDIR_PROGRAMS_NO_X += git-cvsserver
427 +
428 # Set paths to tools early so that they can be used for version tests.
429 ifndef SHELL_PATH
430 SHELL_PATH = /bin/sh
@@ -1690,19 +1699,30 @@ endif
1699
1700 ### Testing rules
1701
1693 -TEST_PROGRAMS += test-chmtime$X
1694 -TEST_PROGRAMS += test-ctype$X
1695 -TEST_PROGRAMS += test-date$X
1696 -TEST_PROGRAMS += test-delta$X
1697 -TEST_PROGRAMS += test-dump-cache-tree$X
1698 -TEST_PROGRAMS += test-genrandom$X
1699 -TEST_PROGRAMS += test-match-trees$X
1700 -TEST_PROGRAMS += test-parse-options$X
1701 -TEST_PROGRAMS += test-path-utils$X
1702 -TEST_PROGRAMS += test-sha1$X
1703 -TEST_PROGRAMS += test-sigchain$X
1702 +TEST_PROGRAMS_NEED_X += test-chmtime
1703 +TEST_PROGRAMS_NEED_X += test-ctype
1704 +TEST_PROGRAMS_NEED_X += test-date
1705 +TEST_PROGRAMS_NEED_X += test-delta
1706 +TEST_PROGRAMS_NEED_X += test-dump-cache-tree
1707 +TEST_PROGRAMS_NEED_X += test-genrandom
1708 +TEST_PROGRAMS_NEED_X += test-match-trees
1709 +TEST_PROGRAMS_NEED_X += test-parse-options
1710 +TEST_PROGRAMS_NEED_X += test-path-utils
1711 +TEST_PROGRAMS_NEED_X += test-sha1
1712 +TEST_PROGRAMS_NEED_X += test-sigchain
1713 +
1714 +TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
1715
1705 -all:: $(TEST_PROGRAMS)
1716 +test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
1717 +
1718 +all:: $(TEST_PROGRAMS) $(test_bindir_programs)
1719 +
1720 +bin-wrappers/%: wrap-for-bin.sh
1721 + @mkdir -p bin-wrappers
1722 + $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1723 + -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
1724 + -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
1725 + chmod +x $@
1726
1727 # GNU make supports exporting all variables by "export" without parameters.
1728 # However, the environment gets quite big, and some programs have problems
@@ -1763,11 +1783,13 @@ endif
1783 gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
1784 export gitexec_instdir
1785
1786 +install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
1787 +
1788 install: all
1789 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1790 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1791 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1770 - $(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'
1792 + $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
1793 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
1794 ifndef NO_PERL
1795 $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
@@ -1878,6 +1900,7 @@ clean:
1900 $(LIB_FILE) $(XDIFF_LIB)
1901 $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1902 $(RM) $(TEST_PROGRAMS)
1903 + $(RM) -r bin-wrappers
1904 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
1905 $(RM) -r autom4te.cache
1906 $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
wrap-for-bin.sh new
+15
@@ -0,0 +1,15 @@
1 +#!/bin/sh
2 +
3 +# wrap-for-bin.sh: Template for git executable wrapper scripts
4 +# to run test suite against sandbox, but with only bindir-installed
5 +# executables in PATH. The Makefile copies this into various
6 +# files in bin-wrappers, substituting
7 +# @@BUILD_DIR@@ and @@PROG@@.
8 +
9 +GIT_EXEC_PATH='@@BUILD_DIR@@'
10 +GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
11 +GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'
12 +PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
13 +export GIT_EXEC_PATH GIT_TEMPLATE_DIR GITPERLLIB PATH
14 +
15 +exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"