summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-14 14:16:17 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-15 19:54:55 +0200
commit271b7dcbadd9fed70f87f29f30ef0925619037c9 (patch)
tree5f1244d221f851220f51685da1ef12b433ac93f3
parent2a1d508107c6d9c37c7867c08b15ccb01d3ee0bd (diff)
downloadsystemd-271b7dcbadd9fed70f87f29f30ef0925619037c9.tar.gz
meson: call find_program() once and reuse the variable everywhere
Meson 0.58 has gotten quite bad with emitting a message every time a quoted command is used: Program /home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh found: YES (/home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program xsltproc found: YES (/usr/bin/xsltproc) Configuring custom-entities.ent using configuration Message: Skipping bootctl.1 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping journal-remote.conf.5 because HAVE_MICROHTTPD is false Message: Skipping journal-upload.conf.5 because HAVE_MICROHTTPD is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping loader.conf.5 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) ... Let's suffer one message only for each command. Hopefully we can silence even this when https://github.com/mesonbuild/meson/issues/8642 is resolved. (cherry picked from commit 596f5101f29c10256208132bfa9c502bf898fd8b)
-rw-r--r--catalog/meson.build3
-rw-r--r--hwdb.d/meson.build3
-rw-r--r--man/meson.build9
-rw-r--r--meson.build33
-rw-r--r--src/boot/efi/meson.build6
-rw-r--r--src/locale/meson.build2
-rw-r--r--src/test/meson.build2
-rw-r--r--test/fuzz/meson.build3
-rw-r--r--units/meson.build3
9 files changed, 32 insertions, 32 deletions
diff --git a/catalog/meson.build b/catalog/meson.build
index d61fc2cbf6..7139c2e053 100644
--- a/catalog/meson.build
+++ b/catalog/meson.build
@@ -30,5 +30,4 @@ foreach file : in_files
endforeach
meson.add_install_script('sh', '-c',
- 'test -n "$DESTDIR" || @0@/journalctl --update-catalog'
- .format(rootbindir))
+ 'test -n "$DESTDIR" || @0@/journalctl --update-catalog'.format(rootbindir))
diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build
index b7df70ada2..b3437bd2db 100644
--- a/hwdb.d/meson.build
+++ b/hwdb.d/meson.build
@@ -48,8 +48,7 @@ if conf.get('ENABLE_HWDB') == 1
mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d')))
meson.add_install_script('sh', '-c',
- 'test -n "$DESTDIR" || @0@/systemd-hwdb update'
- .format(rootbindir))
+ 'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(rootbindir))
endif
if want_tests != 'false'
diff --git a/man/meson.build b/man/meson.build
index 2a7c160764..6e5e58766e 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -70,7 +70,7 @@ foreach tuple : xsltproc.found() ? manpages : []
link = custom_target(
htmlalias,
output : htmlalias,
- command : ['ln', '-fs', html, '@OUTPUT@'])
+ command : [ln, '-fs', html, '@OUTPUT@'])
if want_html
dst = join_paths(docdir, 'html', htmlalias)
cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
@@ -148,7 +148,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv
htmlalias,
input : p2,
output : htmlalias,
- command : ['ln', '-fs', html, '@OUTPUT@'])
+ command : [ln, '-fs', html, '@OUTPUT@'])
if want_html
dst = join_paths(docdir, 'html', htmlalias)
cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
@@ -176,15 +176,14 @@ man = custom_target(
'man',
output : 'man',
depends : man_pages,
- command : ['echo'])
+ command : [echo])
html = custom_target(
'html',
output : 'html',
depends : html_pages,
- command : ['echo'])
+ command : [echo])
-rsync = find_program('rsync', required : false)
if rsync.found()
run_target(
'doc-sync',
diff --git a/meson.build b/meson.build
index a308bd9f79..f0e28cc5ca 100644
--- a/meson.build
+++ b/meson.build
@@ -564,17 +564,22 @@ version_h = vcs_tag(
versiondep = declare_dependency(sources: version_h)
+sh = find_program('sh')
+echo = find_program('echo')
+test = find_program('test')
sed = find_program('sed')
awk = find_program('awk')
m4 = find_program('m4')
stat = find_program('stat')
+ln = find_program('ln')
git = find_program('git', required : false)
env = find_program('env')
perl = find_program('perl', required : false)
-
+rsync = find_program('rsync', required : false)
meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
-mkdir_p = 'mkdir -p $DESTDIR/@0@'
test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
+
+mkdir_p = 'mkdir -p $DESTDIR/@0@'
splash_bmp = files('test/splash.bmp')
# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
@@ -608,7 +613,7 @@ endforeach
conf.set_quoted('TELINIT', get_option('telinit-path'))
-if run_command('ln', '--relative', '--help').returncode() != 0
+if run_command(ln, '--relative', '--help').returncode() != 0
error('ln does not support --relative (added in coreutils 8.16)')
endif
@@ -622,7 +627,7 @@ const char * in_word_set(const char *, @0@);
@1@
'''
gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
-gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
+gperf_snippet = run_command(sh, '-c', gperf_snippet_format.format(gperf.path()))
gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
if cc.compiles(gperf_test)
gperf_len_type = 'size_t'
@@ -684,11 +689,11 @@ conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
time_epoch = get_option('time-epoch')
if time_epoch == -1
- time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
+ time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"').stdout().strip()
if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
# If we're in a git repository, use the creation time of the latest git tag.
- latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
- time_epoch = run_command('git', 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout()
+ latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags').stdout().strip()
+ time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout()
endif
if time_epoch == ''
NEWS = files('NEWS')
@@ -3333,7 +3338,7 @@ executable(
custom_target(
'systemd-runtest.env',
output : 'systemd-runtest.env',
- command : ['sh', '-c', '{ ' +
+ command : [sh, '-c', '{ ' +
'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
'} >@OUTPUT@'],
@@ -3568,7 +3573,7 @@ foreach tuple : sanitizers
name,
output : name,
depends : build,
- command : [env, 'ln', '-fs',
+ command : [ln, '-fs',
join_paths(build.full_path(), b),
'@OUTPUT@'],
build_by_default : true)
@@ -3620,16 +3625,16 @@ endif
if git.found()
git_head = run_command(
git,
- ['--git-dir=@0@/.git'.format(project_source_root),
- 'rev-parse', 'HEAD']).stdout().strip()
+ '--git-dir=@0@/.git'.format(project_source_root),
+ 'rev-parse', 'HEAD').stdout().strip()
git_head_short = run_command(
git,
- ['--git-dir=@0@/.git'.format(project_source_root),
- 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
+ '--git-dir=@0@/.git'.format(project_source_root),
+ 'rev-parse', '--short=7', 'HEAD').stdout().strip()
run_target(
'git-snapshot',
- command : ['git', 'archive',
+ command : [git, 'archive',
'-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
git_head_short),
'--prefix', 'systemd-@0@/'.format(git_head),
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index 24177f9384..c572b0dc9f 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -66,14 +66,14 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
if efi_libdir == ''
# New location first introduced with gnu-efi 3.0.11
efi_libdir = join_paths('/usr/lib/gnuefi', EFI_MACHINE_TYPE_NAME)
- cmd = run_command('test', '-e', efi_libdir)
+ cmd = run_command(test, '-e', efi_libdir)
if cmd.returncode() != 0
# Fall back to the old approach
cmd = run_command(efi_cc + ['-print-multi-os-directory'])
if cmd.returncode() == 0
path = join_paths('/usr/lib', cmd.stdout().strip())
- cmd = run_command('realpath', '-e', path)
+ cmd = run_command(env, 'realpath', '-e', path)
if cmd.returncode() == 0
efi_libdir = cmd.stdout().strip()
endif
@@ -114,7 +114,7 @@ if have_gnu_efi
efi_lds = ''
foreach location : efi_location_map
if efi_lds == ''
- cmd = run_command('test', '-f', location[0])
+ cmd = run_command(test, '-f', location[0])
if cmd.returncode() == 0
efi_lds = location[0]
efi_crt0 = location[1]
diff --git a/src/locale/meson.build b/src/locale/meson.build
index 6e3500d099..5a5f807bde 100644
--- a/src/locale/meson.build
+++ b/src/locale/meson.build
@@ -20,7 +20,7 @@ endif
# If you know a way that allows the same variables to be used
# in sources list and concatenated to a string for test_env,
# let me know.
-kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map')
+kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map')
language_fallback_map = join_paths(meson.current_source_dir(), 'language-fallback-map')
if conf.get('ENABLE_LOCALED') == 1
diff --git a/src/test/meson.build b/src/test/meson.build
index 6234294947..20d0fcd412 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -11,7 +11,7 @@ test_hashmap_ordered_c = custom_target(
test_include_dir = include_directories('.')
-path = run_command('sh', ['-c', 'echo "$PATH"']).stdout().strip()
+path = run_command(sh, '-c', 'echo "$PATH"').stdout().strip()
test_env = environment()
test_env.set('SYSTEMD_KBD_MODEL_MAP', kbd_model_map)
test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build
index 7a83961d11..f215cbc7c3 100644
--- a/test/fuzz/meson.build
+++ b/test/fuzz/meson.build
@@ -27,8 +27,7 @@ if git.found()
'--git-dir=@0@/.git'.format(project_source_root),
'ls-files', ':/test/fuzz/*/*')
else
- out = run_command(
- 'sh', '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root))
+ out = run_command(sh, '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root))
endif
fuzz_regression_tests = []
diff --git a/units/meson.build b/units/meson.build
index 0f9be2ee95..9fe3769d08 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -339,8 +339,7 @@ if conf.get('HAVE_SYSV_COMPAT') == 1
foreach i : [1, 2, 3, 4, 5]
meson.add_install_script(
'sh', '-c',
- mkdir_p
- .format(join_paths(systemunitdir, 'runlevel@0@.target.wants'.format(i))))
+ mkdir_p.format(join_paths(systemunitdir, 'runlevel@0@.target.wants'.format(i))))
endforeach
endif