]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: use jinja2 in shell-completion/
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 16 May 2021 16:34:23 +0000 (18:34 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 19 May 2021 01:25:26 +0000 (10:25 +0900)
shell-completion/bash/meson.build
shell-completion/bash/systemctl.in
shell-completion/zsh/_systemctl.in
shell-completion/zsh/meson.build

index 1afa7977e66680ea7b611afea8dd7966933b6d3a..c26b413d926d9ea4d5d06cceb213e00533f57553 100644 (file)
@@ -10,45 +10,45 @@ if bashcompletiondir == ''
         endif
 endif
 
-if bashcompletiondir != 'no'
-        bash_systemctl = configure_file(
-                input : 'systemctl.in',
-                output : 'systemctl',
-                configuration : substs)
+custom_target(
+        'systemctl',
+        input : 'systemctl.in',
+        output : 'systemctl',
+        command : [meson_render_jinja2, config_h, '@INPUT@'],
+        capture : true,
+        install : bashcompletiondir != 'no',
+        install_dir : bashcompletiondir)
 
-        items = [['busctl',              ''],
-                 ['journalctl',          ''],
-                 ['systemd-analyze',     ''],
-                 ['systemd-cat',         ''],
-                 ['systemd-cgls',        ''],
-                 ['systemd-cgtop',       ''],
-                 ['systemd-delta',       ''],
-                 ['systemd-detect-virt', ''],
-                 ['systemd-id128',       ''],
-                 ['systemd-nspawn',      ''],
-                 ['systemd-path',        ''],
-                 ['systemd-run',         ''],
-                 ['udevadm',             ''],
-                 ['kernel-install',      ''],
-                 [bash_systemctl,        ''],
-                 ['bootctl',             'ENABLE_EFI'],
-                 ['coredumpctl',         'ENABLE_COREDUMP'],
-                 ['homectl',             'ENABLE_HOMED'],
-                 ['hostnamectl',         'ENABLE_HOSTNAMED'],
-                 ['localectl',           'ENABLE_LOCALED'],
-                 ['loginctl',            'ENABLE_LOGIND'],
-                 ['machinectl',          'ENABLE_MACHINED'],
-                 ['networkctl',          'ENABLE_NETWORKD'],
-                 ['portablectl',         'ENABLE_PORTABLED'],
-                 ['resolvectl',          'ENABLE_RESOLVE'],
-                 ['systemd-resolve',     'ENABLE_RESOLVE'],
-                 ['timedatectl',         'ENABLE_TIMEDATED'],
-                ]
+items = [['busctl',              ''],
+         ['journalctl',          ''],
+         ['systemd-analyze',     ''],
+         ['systemd-cat',         ''],
+         ['systemd-cgls',        ''],
+         ['systemd-cgtop',       ''],
+         ['systemd-delta',       ''],
+         ['systemd-detect-virt', ''],
+         ['systemd-id128',       ''],
+         ['systemd-nspawn',      ''],
+         ['systemd-path',        ''],
+         ['systemd-run',         ''],
+         ['udevadm',             ''],
+         ['kernel-install',      ''],
+         ['bootctl',             'ENABLE_EFI'],
+         ['coredumpctl',         'ENABLE_COREDUMP'],
+         ['homectl',             'ENABLE_HOMED'],
+         ['hostnamectl',         'ENABLE_HOSTNAMED'],
+         ['localectl',           'ENABLE_LOCALED'],
+         ['loginctl',            'ENABLE_LOGIND'],
+         ['machinectl',          'ENABLE_MACHINED'],
+         ['networkctl',          'ENABLE_NETWORKD'],
+         ['portablectl',         'ENABLE_PORTABLED'],
+         ['resolvectl',          'ENABLE_RESOLVE'],
+         ['systemd-resolve',     'ENABLE_RESOLVE'],
+         ['timedatectl',         'ENABLE_TIMEDATED']]
 
-        foreach item : items
-                if item[1] == '' or conf.get(item[1]) == 1
-                        install_data(item[0],
-                                     install_dir : bashcompletiondir)
-                endif
-        endforeach
-endif
+foreach item : items
+        if bashcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1)
+                install_data(item[0],
+                             install_dir : bashcompletiondir)
+        endif
+endforeach
index c25a8d94c25b7554785664661afa1270d5e9e4f8..e6e6ca0d7e03cecd22e0974a2b88b0f3d79b289d 100644 (file)
@@ -11,7 +11,7 @@ __systemctl() {
 }
 
 __systemd_properties() {
-    @rootlibexecdir@/systemd --dump-bus-properties
+    {{ROOTLIBEXECDIR}}/systemd --dump-bus-properties
 }
 
 __contains_word () {
@@ -21,6 +21,7 @@ __contains_word () {
     done
 }
 
+{% raw -%}
 __filter_units_by_properties () {
     local mode=$1 properties=$2; shift 2
     local units=("$@")
@@ -50,6 +51,7 @@ __filter_units_by_properties () {
         echo $names
     fi
 }
+{% endraw %}
 
 __get_all_units      () { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } \
                               | { while read -r a b; do echo " $a"; done; }; }
index 5e82ef7e1f6b6143f2f5617e34aa3d2ca7b683a2..9eb1ad10375ecc310281f4c66cb9a5e027f4da9e 100644 (file)
@@ -433,7 +433,7 @@ done
         if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES$_sys_service_mgr ) ||
                ! _retrieve_cache SYS_ALL_PROPERTIES$_sys_service_mgr;
         then
-            _sys_all_properties=( ${${(M)${(f)"$(@rootlibexecdir@/systemd --dump-bus-properties)"}}} )
+            _sys_all_properties=( ${${(M)${(f)"$({{ROOTLIBEXECDIR}}/systemd --dump-bus-properties)"}}} )
             _store_cache SYS_ALL_PROPERTIES$_sys_service_mgr _sys_all_properties
         fi
         _values -s , "${_sys_all_properties[@]}"
index 4fff13357f622e27b86e9b21834dac4daf334dfb..f5f9b0f993f044376f74627ecc5a4474bf1b3d57 100644 (file)
@@ -5,44 +5,44 @@ if zshcompletiondir == ''
         zshcompletiondir = join_paths(datadir, 'zsh/site-functions')
 endif
 
-if zshcompletiondir != 'no'
-        zsh_systemctl = configure_file(
-                input : '_systemctl.in',
-                output : '_systemctl',
-                configuration : substs)
+custom_target(
+        '_systemctl',
+        input : '_systemctl.in',
+        output : '_systemctl',
+        command : [meson_render_jinja2, config_h, '@INPUT@'],
+        capture : true,
+        install : zshcompletiondir != 'no',
+        install_dir : zshcompletiondir)
 
-        items = [['_busctl',                   ''],
-                 ['_journalctl',               ''],
-                 ['_systemd-analyze',          ''],
-                 ['_systemd-delta',            ''],
-                 ['_systemd-nspawn',           ''],
-                 ['_systemd',                  ''],
-                 ['_systemd-path',             ''],
-                 ['_systemd-run',              ''],
-                 ['_udevadm',                  ''],
-                 ['_kernel-install',           ''],
-                 ['_sd_hosts_or_user_at_host', ''],
-                 ['_sd_outputmodes',           ''],
-                 ['_sd_unit_files',            ''],
-                 ['_sd_machines',              ''],
-                 [zsh_systemctl,               ''],
-                 ['_bootctl',                  'ENABLE_EFI'],
-                 ['_coredumpctl',              'ENABLE_COREDUMP'],
-                 ['_hostnamectl',              'ENABLE_HOSTNAMED'],
-                 ['_localectl',                'ENABLE_LOCALED'],
-                 ['_loginctl',                 'ENABLE_LOGIND'],
-                 ['_machinectl',               'ENABLE_MACHINED'],
-                 ['_networkctl',               'ENABLE_NETWORKD'],
-                 ['_systemd-inhibit',          'ENABLE_LOGIND'],
-                 ['_resolvectl',               'ENABLE_RESOLVE'],
-                 ['_systemd-tmpfiles',         'ENABLE_TMPFILES'],
-                 ['_timedatectl',              'ENABLE_TIMEDATED'],
-                ]
+items = [['_busctl',                   ''],
+         ['_journalctl',               ''],
+         ['_systemd-analyze',          ''],
+         ['_systemd-delta',            ''],
+         ['_systemd-nspawn',           ''],
+         ['_systemd',                  ''],
+         ['_systemd-path',             ''],
+         ['_systemd-run',              ''],
+         ['_udevadm',                  ''],
+         ['_kernel-install',           ''],
+         ['_sd_hosts_or_user_at_host', ''],
+         ['_sd_outputmodes',           ''],
+         ['_sd_unit_files',            ''],
+         ['_sd_machines',              ''],
+         ['_bootctl',                  'ENABLE_EFI'],
+         ['_coredumpctl',              'ENABLE_COREDUMP'],
+         ['_hostnamectl',              'ENABLE_HOSTNAMED'],
+         ['_localectl',                'ENABLE_LOCALED'],
+         ['_loginctl',                 'ENABLE_LOGIND'],
+         ['_machinectl',               'ENABLE_MACHINED'],
+         ['_networkctl',               'ENABLE_NETWORKD'],
+         ['_systemd-inhibit',          'ENABLE_LOGIND'],
+         ['_resolvectl',               'ENABLE_RESOLVE'],
+         ['_systemd-tmpfiles',         'ENABLE_TMPFILES'],
+         ['_timedatectl',              'ENABLE_TIMEDATED']]
 
-        foreach item : items
-                if item[1] == '' or conf.get(item[1]) == 1
-                        install_data(item[0],
-                                     install_dir : zshcompletiondir)
-                endif
-        endforeach
-endif
+foreach item : items
+        if zshcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1)
+                install_data(item[0],
+                             install_dir : zshcompletiondir)
+        endif
+endforeach