Skip to content

Commit cbcc2f7

Browse files
pks-tgitster
authored andcommitted
GIT-BUILD-OPTIONS: wire up NO_GITWEB option
Building our "gitweb" interface is optional in our Makefile and in Meson and not wired up at all with CMake, but disabling it causes a couple of tests in the t950* range that pull in "t/lib-gitweb.sh". This is because the test library knows to execute gitweb-tests based on whether or not Perl is available, but we may have Perl available and still end up not building gitweb e.g. with `make test NO_GITWEB=YesPlease`. Fix this issue by wiring up a new "NO_GITWEB" build option so that we can skip these tests in case gitweb is not built. Note that this new build option requires us to move the configuration of GIT-BUILD-OPTIONS to a later point in our Meson build instructions. But as that file is only consumed by our tests at runtime this change does not cause any issues. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cfa1f2a commit cbcc2f7

File tree

6 files changed

+40
-28
lines changed

6 files changed

+40
-28
lines changed

GIT-BUILD-OPTIONS.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ LOCALEDIR=@LOCALEDIR@
2424
NO_CURL=@NO_CURL@
2525
NO_EXPAT=@NO_EXPAT@
2626
NO_GETTEXT=@NO_GETTEXT@
27+
NO_GITWEB=@NO_GITWEB@
2728
NO_ICONV=@NO_ICONV@
2829
NO_PERL=@NO_PERL@
2930
NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3171,6 +3171,7 @@ GIT-BUILD-OPTIONS: FORCE
31713171
-e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
31723172
-e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
31733173
-e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
3174+
-e "s|@NO_GITWEB@|\'$(NO_GITWEB)\'|" \
31743175
-e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
31753176
-e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
31763177
-e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \

contrib/buildsystems/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_opt
11841184
string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
11851185
string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
11861186
string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
1187+
string(REPLACE "@NO_GITWEB@" "1" git_build_options "${git_build_options}")
11871188
string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
11881189
string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
11891190
string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")

meson.build

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,34 +1456,6 @@ else
14561456
build_options_config.set('RUNTIME_PREFIX', 'false')
14571457
endif
14581458

1459-
foreach key, value : {
1460-
'DIFF': diff.full_path(),
1461-
'GIT_TEST_CMP': diff.full_path() + ' -u',
1462-
'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
1463-
'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
1464-
'GIT_TEST_POPATH': meson.project_source_root() / 'po',
1465-
'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
1466-
'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
1467-
'PAGER_ENV': get_option('pager_environment'),
1468-
'PERL_PATH': perl.found() ? perl.full_path() : '',
1469-
'PYTHON_PATH': python.found () ? python.full_path() : '',
1470-
'SHELL_PATH': shell.full_path(),
1471-
'TAR': tar.full_path(),
1472-
'TEST_OUTPUT_DIRECTORY': test_output_directory,
1473-
'TEST_SHELL_PATH': shell.full_path(),
1474-
}
1475-
if value != '' and cygpath.found()
1476-
value = run_command(cygpath, value, check: true).stdout().strip()
1477-
endif
1478-
build_options_config.set_quoted(key, value)
1479-
endforeach
1480-
1481-
configure_file(
1482-
input: 'GIT-BUILD-OPTIONS.in',
1483-
output: 'GIT-BUILD-OPTIONS',
1484-
configuration: build_options_config,
1485-
)
1486-
14871459
git_version_file = custom_target(
14881460
command: [
14891461
shell,
@@ -1893,6 +1865,9 @@ subdir('contrib')
18931865
gitweb_option = get_option('gitweb').disable_auto_if(not perl.found())
18941866
if gitweb_option.enabled()
18951867
subdir('gitweb')
1868+
build_options_config.set('NO_GITWEB', '')
1869+
else
1870+
build_options_config.set('NO_GITWEB', '1')
18961871
endif
18971872

18981873
subdir('templates')
@@ -1909,6 +1884,34 @@ if get_option('docs') != []
19091884
subdir('Documentation')
19101885
endif
19111886

1887+
foreach key, value : {
1888+
'DIFF': diff.full_path(),
1889+
'GIT_TEST_CMP': diff.full_path() + ' -u',
1890+
'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
1891+
'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
1892+
'GIT_TEST_POPATH': meson.project_source_root() / 'po',
1893+
'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
1894+
'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
1895+
'PAGER_ENV': get_option('pager_environment'),
1896+
'PERL_PATH': perl.found() ? perl.full_path() : '',
1897+
'PYTHON_PATH': python.found () ? python.full_path() : '',
1898+
'SHELL_PATH': shell.full_path(),
1899+
'TAR': tar.full_path(),
1900+
'TEST_OUTPUT_DIRECTORY': test_output_directory,
1901+
'TEST_SHELL_PATH': shell.full_path(),
1902+
}
1903+
if value != '' and cygpath.found()
1904+
value = run_command(cygpath, value, check: true).stdout().strip()
1905+
endif
1906+
build_options_config.set_quoted(key, value)
1907+
endforeach
1908+
1909+
configure_file(
1910+
input: 'GIT-BUILD-OPTIONS.in',
1911+
output: 'GIT-BUILD-OPTIONS',
1912+
configuration: build_options_config,
1913+
)
1914+
19121915
summary({
19131916
'curl': curl.found(),
19141917
'expat': expat.found(),

t/lib-gitweb.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ if ! test_have_prereq PERL; then
105105
test_done
106106
fi
107107

108+
if ! test_have_prereq GITWEB; then
109+
skip_all='skipping gitweb tests, gitweb not available'
110+
test_done
111+
fi
112+
108113
perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
109114
skip_all='skipping gitweb tests, perl version is too old'
110115
test_done

t/test-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,7 @@ esac
16871687

16881688
( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
16891689
test -z "$NO_CURL" && test_set_prereq LIBCURL
1690+
test -z "$NO_GITWEB" && test_set_prereq GITWEB
16901691
test -z "$NO_ICONV" && test_set_prereq ICONV
16911692
test -z "$NO_PERL" && test_set_prereq PERL
16921693
test -z "$NO_PTHREADS" && test_set_prereq PTHREADS

0 commit comments

Comments
 (0)