Skip to content

Commit ca39da6

Browse files
committed
Merge branch 'ps/meson-contrib-bits'
Update meson-based build procedure to cover contrib/ and other places as well. * ps/meson-contrib-bits: ci: exercise credential helpers ci: fix propagating UTF-8 test locale in musl-based Meson job meson: wire up static analysis via Coccinelle meson: wire up git-contacts(1) meson: wire up credential helpers contrib/credential: fix compilation of "osxkeychain" helper contrib/credential: fix compiling "libsecret" helper contrib/credential: fix compilation of wincred helper with MSVC contrib/credential: fix "netrc" tests with out-of-tree builds GIT-BUILD-OPTIONS: propagate project's source directory
2 parents 85e342a + 63a597d commit ca39da6

24 files changed

+229
-27
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ jobs:
265265
run: pip install meson ninja
266266
- name: Setup
267267
shell: pwsh
268-
run: meson setup build -Dperl=disabled
268+
run: meson setup build -Dperl=disabled -Dcredential_helpers=wincred
269269
- name: Compile
270270
shell: pwsh
271271
run: meson compile -C build

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ build:msvc-meson:
164164
extends: .msvc-meson
165165
stage: build
166166
script:
167-
- meson setup build -Dperl=disabled -Dbackend_max_links=1
167+
- meson setup build -Dperl=disabled -Dbackend_max_links=1 -Dcredential_helpers=wincred
168168
- meson compile -C build
169169
artifacts:
170170
paths:

GIT-BUILD-OPTIONS.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
99
GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
1010
GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
1111
GIT_PERF_REPO=@GIT_PERF_REPO@
12+
GIT_SOURCE_DIR=@GIT_SOURCE_DIR@
1213
GIT_TEST_CMP=@GIT_TEST_CMP@
1314
GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
1415
GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
1516
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
16-
GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
1717
GIT_TEST_OPTS=@GIT_TEST_OPTS@
1818
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
19-
GIT_TEST_POPATH=@GIT_TEST_POPATH@
2019
GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
2120
GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
2221
GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3193,14 +3193,13 @@ GIT-BUILD-OPTIONS: FORCE
31933193
-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
31943194
-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
31953195
-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
3196+
-e "s|@GIT_SOURCE_DIR@|\'$(shell pwd)\'|" \
31963197
-e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
31973198
-e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
31983199
-e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
31993200
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
3200-
-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
32013201
-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
32023202
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
3203-
-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
32043203
-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
32053204
-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
32063205
-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \

ci/install-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ubuntu-*|i386/ubuntu-*|debian-*)
5858
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
5959
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
6060
libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
61-
libpcre2-dev meson ninja-build pkg-config \
61+
libsecret-1-dev libpcre2-dev meson ninja-build pkg-config \
6262
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
6363

6464
case "$distro" in

ci/lib.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,11 @@ case "$jobname" in
348348
linux32)
349349
CC=gcc
350350
;;
351-
linux-musl)
352-
MESONFLAGS="$MESONFLAGS -DGIT_TEST_UTF8_LOCALE=C.UTF-8"
351+
linux-meson)
352+
MESONFLAGS="$MESONFLAGS -Dcredential_helpers=libsecret,netrc"
353+
;;
354+
linux-musl-meson)
355+
MESONFLAGS="$MESONFLAGS -Dtest_utf8_locale=C.UTF-8"
353356
;;
354357
linux-leaks|linux-reftable-leaks)
355358
export SANITIZE=leak
@@ -359,6 +362,9 @@ linux-asan-ubsan)
359362
export NO_SVN_TESTS=LetsSaveSomeTime
360363
MAKEFLAGS="$MAKEFLAGS NO_PYTHON=YepBecauseP4FlakesTooOften"
361364
;;
365+
osx-meson)
366+
MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
367+
;;
362368
esac
363369

364370
MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"

contrib/buildsystems/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,13 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
11691169
string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
11701170
string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
11711171
string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
1172+
string(REPLACE "@GIT_SOURCE_DIR@" "${CMAKE_SOURCE_DIR}" git_build_options "${git_build_options}")
11721173
string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
11731174
string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
11741175
string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
11751176
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
1176-
string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${CMAKE_BINARY_DIR}/mergetools'" git_build_options "${git_build_options}")
11771177
string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
11781178
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
1179-
string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
11801179
string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
11811180
string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
11821181
string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")

contrib/coccinelle/meson.build

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
spatch = find_program('spatch', required: get_option('coccinelle'))
2+
if not spatch.found()
3+
subdir_done()
4+
endif
5+
6+
third_party_sources = [
7+
':!contrib',
8+
':!compat/inet_ntop.c',
9+
':!compat/inet_pton.c',
10+
':!compat/nedmalloc',
11+
':!compat/obstack.*',
12+
':!compat/poll',
13+
':!compat/regex',
14+
':!sha1collisiondetection',
15+
':!sha1dc',
16+
':!t/unit-tests/clar',
17+
':!t/unit-tests/clar',
18+
':!t/t[0-9][0-9][0-9][0-9]*',
19+
]
20+
21+
rules = [
22+
'array.cocci',
23+
'commit.cocci',
24+
'config_fn_ctx.pending.cocci',
25+
'equals-null.cocci',
26+
'flex_alloc.cocci',
27+
'free.cocci',
28+
'git_config_number.cocci',
29+
'hashmap.cocci',
30+
'index-compatibility.cocci',
31+
'object_id.cocci',
32+
'preincr.cocci',
33+
'qsort.cocci',
34+
'refs.cocci',
35+
'strbuf.cocci',
36+
'swap.cocci',
37+
'the_repository.cocci',
38+
'xcalloc.cocci',
39+
'xopen.cocci',
40+
'xstrdup_or_null.cocci',
41+
'xstrncmpz.cocci',
42+
]
43+
44+
concatenated_rules = custom_target(
45+
command: [
46+
'cat', '@INPUT@',
47+
],
48+
input: rules,
49+
output: 'rules.cocci',
50+
capture: true,
51+
)
52+
53+
sources = [ ]
54+
foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()
55+
sources += source
56+
endforeach
57+
58+
headers = [ ]
59+
foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
60+
headers += meson.project_source_root() / header
61+
endforeach
62+
63+
patches = [ ]
64+
foreach source : sources
65+
patches += custom_target(
66+
command: [
67+
spatch,
68+
'--all-includes',
69+
'--sp-file', concatenated_rules,
70+
'--patch', meson.project_source_root(),
71+
'@INPUT@',
72+
],
73+
input: meson.project_source_root() / source,
74+
output: source.underscorify() + '.patch',
75+
capture: true,
76+
depend_files: headers,
77+
)
78+
endforeach
79+
80+
concatenated_patch = custom_target(
81+
command: [
82+
'cat', '@INPUT@',
83+
],
84+
input: patches,
85+
output: 'cocci.patch',
86+
capture: true,
87+
)
88+
89+
alias_target('coccicheck', concatenated_patch)

contrib/contacts/meson.build

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
custom_target(
2+
input: 'git-contacts',
3+
output: 'git-contacts',
4+
command: generate_perl_command,
5+
depends: [git_version_file],
6+
install: true,
7+
install_dir: get_option('libexecdir') / 'git-core',
8+
)
9+
10+
if get_option('docs').contains('man')
11+
contacts_xml = custom_target(
12+
command: asciidoc_common_options + [
13+
'--backend=' + asciidoc_docbook,
14+
'--doctype=manpage',
15+
'--out-file=@OUTPUT@',
16+
'@INPUT@',
17+
],
18+
depends: documentation_deps,
19+
input: 'git-contacts.txt',
20+
output: 'git-contacts.xml',
21+
)
22+
23+
custom_target(
24+
command: [
25+
xmlto,
26+
'-m', '@INPUT@',
27+
'man',
28+
contacts_xml,
29+
'-o',
30+
meson.current_build_dir(),
31+
] + xmlto_extra,
32+
input: [
33+
'../../Documentation/manpage-normal.xsl',
34+
],
35+
output: 'git-contacts.1',
36+
install: true,
37+
install_dir: get_option('mandir') / 'man1',
38+
)
39+
endif
40+
41+
if get_option('docs').contains('html')
42+
custom_target(
43+
command: asciidoc_common_options + [
44+
'--backend=' + asciidoc_html,
45+
'--doctype=manpage',
46+
'--out-file=@OUTPUT@',
47+
'@INPUT@',
48+
],
49+
depends: documentation_deps,
50+
input: 'git-contacts.txt',
51+
output: 'git-contacts.html',
52+
install: true,
53+
install_dir: get_option('datadir') / 'doc/git-doc',
54+
)
55+
endif

contrib/credential/libsecret/git-credential-libsecret.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ static void credential_clear(struct credential *c);
5959
/* ----------------- Secret Service functions ----------------- */
6060

6161
static const SecretSchema schema = {
62-
"org.git.Password",
62+
.name = "org.git.Password",
6363
/* Ignore schema name during search for backwards compatibility */
64-
SECRET_SCHEMA_DONT_MATCH_NAME,
65-
{
64+
.flags = SECRET_SCHEMA_DONT_MATCH_NAME,
65+
.attributes = {
6666
/*
6767
* libsecret assumes attribute values are non-confidential and
6868
* unchanging, so we can't include oauth_refresh_token or
@@ -168,7 +168,7 @@ static int keyring_get(struct credential *c)
168168
g_free(c->password);
169169
c->password = g_strdup("");
170170
}
171-
for (int i = 1; i < g_strv_length(parts); i++) {
171+
for (guint i = 1; i < g_strv_length(parts); i++) {
172172
if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
173173
g_free(c->password_expiry_utc);
174174
c->password_expiry_utc = g_strdup(&parts[i][20]);
@@ -424,7 +424,7 @@ int main(int argc, char *argv[])
424424
struct credential_operation const *try_op = credential_helper_ops;
425425
struct credential cred = CREDENTIAL_INIT;
426426

427-
if (!argv[1]) {
427+
if (argc < 2 || !*argv[1]) {
428428
usage(argv[0]);
429429
exit(EXIT_FAILURE);
430430
}

0 commit comments

Comments
 (0)