Merge branch 'mo/bin-wrappers'
* mo/bin-wrappers: INSTALL: document a simpler way to run uninstalled builds run test suite without dashed git-commands in PATH build dashless "bin-wrappers" directory similar to installed bindir
This commit is contained in:
commit
79f6ce5717
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
/GIT-CFLAGS
|
/GIT-CFLAGS
|
||||||
/GIT-GUI-VARS
|
/GIT-GUI-VARS
|
||||||
/GIT-VERSION-FILE
|
/GIT-VERSION-FILE
|
||||||
|
/bin-wrappers/
|
||||||
/git
|
/git
|
||||||
/git-add
|
/git-add
|
||||||
/git-add--interactive
|
/git-add--interactive
|
||||||
|
18
INSTALL
18
INSTALL
@ -38,13 +38,17 @@ Issues of note:
|
|||||||
Interactive Tools package still can install "git", but you can build it
|
Interactive Tools package still can install "git", but you can build it
|
||||||
with --disable-transition option to avoid this.
|
with --disable-transition option to avoid this.
|
||||||
|
|
||||||
- You can use git after building but without installing if you
|
- You can use git after building but without installing if you want
|
||||||
wanted to. Various git commands need to find other git
|
to test drive it. Simply run git found in bin-wrappers directory
|
||||||
commands and scripts to do their work, so you would need to
|
in the build directory, or prepend that directory to your $PATH.
|
||||||
arrange a few environment variables to tell them that their
|
This however is less efficient than running an installed git, as
|
||||||
friends will be found in your built source area instead of at
|
you always need an extra fork+exec to run any git subcommand.
|
||||||
their standard installation area. Something like this works
|
|
||||||
for me:
|
It is still possible to use git without installing by setting a few
|
||||||
|
environment variables, which was the way this was done
|
||||||
|
traditionally. But using git found in bin-wrappers directory in
|
||||||
|
the build directory is far simpler. As a historical reference, the
|
||||||
|
old way went like this:
|
||||||
|
|
||||||
GIT_EXEC_PATH=`pwd`
|
GIT_EXEC_PATH=`pwd`
|
||||||
PATH=`pwd`:$PATH
|
PATH=`pwd`:$PATH
|
||||||
|
49
Makefile
49
Makefile
@ -431,6 +431,15 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
|
|||||||
# what 'all' will build but not install in gitexecdir
|
# what 'all' will build but not install in gitexecdir
|
||||||
OTHER_PROGRAMS = git$X
|
OTHER_PROGRAMS = git$X
|
||||||
|
|
||||||
|
# what test wrappers are needed and 'install' will install, in bindir
|
||||||
|
BINDIR_PROGRAMS_NEED_X += git
|
||||||
|
BINDIR_PROGRAMS_NEED_X += git-upload-pack
|
||||||
|
BINDIR_PROGRAMS_NEED_X += git-receive-pack
|
||||||
|
BINDIR_PROGRAMS_NEED_X += git-upload-archive
|
||||||
|
BINDIR_PROGRAMS_NEED_X += git-shell
|
||||||
|
|
||||||
|
BINDIR_PROGRAMS_NO_X += git-cvsserver
|
||||||
|
|
||||||
# Set paths to tools early so that they can be used for version tests.
|
# Set paths to tools early so that they can be used for version tests.
|
||||||
ifndef SHELL_PATH
|
ifndef SHELL_PATH
|
||||||
SHELL_PATH = /bin/sh
|
SHELL_PATH = /bin/sh
|
||||||
@ -1762,19 +1771,30 @@ endif
|
|||||||
|
|
||||||
### Testing rules
|
### Testing rules
|
||||||
|
|
||||||
TEST_PROGRAMS += test-chmtime$X
|
TEST_PROGRAMS_NEED_X += test-chmtime
|
||||||
TEST_PROGRAMS += test-ctype$X
|
TEST_PROGRAMS_NEED_X += test-ctype
|
||||||
TEST_PROGRAMS += test-date$X
|
TEST_PROGRAMS_NEED_X += test-date
|
||||||
TEST_PROGRAMS += test-delta$X
|
TEST_PROGRAMS_NEED_X += test-delta
|
||||||
TEST_PROGRAMS += test-dump-cache-tree$X
|
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
|
||||||
TEST_PROGRAMS += test-genrandom$X
|
TEST_PROGRAMS_NEED_X += test-genrandom
|
||||||
TEST_PROGRAMS += test-match-trees$X
|
TEST_PROGRAMS_NEED_X += test-match-trees
|
||||||
TEST_PROGRAMS += test-parse-options$X
|
TEST_PROGRAMS_NEED_X += test-parse-options
|
||||||
TEST_PROGRAMS += test-path-utils$X
|
TEST_PROGRAMS_NEED_X += test-path-utils
|
||||||
TEST_PROGRAMS += test-sha1$X
|
TEST_PROGRAMS_NEED_X += test-sha1
|
||||||
TEST_PROGRAMS += test-sigchain$X
|
TEST_PROGRAMS_NEED_X += test-sigchain
|
||||||
|
|
||||||
all:: $(TEST_PROGRAMS)
|
TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
|
||||||
|
|
||||||
|
test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
|
||||||
|
|
||||||
|
all:: $(TEST_PROGRAMS) $(test_bindir_programs)
|
||||||
|
|
||||||
|
bin-wrappers/%: wrap-for-bin.sh
|
||||||
|
@mkdir -p bin-wrappers
|
||||||
|
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
||||||
|
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
|
||||||
|
-e 's|@@PROG@@|$(@F)|' < $< > $@ && \
|
||||||
|
chmod +x $@
|
||||||
|
|
||||||
# GNU make supports exporting all variables by "export" without parameters.
|
# GNU make supports exporting all variables by "export" without parameters.
|
||||||
# However, the environment gets quite big, and some programs have problems
|
# However, the environment gets quite big, and some programs have problems
|
||||||
@ -1835,11 +1855,13 @@ endif
|
|||||||
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
|
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
|
||||||
export gitexec_instdir
|
export gitexec_instdir
|
||||||
|
|
||||||
|
install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
||||||
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
||||||
$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'
|
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||||
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
|
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
|
||||||
ifndef NO_PERL
|
ifndef NO_PERL
|
||||||
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
|
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
|
||||||
@ -1953,6 +1975,7 @@ clean:
|
|||||||
$(LIB_FILE) $(XDIFF_LIB)
|
$(LIB_FILE) $(XDIFF_LIB)
|
||||||
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
|
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
|
||||||
$(RM) $(TEST_PROGRAMS)
|
$(RM) $(TEST_PROGRAMS)
|
||||||
|
$(RM) -r bin-wrappers
|
||||||
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
|
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
|
||||||
$(RM) -r autom4te.cache
|
$(RM) -r autom4te.cache
|
||||||
$(RM) config.log config.mak.autogen config.mak.append config.status config.cache
|
$(RM) config.log config.mak.autogen config.mak.append config.status config.cache
|
||||||
|
9
t/README
9
t/README
@ -75,6 +75,15 @@ appropriately before running "make".
|
|||||||
As the names depend on the tests' file names, it is safe to
|
As the names depend on the tests' file names, it is safe to
|
||||||
run the tests with this option in parallel.
|
run the tests with this option in parallel.
|
||||||
|
|
||||||
|
--with-dashes::
|
||||||
|
By default tests are run without dashed forms of
|
||||||
|
commands (like git-commit) in the PATH (it only uses
|
||||||
|
wrappers from ../bin-wrappers). Use this option to include
|
||||||
|
the build directory (..) in the PATH, which contains all
|
||||||
|
the dashed forms of commands. This option is currently
|
||||||
|
implied by other options like --valgrind and
|
||||||
|
GIT_TEST_INSTALLED.
|
||||||
|
|
||||||
You can also set the GIT_TEST_INSTALLED environment variable to
|
You can also set the GIT_TEST_INSTALLED environment variable to
|
||||||
the bindir of an existing git installation to test that installation.
|
the bindir of an existing git installation to test that installation.
|
||||||
You still need to have built this git sandbox, from which various
|
You still need to have built this git sandbox, from which various
|
||||||
|
@ -105,6 +105,8 @@ do
|
|||||||
verbose=t; shift ;;
|
verbose=t; shift ;;
|
||||||
-q|--q|--qu|--qui|--quie|--quiet)
|
-q|--q|--qu|--qui|--quie|--quiet)
|
||||||
quiet=t; shift ;;
|
quiet=t; shift ;;
|
||||||
|
--with-dashes)
|
||||||
|
with_dashes=t; shift ;;
|
||||||
--no-color)
|
--no-color)
|
||||||
color=; shift ;;
|
color=; shift ;;
|
||||||
--no-python)
|
--no-python)
|
||||||
@ -562,19 +564,8 @@ test_done () {
|
|||||||
# Test the binaries we have just built. The tests are kept in
|
# Test the binaries we have just built. The tests are kept in
|
||||||
# t/ subdirectory and are run in 'trash directory' subdirectory.
|
# t/ subdirectory and are run in 'trash directory' subdirectory.
|
||||||
TEST_DIRECTORY=$(pwd)
|
TEST_DIRECTORY=$(pwd)
|
||||||
if test -z "$valgrind"
|
if test -n "$valgrind"
|
||||||
then
|
then
|
||||||
if test -z "$GIT_TEST_INSTALLED"
|
|
||||||
then
|
|
||||||
PATH=$TEST_DIRECTORY/..:$PATH
|
|
||||||
GIT_EXEC_PATH=$TEST_DIRECTORY/..
|
|
||||||
else
|
|
||||||
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
|
||||||
error "Cannot run git from $GIT_TEST_INSTALLED."
|
|
||||||
PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
|
|
||||||
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
make_symlink () {
|
make_symlink () {
|
||||||
test -h "$2" &&
|
test -h "$2" &&
|
||||||
test "$1" = "$(readlink "$2")" || {
|
test "$1" = "$(readlink "$2")" || {
|
||||||
@ -636,6 +627,24 @@ else
|
|||||||
PATH=$GIT_VALGRIND/bin:$PATH
|
PATH=$GIT_VALGRIND/bin:$PATH
|
||||||
GIT_EXEC_PATH=$GIT_VALGRIND/bin
|
GIT_EXEC_PATH=$GIT_VALGRIND/bin
|
||||||
export GIT_VALGRIND
|
export GIT_VALGRIND
|
||||||
|
elif test -n "$GIT_TEST_INSTALLED" ; then
|
||||||
|
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
||||||
|
error "Cannot run git from $GIT_TEST_INSTALLED."
|
||||||
|
PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
|
||||||
|
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
||||||
|
else # normal case, use ../bin-wrappers only unless $with_dashes:
|
||||||
|
git_bin_dir="$TEST_DIRECTORY/../bin-wrappers"
|
||||||
|
if ! test -x "$git_bin_dir/git" ; then
|
||||||
|
if test -z "$with_dashes" ; then
|
||||||
|
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
|
||||||
|
fi
|
||||||
|
with_dashes=t
|
||||||
|
fi
|
||||||
|
PATH="$git_bin_dir:$PATH"
|
||||||
|
GIT_EXEC_PATH=$TEST_DIRECTORY/..
|
||||||
|
if test -n "$with_dashes" ; then
|
||||||
|
PATH="$TEST_DIRECTORY/..:$PATH"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
|
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
|
||||||
unset GIT_CONFIG
|
unset GIT_CONFIG
|
||||||
|
15
wrap-for-bin.sh
Normal file
15
wrap-for-bin.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# wrap-for-bin.sh: Template for git executable wrapper scripts
|
||||||
|
# to run test suite against sandbox, but with only bindir-installed
|
||||||
|
# executables in PATH. The Makefile copies this into various
|
||||||
|
# files in bin-wrappers, substituting
|
||||||
|
# @@BUILD_DIR@@ and @@PROG@@.
|
||||||
|
|
||||||
|
GIT_EXEC_PATH='@@BUILD_DIR@@'
|
||||||
|
GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
|
||||||
|
GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'
|
||||||
|
PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
|
||||||
|
export GIT_EXEC_PATH GIT_TEMPLATE_DIR GITPERLLIB PATH
|
||||||
|
|
||||||
|
exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
|
Loading…
Reference in New Issue
Block a user