git-cvs*: Make building (and testing) of CVS interface scripts optionally selectable
PATCH 1/1 git-cvs*: Make building (and testing) of CVS interface scripts optionally selectable
Presently, the CVS interface scripts are always built, and their test-suites run based on a binary named 'cvs' happening to return zero. If there something other than the real CVS there, bad things happened during the test-suite run.
This patch implements NO_CVS in the manner of NO_PERL, and ensures that the CVS scripts get the unimplemented variant when appropriate, as well as making sure that the tests properly declare CVS as a prerequisite (shortcut to test_done like the Perl prerequisites).
X-Gentoo-Bug: 350330
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=350330
--- Makefile | 37 ++++++++++++++++++++++++-------- t/t9200-git-cvsexportcommit.sh | 5 ++++ t/t9400-git-cvsserver-server.sh | 8 ++++++- t/t9401-git-cvsserver-crlf.sh | 15 ++++++++---- t/t9600-cvsimport.sh | 41 ++++++++++++++++++++++------------- t/t9601-cvsimport-vendor-branch.sh | 11 +++++++++ t/t9602-cvsimport-branches-tags.sh | 11 +++++++++ t/t9603-cvsimport-patchsets.sh | 11 +++++++++ t/test-lib.sh | 1 + 9 files changed, 110 insertions(+), 30 deletions(-)
Makefile +28 -9
@@ -188,6 +188,8 @@ all:: # # Define NO_TCLTK if you do not want Tcl/Tk GUI. # +# Define NO_CVS if you do not want any CVS interface utilities. +# # The TCL_PATH variable governs the location of the Tcl interpreter # used to optimize git-gui for your system. Only used if NO_TCLTK # is not set. Defaults to the bare 'tclsh'.
@@ -347,6 +349,7 @@ LIB_OBJS = PROGRAM_OBJS = PROGRAMS = SCRIPT_PERL = +SCRIPT_PERL_CVS = SCRIPT_PYTHON = SCRIPT_SH = SCRIPT_LIB =
@@ -384,17 +387,18 @@ SCRIPT_LIB += git-sh-setup SCRIPT_PERL += git-add--interactive.perl SCRIPT_PERL += git-difftool.perl SCRIPT_PERL += git-archimport.perl -SCRIPT_PERL += git-cvsexportcommit.perl -SCRIPT_PERL += git-cvsimport.perl -SCRIPT_PERL += git-cvsserver.perl SCRIPT_PERL += git-relink.perl SCRIPT_PERL += git-send-email.perl SCRIPT_PERL += git-svn.perl +SCRIPT_PERL_CVS += git-cvsexportcommit.perl +SCRIPT_PERL_CVS += git-cvsimport.perl +SCRIPT_PERL_CVS += git-cvsserver.perl + SCRIPT_PYTHON += git-remote-testgit.py SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ - $(patsubst %.perl,%,$(SCRIPT_PERL)) \ + $(patsubst %.perl,%,$(SCRIPT_PERL) $(SCRIPT_PERL_CVS)) \ $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ git-instaweb
@@ -1721,13 +1725,25 @@ $(SCRIPT_LIB) : % : %.sh $(QUIET_GEN)$(cmd_munge_script) && \ mv $@+ $@ +_SCRIPT_PERL_BUILD = +_SCRIPT_PERL_NOBUILD = + ifndef NO_PERL -$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak + +_SCRIPT_PERL_BUILD += $(SCRIPT_PERL) + +ifndef NO_CVS +_SCRIPT_PERL_BUILD += $(SCRIPT_PERL_CVS) +else # NO_CVS +_SCRIPT_PERL_NOBUILD += $(SCRIPT_PERL_CVS) +endif # NO_CVS + +$(patsubst %.perl,%,$(_SCRIPT_PERL_BUILD)): perl/perl.mak perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F) -$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl +$(patsubst %.perl,%,$(_SCRIPT_PERL_BUILD)): % : %.perl $(QUIET_GEN)$(RM) $@ $@+ && \ INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \ sed -e '1{' \
@@ -1784,14 +1800,17 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/ chmod +x $@+ && \ mv $@+ $@ else # NO_PERL -$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh +_SCRIPT_PERL_NOBUILD += $(SCRIPT_PERL) $(SCRIPT_PERL_CVS) git-instaweb +endif # NO_PERL + +# This is any perl scripts that were disabled it might be empty... +$(patsubst %.perl,%,$(_SCRIPT_PERL_NOBUILD)): % : unimplemented.sh $(QUIET_GEN)$(RM) $@ $@+ && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ -endif # NO_PERL ifndef NO_PYTHON $(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
@@ -1826,7 +1845,7 @@ configure: configure.ac # These can record GIT_VERSION git.o git.spec \ $(patsubst %.sh,%,$(SCRIPT_SH)) \ - $(patsubst %.perl,%,$(SCRIPT_PERL)) \ + $(patsubst %.perl,%,$(SCRIPT_PERL) $(SCRIPT_PERL_CVS)) \ : GIT-VERSION-FILE TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
t/t9200-git-cvsexportcommit.sh +5 -0
@@ -12,6 +12,11 @@ if ! test_have_prereq PERL; then test_done fi +if ! test_have_prereq CVS; then + skip_all='skipping git cvsexportcommit tests, cvs not available' + test_done +fi + cvs >/dev/null 2>&1 if test $? -ne 1 then
t/t9400-git-cvsserver-server.sh +7 -1
@@ -11,9 +11,15 @@ cvs CLI client via git-cvsserver server' . ./test-lib.sh if ! test_have_prereq PERL; then - skip_all='skipping git cvsserver tests, perl not available' + skip_all='skipping git-cvsserver tests, perl not available' test_done fi + +if ! test_have_prereq CVS; then + skip_all='skipping git-cvsserver tests, cvs not available' + test_done +fi + cvs >/dev/null 2>&1 if test $? -ne 1 then
t/t9401-git-cvsserver-crlf.sh +10 -5
@@ -38,15 +38,20 @@ not_present() { fi } -cvs >/dev/null 2>&1 -if test $? -ne 1 +if ! test_have_prereq PERL then - skip_all='skipping git-cvsserver tests, cvs not found' + skip_all='skipping git-cvsserver tests, perl not available' test_done fi -if ! test_have_prereq PERL +if ! test_have_prereq CVS then - skip_all='skipping git-cvsserver tests, perl not available' + skip_all='skipping git-cvsserver tests, cvs not available' + test_done +fi +cvs >/dev/null 2>&1 +if test $? -ne 1 +then + skip_all='skipping git-cvsserver tests, cvs not found' test_done fi "$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
t/t9600-cvsimport.sh +26 -15
117 lines not on this page · raw message
t/t9601-cvsimport-vendor-branch.sh +11 -0
@@ -34,6 +34,17 @@ test_description='git cvsimport handling of vendor branches' . ./lib-cvs.sh +if ! test_have_prereq PERL +then + skip_all='skipping git cvsimport tests, perl not available' + test_done +fi +if ! test_have_prereq CVS +then + skip_all='skipping git cvsimport tests, cvs not available' + test_done +fi + setup_cvs_test_repository t9601 test_expect_success PERL 'import a module with a vendor branch' '
t/t9602-cvsimport-branches-tags.sh +11 -0
@@ -6,6 +6,17 @@ test_description='git cvsimport handling of branches and tags' . ./lib-cvs.sh +if ! test_have_prereq PERL +then + skip_all='skipping git cvsimport tests, perl not available' + test_done +fi +if ! test_have_prereq CVS +then + skip_all='skipping git cvsimport tests, cvs not available' + test_done +fi + setup_cvs_test_repository t9602 test_expect_success PERL 'import module' '
t/t9603-cvsimport-patchsets.sh +11 -0
@@ -14,6 +14,17 @@ test_description='git cvsimport testing for correct patchset estimation' . ./lib-cvs.sh +if ! test_have_prereq PERL +then + skip_all='skipping git cvsimport tests, perl not available' + test_done +fi +if ! test_have_prereq CVS +then + skip_all='skipping git cvsimport tests, cvs not available' + test_done +fi + setup_cvs_test_repository t9603 test_expect_failure 'import with criss cross times on revisions' '
t/test-lib.sh +1 -0
@@ -1066,6 +1066,7 @@ case $(uname -s) in ;; esac +test -z "$NO_CVS" && test_set_prereq CVS test -z "$NO_PERL" && test_set_prereq PERL test -z "$NO_PYTHON" && test_set_prereq PYTHON
Signature · 1 line
1.7.3.4
Quoted 4 lines · Robin H. Johnson
Presently, the CVS interface scripts are always built, and their test-suites run based on a binary named 'cvs' happening to return zero. If there something other than the real CVS there, bad things happened during the test-suite run.
This explanation seems quite odd to me. Are you saying we can't rely on the 'cvs' name being "taken" and should live in fear that someone will implement an incompatible utility with the same name? Did that actually happen?
I would find it easier to believe
Building and testing git's cvs support is slow, because ...
So give users with no interest in cvs interoperability a way out. By defining NO_CVS you can avoid this time-consuming piece of the build process.
Or for a different patch:
Add a NO_CVS knob so users with no interest in cvs support can avoid polluting their $(libexecdir) with unwanted entries.
Or:
Introduce a new NO_CVS knob. If set, the CVS interop scripts will be replaced by unimplemented.sh so sysadmins and distributors can hopefully get a nice, clear error report instead of confusion when users try to run them with cvs not installed.
Quoted 4 lines · Jonathan Nieder
This explanation seems quite odd to me. Are you saying we can't rely on the 'cvs' name being "taken" and should live in fear that someone will implement an incompatible utility with the same name? Did that actually happen?
Not in the linked bug report, but it does explain a previous bug I had seen, where a user had a little script in /usr/local/bin that complained at him whenever he ran 'cvs', so he would learn to migrate away faster.
Quoted 1 line
I would find it easier to believe
I'm going to respin the patch with a new text, and one other improvement from Junio.
Signature · 4 lines
Robin Hugh Johnson Gentoo Linux: Developer, Trustee & Infrastructure Lead E-Mail : [email protected] GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
Quoted 8 lines · Robin H. Johnson
Quoted 4 lines · Jonathan Nieder
This explanation seems quite odd to me. Are you saying we can't rely on the 'cvs' name being "taken" and should live in fear that someone will implement an incompatible utility with the same name? Did that actually happen?
Not in the linked bug report, but it does explain a previous bug I had seen, where a user had a little script in
/usr/local/binthat complained at him whenever he ran 'cvs', so he would learn to migrate away faster.
I suspect that NO_CVS is not the best way to help a person who is trying to wean herself off of cvs by having a phony cvs in a directory that is early on the $PATH (be it $HOME/bin/cvs or /usr/local/bin/cvs). Before ceasing to actively build more histories in cvs, it would help to have an access to git-cvsimport and friends to salvage what's already there, no?
A change that models after PERL_PATH, not after NO_PERL, would be a more appropriate thing to do for that particular purpose.
I still think the patch itself is a worthy thing to have, so everything above is a tangent that is orthogonal to what your patch tries to do, though.
Quoted 4 lines · Robin H. Johnson
Presently, the CVS interface scripts are always built, and their test-suites run based on a binary named 'cvs' happening to return zero. If there something other than the real CVS there, bad things happened during the test-suite run.
Is that a problem?
It makes sense to let people whose system happens to have a working cvs to omit cvs interoperability bits when they know the do not want them, and that alone would be a good enough motivation.
I'd even consider the above justification of yours detrimental---it would be an excuse for other people to add patches to support NO_CAT, NO_DIFF, NO_LS, ... saying "if a binary 'cat' that is not cat is there, things break, so work it around". That is a road to nonsense land.
Quoted 4 lines
This patch implements
NO_CVSin the manner ofNO_PERL, and ensures that the CVS scripts get the unimplemented variant when appropriate, as well as making sure that the tests properly declare CVS as a prerequisite (shortcut totest_donelike the Perl prerequisites).
While the patch looks good, some people seem to prefer skipping individual tests without shortcut; see 900eab4 (t/t9600-cvsimport.sh: change from skip_all=* to prereq skip, 2010-08-13) for example. I am slightly in favor of the short-cut as I haven't heard convincing argument against it other than "skipped statistics" which I don't think is interesting nor accurate anyway.
I wonder if "check PERL and CVS prerequisite and say test_done" should be made into a helper in lib-cvs.sh or somewhere instead of repeating them in individual tests, but that is a minor point.
Quoted 7 lines · Junio C Hamano
Quoted 4 lines
Presently, the CVS interface scripts are always built, and their test-suites run based on a binary named 'cvs' happening to return zero. If there something other than the real CVS there, bad things happened during the test-suite run.
It makes sense to let people whose system happens to have a working cvs to omit cvs interoperability bits when they know the do not want them, and that alone would be a good enough motivation.
Ok, i'll respin to a different explanation.
Quoted 6 lines
While the patch looks good, some people seem to prefer skipping individual tests without shortcut; see 900eab4 (
t/t9600-cvsimport.sh: change from skip_all=* to prereq skip, 2010-08-13) for example. I am slightly in favor of the short-cut as I haven't heard convincing argument against it other than "skipped statistics" which I don't think is interesting nor accurate anyway.
I did it this was because of your prior comment on my perl prereq patch for the send-email tests.
Quoted 3 lines
I wonder if "check PERL and CVS prerequisite and say
test_done" should be made into a helper inlib-cvs.shor somewhere instead of repeating them in individual tests, but that is a minor point.
I'll see if I can respin to do this.
Signature · 4 lines
Robin Hugh Johnson Gentoo Linux: Developer, Trustee & Infrastructure Lead E-Mail : [email protected] GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85