{"thread":{"id":"21836","subject":"[PATCH v3 1/3] build dashless \"bin-wrappers\" directory similar to installed bindir","startedAt":"2009-12-03T05:14:04Z","lastAt":"2009-12-03T05:14:07Z","messageCount":4,"participants":["Matthew Ogilvie"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"129099","messageId":"1259817247-3724-1-git-send-email-mmogilvi_git@miniinfo.net","threadId":"21836","inReplyTo":null,"subject":"[PATCH v3 0/3] bin-wrappers: test without dashed commands in PATH","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-12-03T05:14:04Z","receivedAt":"2009-12-03T05:14:04Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"This patch series allows running the test suite and/or running an\nuninstalled build without dashed commands in the PATH.\n\nChanges since version 2:\n\n   merged - The first 3 old patches (fixes to tests to avoid dashed\n         commands, and added GIT_TEST_INSTALLED documentation) are\n         now in master, so I am not duplicating them here.\n\n   1/3 - Changed to use \"@@BUILD_DIR@@\" instead of \"__GIT_EXEC_DIR__\"\n         for sed substitution, and to use single quotes around it\n         when setting environment variables in wrap-for-bin.sh.\n         But this patch still does not really try to handle\n         strange characters in $(shell pwd); see earlier email\n         thread about this.  (This is newer than pu.)\n\n   2/3 - Fixed a couple of spelling errors in the --with-dashes\n         documentation, and avoid \"TOP\".  (This is newer than pu.)\n\n   3/3 - Replaced wording for running an uninstalled git.\n         It now uses Junio's text: no change compared to his\n         version of this patch that is currently in pu.\n\nMatthew Ogilvie (3):\n  build dashless \"bin-wrappers\" directory similar to installed bindir\n  run test suite without dashed git-commands in PATH\n  INSTALL: document a simpler way to run uninstalled builds\n\n .gitignore      |    1 +\n INSTALL         |   18 +++++++++++-------\n Makefile        |   49 ++++++++++++++++++++++++++++++++++++-------------\n t/README        |    9 +++++++++\n t/test-lib.sh   |   33 +++++++++++++++++++++------------\n wrap-for-bin.sh |   15 +++++++++++++++\n 6 files changed, 93 insertions(+), 32 deletions(-)\n create mode 100644 wrap-for-bin.sh\n"},{"id":"129098","messageId":"1259817247-3724-2-git-send-email-mmogilvi_git@miniinfo.net","threadId":"21836","inReplyTo":"1259817247-3724-1-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH v3 1/3] build dashless \"bin-wrappers\" directory similar to installed bindir","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-12-03T05:14:05Z","receivedAt":"2009-12-03T05:14:05Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"The new bin-wrappers directory contains wrapper scripts\nfor executables that will be installed into the standard\nbindir.  It explicitly does not contain most dashed-commands.\nThe scripts automatically set environment variables to run out\nof the source tree, not the installed directory.\n\nThis will allow running the test suite without dashed commands in\nthe PATH.  It also provides a simplified way to test run custom\nbuilt git executables without installing them first.\n\nbin-wrappers also contains wrappers for some test suite support\nexecutables, where the test suite will soon make use of them.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n .gitignore      |    1 +\n Makefile        |   49 ++++++++++++++++++++++++++++++++++++-------------\n wrap-for-bin.sh |   15 +++++++++++++++\n 3 files changed, 52 insertions(+), 13 deletions(-)\n create mode 100644 wrap-for-bin.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex ac02a58..5d32289 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -2,6 +2,7 @@\n /GIT-CFLAGS\n /GIT-GUI-VARS\n /GIT-VERSION-FILE\n+/bin-wrappers/\n /git\n /git-add\n /git-add--interactive\ndiff --git a/Makefile b/Makefile\nindex 4a1e5bc..378962e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -427,6 +427,15 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)\n # what 'all' will build but not install in gitexecdir\n OTHER_PROGRAMS = git$X\n \n+# what test wrappers are needed and 'install' will install, in bindir\n+BINDIR_PROGRAMS_NEED_X += git\n+BINDIR_PROGRAMS_NEED_X += git-upload-pack\n+BINDIR_PROGRAMS_NEED_X += git-receive-pack\n+BINDIR_PROGRAMS_NEED_X += git-upload-archive\n+BINDIR_PROGRAMS_NEED_X += git-shell\n+\n+BINDIR_PROGRAMS_NO_X += git-cvsserver\n+\n # Set paths to tools early so that they can be used for version tests.\n ifndef SHELL_PATH\n \tSHELL_PATH = /bin/sh\n@@ -1714,19 +1723,30 @@ endif\n \n ### Testing rules\n \n-TEST_PROGRAMS += test-chmtime$X\n-TEST_PROGRAMS += test-ctype$X\n-TEST_PROGRAMS += test-date$X\n-TEST_PROGRAMS += test-delta$X\n-TEST_PROGRAMS += test-dump-cache-tree$X\n-TEST_PROGRAMS += test-genrandom$X\n-TEST_PROGRAMS += test-match-trees$X\n-TEST_PROGRAMS += test-parse-options$X\n-TEST_PROGRAMS += test-path-utils$X\n-TEST_PROGRAMS += test-sha1$X\n-TEST_PROGRAMS += test-sigchain$X\n+TEST_PROGRAMS_NEED_X += test-chmtime\n+TEST_PROGRAMS_NEED_X += test-ctype\n+TEST_PROGRAMS_NEED_X += test-date\n+TEST_PROGRAMS_NEED_X += test-delta\n+TEST_PROGRAMS_NEED_X += test-dump-cache-tree\n+TEST_PROGRAMS_NEED_X += test-genrandom\n+TEST_PROGRAMS_NEED_X += test-match-trees\n+TEST_PROGRAMS_NEED_X += test-parse-options\n+TEST_PROGRAMS_NEED_X += test-path-utils\n+TEST_PROGRAMS_NEED_X += test-sha1\n+TEST_PROGRAMS_NEED_X += test-sigchain\n+\n+TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))\n \n-all:: $(TEST_PROGRAMS)\n+test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))\n+\n+all:: $(TEST_PROGRAMS) $(test_bindir_programs)\n+\n+bin-wrappers/%: wrap-for-bin.sh\n+\t@mkdir -p bin-wrappers\n+\t$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n+\t     -e 's|@@BUILD_DIR@@|$(shell pwd)|' \\\n+\t     -e 's|@@PROG@@|$(@F)|' < $< > $@ && \\\n+\tchmod +x $@\n \n # GNU make supports exporting all variables by \"export\" without parameters.\n # However, the environment gets quite big, and some programs have problems\n@@ -1787,11 +1807,13 @@ endif\n gitexec_instdir_SQ = $(subst ','\\'',$(gitexec_instdir))\n export gitexec_instdir\n \n+install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)\n+\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n-\t$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'\n+\t$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n ifndef NO_PERL\n \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n@@ -1902,6 +1924,7 @@ clean:\n \t\t$(LIB_FILE) $(XDIFF_LIB)\n \t$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X\n \t$(RM) $(TEST_PROGRAMS)\n+\t$(RM) -r bin-wrappers\n \t$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*\n \t$(RM) -r autom4te.cache\n \t$(RM) config.log config.mak.autogen config.mak.append config.status config.cache\ndiff --git a/wrap-for-bin.sh b/wrap-for-bin.sh\nnew file mode 100644\nindex 0000000..c5075c9\n--- /dev/null\n+++ b/wrap-for-bin.sh\n@@ -0,0 +1,15 @@\n+#!/bin/sh\n+\n+# wrap-for-bin.sh: Template for git executable wrapper scripts\n+# to run test suite against sandbox, but with only bindir-installed\n+# executables in PATH.  The Makefile copies this into various\n+# files in bin-wrappers, substituting\n+# @@BUILD_DIR@@ and @@PROG@@.\n+\n+GIT_EXEC_PATH='@@BUILD_DIR@@'\n+GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'\n+GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'\n+PATH='@@BUILD_DIR@@/bin-wrappers:'\"$PATH\"\n+export GIT_EXEC_PATH GIT_TEMPLATE_DIR GITPERLLIB PATH\n+\n+exec \"${GIT_EXEC_PATH}/@@PROG@@\" \"$@\"\n-- \n1.6.6.rc1\n"},{"id":"129101","messageId":"1259817247-3724-3-git-send-email-mmogilvi_git@miniinfo.net","threadId":"21836","inReplyTo":"1259817247-3724-2-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH v3 2/3] run test suite without dashed git-commands in PATH","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-12-03T05:14:06Z","receivedAt":"2009-12-03T05:14:06Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"Only put bin-wrappers in the PATH (not GIT_EXEC_PATH), to emulate the\ndefault installed user environment, and ensure all the programs run\ncorrectly in such an environment.  This is now the default, although\nit can be overridden with a --with-dashes test option when running\ntests.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n t/README      |    9 +++++++++\n t/test-lib.sh |   33 +++++++++++++++++++++------------\n 2 files changed, 30 insertions(+), 12 deletions(-)\n\ndiff --git a/t/README b/t/README\nindex 4e1d7dd..dcd3ebb 100644\n--- a/t/README\n+++ b/t/README\n@@ -75,6 +75,15 @@ appropriately before running \"make\".\n \tAs the names depend on the tests' file names, it is safe to\n \trun the tests with this option in parallel.\n \n+--with-dashes::\n+\tBy default tests are run without dashed forms of\n+\tcommands (like git-commit) in the PATH (it only uses\n+\twrappers from ../bin-wrappers).  Use this option to include\n+\tthe build directory (..) in the PATH, which contains all\n+\tthe dashed forms of commands.  This option is currently\n+\timplied by other options like --valgrind and\n+\tGIT_TEST_INSTALLED.\n+\n You can also set the GIT_TEST_INSTALLED environment variable to\n the bindir of an existing git installation to test that installation.\n You still need to have built this git sandbox, from which various\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex ec3336a..85377c8 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -105,6 +105,8 @@ do\n \t\tverbose=t; shift ;;\n \t-q|--q|--qu|--qui|--quie|--quiet)\n \t\tquiet=t; shift ;;\n+\t--with-dashes)\n+\t\twith_dashes=t; shift ;;\n \t--no-color)\n \t\tcolor=; shift ;;\n \t--no-python)\n@@ -551,19 +553,8 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n TEST_DIRECTORY=$(pwd)\n-if test -z \"$valgrind\"\n+if test -n \"$valgrind\"\n then\n-\tif test -z \"$GIT_TEST_INSTALLED\"\n-\tthen\n-\t\tPATH=$TEST_DIRECTORY/..:$PATH\n-\t\tGIT_EXEC_PATH=$TEST_DIRECTORY/..\n-\telse\n-\t\tGIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||\n-\t\terror \"Cannot run git from $GIT_TEST_INSTALLED.\"\n-\t\tPATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH\n-\t\tGIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}\n-\tfi\n-else\n \tmake_symlink () {\n \t\ttest -h \"$2\" &&\n \t\ttest \"$1\" = \"$(readlink \"$2\")\" || {\n@@ -625,6 +616,24 @@ else\n \tPATH=$GIT_VALGRIND/bin:$PATH\n \tGIT_EXEC_PATH=$GIT_VALGRIND/bin\n \texport GIT_VALGRIND\n+elif test -n \"$GIT_TEST_INSTALLED\" ; then\n+\tGIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||\n+\terror \"Cannot run git from $GIT_TEST_INSTALLED.\"\n+\tPATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH\n+\tGIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}\n+else # normal case, use ../bin-wrappers only unless $with_dashes:\n+\tgit_bin_dir=\"$TEST_DIRECTORY/../bin-wrappers\"\n+\tif ! test -x \"$git_bin_dir/git\" ; then\n+\t\tif test -z \"$with_dashes\" ; then\n+\t\t\tsay \"$git_bin_dir/git is not executable; using GIT_EXEC_PATH\"\n+\t\tfi\n+\t\twith_dashes=t\n+\tfi\n+\tPATH=\"$git_bin_dir:$PATH\"\n+\tGIT_EXEC_PATH=$TEST_DIRECTORY/..\n+\tif test -n \"$with_dashes\" ; then\n+\t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n+\tfi\n fi\n GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n unset GIT_CONFIG\n-- \n1.6.6.rc1\n"},{"id":"129100","messageId":"1259817247-3724-4-git-send-email-mmogilvi_git@miniinfo.net","threadId":"21836","inReplyTo":"1259817247-3724-3-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH v3 3/3] INSTALL: document a simpler way to run uninstalled builds","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-12-03T05:14:07Z","receivedAt":"2009-12-03T05:14:07Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"The new scripts automatically saved in the bin-wrappers directory allow\nyou to run a build when you have neither installed git nor tweaked\nenvironment variables.  Mention this in INSTALL, along with the slight\nperformance issue of doing so.\n\nThis can be especially handy for manually testing network-invoked git\n(from ssh, web servers, or similar), but it is also handy with a plain\ncommand prompt.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n INSTALL |   18 +++++++++++-------\n 1 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/INSTALL b/INSTALL\nindex be504c9..61086ab 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -38,13 +38,17 @@ Issues of note:\n    Interactive Tools package still can install \"git\", but you can build it\n    with --disable-transition option to avoid this.\n \n- - You can use git after building but without installing if you\n-   wanted to.  Various git commands need to find other git\n-   commands and scripts to do their work, so you would need to\n-   arrange a few environment variables to tell them that their\n-   friends will be found in your built source area instead of at\n-   their standard installation area.  Something like this works\n-   for me:\n+ - You can use git after building but without installing if you want\n+   to test drive it.  Simply run git found in bin-wrappers directory\n+   in the build directory, or prepend that directory to your $PATH.\n+   This however is less efficient than running an installed git, as\n+   you always need an extra fork+exec to run any git subcommand.\n+\n+   It is still possible to use git without installing by setting a few\n+   environment variables, which was the way this was done\n+   traditionally.  But using git found in bin-wrappers directory in\n+   the build directory is far simpler.  As a historical reference, the\n+   old way went like this:\n \n \tGIT_EXEC_PATH=`pwd`\n \tPATH=`pwd`:$PATH\n-- \n1.6.6.rc1\n"}]}