diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-04-05 16:52:44 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-04-05 22:18:31 +0200 |
commit | 8f04a1ca2bf973e5419c32adca1dcf888e0b263f (patch) | |
tree | 978baef3c11ea9c87119843b155a47618e5377ca | |
parent | 3761002eeaead8392a1c1517251c4f9be7c688aa (diff) | |
download | systemd-8f04a1ca2bf973e5419c32adca1dcf888e0b263f.tar.gz |
meson: also allow setting GIT_VERSION via templates
GIT_VERSION is not available as a config.h variable, because it's rendered
into version.h during builds. Let's rework jinja2 rendering to also
parse version.h. No functional change, the new variable is so far unused.
I guess this will make partial rebuilds a bit slower, but it's useful
to be able to use the full version string.
-rw-r--r-- | docs/sysvinit/meson.build | 2 | ||||
-rw-r--r-- | factory/templates/meson.build | 2 | ||||
-rw-r--r-- | man/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | rules.d/meson.build | 2 | ||||
-rw-r--r-- | shell-completion/bash/meson.build | 2 | ||||
-rw-r--r-- | shell-completion/zsh/meson.build | 2 | ||||
-rw-r--r-- | src/core/meson.build | 4 | ||||
-rw-r--r-- | src/journal-remote/meson.build | 2 | ||||
-rw-r--r-- | src/libsystemd/meson.build | 2 | ||||
-rw-r--r-- | src/libudev/meson.build | 2 | ||||
-rw-r--r-- | src/login/meson.build | 2 | ||||
-rw-r--r-- | src/resolve/meson.build | 2 | ||||
-rw-r--r-- | src/rpm/meson.build | 2 | ||||
-rw-r--r-- | src/timesync/meson.build | 2 | ||||
-rw-r--r-- | src/udev/meson.build | 2 | ||||
-rw-r--r-- | src/vconsole/meson.build | 2 | ||||
-rw-r--r-- | sysctl.d/meson.build | 2 | ||||
-rw-r--r-- | sysusers.d/meson.build | 2 | ||||
-rw-r--r-- | tmpfiles.d/meson.build | 2 | ||||
-rwxr-xr-x | tools/meson-render-jinja2.py | 9 | ||||
-rw-r--r-- | units/meson.build | 2 |
22 files changed, 28 insertions, 25 deletions
diff --git a/docs/sysvinit/meson.build b/docs/sysvinit/meson.build index cd3015ca4b..64476a5d76 100644 --- a/docs/sysvinit/meson.build +++ b/docs/sysvinit/meson.build @@ -4,6 +4,6 @@ custom_target( 'README', input : 'README.in', output : 'README', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : conf.get('HAVE_SYSV_COMPAT') == 1, install_dir : sysvinit_path) diff --git a/factory/templates/meson.build b/factory/templates/meson.build index 821f176a74..ece2c644ff 100644 --- a/factory/templates/meson.build +++ b/factory/templates/meson.build @@ -6,6 +6,6 @@ custom_target( 'locale.conf', input : 'locale.conf.in', output : 'locale.conf', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : true, install_dir : factory_etc_dir) diff --git a/man/meson.build b/man/meson.build index 83b368115b..d9c706b4ab 100644 --- a/man/meson.build +++ b/man/meson.build @@ -30,7 +30,7 @@ custom_entities_ent = custom_target( 'custom-entities.ent', input : 'custom-entities.ent.in', output : 'custom-entities.ent', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@']) + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@']) man_pages = [] html_pages = [] diff --git a/meson.build b/meson.build index b43273262d..ce54b1045d 100644 --- a/meson.build +++ b/meson.build @@ -1826,6 +1826,8 @@ config_h = configure_file( add_project_arguments('-include', 'config.h', language : 'c') +jinja2_cmdline = [meson_render_jinja2, config_h, version_h] + ############################################################ # binaries that have --help and are intended for use by humans, diff --git a/rules.d/meson.build b/rules.d/meson.build index e6533e001a..f725e14d95 100644 --- a/rules.d/meson.build +++ b/rules.d/meson.build @@ -51,7 +51,7 @@ foreach file : rules_in file, input : file + '.in', output: file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : true, install_dir : udevrulesdir) endforeach diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index ae6a61e555..fb7314348a 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -14,7 +14,7 @@ custom_target( 'systemctl', input : 'systemctl.in', output : 'systemctl', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : bashcompletiondir != 'no', install_dir : bashcompletiondir) diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build index bac531798c..b39f933ea4 100644 --- a/shell-completion/zsh/meson.build +++ b/shell-completion/zsh/meson.build @@ -9,7 +9,7 @@ custom_target( '_systemctl', input : '_systemctl.in', output : '_systemctl', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : zshcompletiondir != 'no', install_dir : zshcompletiondir) diff --git a/src/core/meson.build b/src/core/meson.build index f5e04b37ca..ee2f8774bf 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -151,7 +151,7 @@ load_fragment_gperf_gperf = custom_target( 'load-fragment-gperf.gperf', input : 'load-fragment-gperf.gperf.in', output: 'load-fragment-gperf.gperf', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@']) + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@']) load_fragment_gperf_c = custom_target( 'load-fragment-gperf.c', @@ -217,7 +217,7 @@ foreach item : in_files file, input : file + '.in', output: file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : (dir == pkgsysconfdir) ? install_sysconfdir_samples : (dir != 'no'), install_dir : dir) endforeach diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index 4bbbc1431f..f81d906616 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -54,7 +54,7 @@ foreach tuple : in_files file, input : file + '.in', output: file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : tuple[1], install_dir : pkgsysconfdir) endforeach diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index 67b439a5dd..a86b8f896b 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -186,7 +186,7 @@ custom_target( 'libsystemd.pc', input : 'libsystemd.pc.in', output : 'libsystemd.pc', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : pkgconfiglibdir != 'no', install_dir : pkgconfiglibdir) diff --git a/src/libudev/meson.build b/src/libudev/meson.build index 2d51ff7c58..a831391cc1 100644 --- a/src/libudev/meson.build +++ b/src/libudev/meson.build @@ -38,7 +38,7 @@ custom_target( 'libudev.pc', input : 'libudev.pc.in', output : 'libudev.pc', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : pkgconfiglibdir != 'no', install_dir : pkgconfiglibdir) diff --git a/src/login/meson.build b/src/login/meson.build index 1a2d738e84..bd350569d5 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -80,7 +80,7 @@ foreach tuple : in_files file, input : file + '.in', output: file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : tuple[2] and install, install_dir : dir) endforeach diff --git a/src/resolve/meson.build b/src/resolve/meson.build index b2da249c87..e11aefce7a 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -168,7 +168,7 @@ custom_target( 'resolved.conf', input : 'resolved.conf.in', output : 'resolved.conf', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : conf.get('ENABLE_RESOLVE') == 1 and install_sysconfdir_samples, install_dir : pkgsysconfdir) diff --git a/src/rpm/meson.build b/src/rpm/meson.build index 4bfeda8883..817665912a 100644 --- a/src/rpm/meson.build +++ b/src/rpm/meson.build @@ -18,7 +18,7 @@ foreach tuple : in_files file, input : file + '.in', output : file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : tuple[1], install_dir : tuple.length() > 2 ? tuple[2] : '', build_by_default : true) diff --git a/src/timesync/meson.build b/src/timesync/meson.build index 8ecfbfab82..35467026a8 100644 --- a/src/timesync/meson.build +++ b/src/timesync/meson.build @@ -39,7 +39,7 @@ custom_target( 'timesyncd.conf', input : 'timesyncd.conf.in', output : 'timesyncd.conf', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : conf.get('ENABLE_TIMESYNCD') == 1 and install_sysconfdir_samples, install_dir : pkgsysconfdir) diff --git a/src/udev/meson.build b/src/udev/meson.build index 354b923291..79964a7d8e 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -166,7 +166,7 @@ custom_target( 'udev.pc', input : 'udev.pc.in', output : 'udev.pc', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : pkgconfigdatadir != 'no', install_dir : pkgconfigdatadir) diff --git a/src/vconsole/meson.build b/src/vconsole/meson.build index eb22358c20..bb3c3c5a03 100644 --- a/src/vconsole/meson.build +++ b/src/vconsole/meson.build @@ -4,6 +4,6 @@ custom_target( '90-vconsole.rules', input : '90-vconsole.rules.in', output : '90-vconsole.rules', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : conf.get('ENABLE_VCONSOLE') == 1, install_dir : udevrulesdir) diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build index 1745a13bfb..ecec903d1b 100644 --- a/sysctl.d/meson.build +++ b/sysctl.d/meson.build @@ -16,7 +16,7 @@ custom_target( '50-coredump.conf', input : '50-coredump.conf.in', output : '50-coredump.conf', - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : conf.get('ENABLE_COREDUMP') == 1, install_dir : sysctldir) diff --git a/sysusers.d/meson.build b/sysusers.d/meson.build index 73d507f1f1..608c4b744a 100644 --- a/sysusers.d/meson.build +++ b/sysusers.d/meson.build @@ -33,7 +33,7 @@ foreach tuple : in_files file, input : file + '.in', output: file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : tuple[1], install_dir : sysusersdir) endforeach diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build index b8d3919025..306e066f22 100644 --- a/tmpfiles.d/meson.build +++ b/tmpfiles.d/meson.build @@ -41,7 +41,7 @@ foreach pair : in_files pair[0], input : pair[0] + '.in', output: pair[0], - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : enable_tmpfiles, install_dir : tmpfilesdir) else diff --git a/tools/meson-render-jinja2.py b/tools/meson-render-jinja2.py index 89735c70ed..fbaae596de 100755 --- a/tools/meson-render-jinja2.py +++ b/tools/meson-render-jinja2.py @@ -28,9 +28,10 @@ def render(filename, defines): if __name__ == '__main__': defines = parse_config_h(sys.argv[1]) - output = render(sys.argv[2], defines) - with open(sys.argv[3], 'w') as f: + defines.update(parse_config_h(sys.argv[2])) + output = render(sys.argv[3], defines) + with open(sys.argv[4], 'w') as f: f.write(output) f.write('\n') - info = os.stat(sys.argv[2]) - os.chmod(sys.argv[3], info.st_mode) + info = os.stat(sys.argv[3]) + os.chmod(sys.argv[4], info.st_mode) diff --git a/units/meson.build b/units/meson.build index 8a3bd0da51..e8f81f2230 100644 --- a/units/meson.build +++ b/units/meson.build @@ -276,7 +276,7 @@ foreach tuple : in_units file, input : file + '.in', output : file, - command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : install, install_dir : systemunitdir) |