From c74dc8cf14c4d37d6d84b17dd95e96919fe4aa9a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 20 Nov 2025 14:39:13 +0900 Subject: [PATCH 1/2] meson: sort shell completions --- shell-completion/bash/meson.build | 79 ++++++++++++++++--------------- shell-completion/zsh/meson.build | 61 ++++++++++++------------ 2 files changed, 71 insertions(+), 69 deletions(-) diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index 1ab60c9b7b..43b9c28cb3 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -17,46 +17,47 @@ custom_target( install : bashcompletiondir != 'no', install_dir : bashcompletiondir) -items = [['busctl', ''], - ['journalctl', ''], - ['systemd-analyze', ''], - ['systemd-cat', ''], - ['systemd-cgls', ''], - ['systemd-cgtop', ''], - ['systemd-creds', ''], - ['systemd-delta', ''], - ['systemd-detect-virt', ''], - ['systemd-id128', ''], - ['systemd-nspawn', 'ENABLE_NSPAWN'], - ['systemd-path', ''], - ['systemd-run', ''], - ['systemd-vpick', ''], - ['udevadm', ''], - ['bootctl', ''], - ['run0', ''], - ['varlinkctl', ''], - ['coredumpctl', 'ENABLE_COREDUMP'], - ['homectl', 'ENABLE_HOMED'], - ['hostnamectl', 'ENABLE_HOSTNAMED'], - ['importctl', 'ENABLE_IMPORTD'], - ['kernel-install', 'ENABLE_KERNEL_INSTALL'], - ['localectl', 'ENABLE_LOCALED'], - ['loginctl', 'ENABLE_LOGIND'], - ['machinectl', 'ENABLE_MACHINED'], - ['networkctl', 'ENABLE_NETWORKD'], - ['oomctl', 'ENABLE_OOMD'], - ['portablectl', 'ENABLE_PORTABLED'], - ['resolvectl', 'ENABLE_RESOLVE'], - ['systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'], - ['systemd-confext', 'ENABLE_SYSEXT'], - ['systemd-dissect', 'HAVE_BLKID'], - ['systemd-resolve', 'ENABLE_RESOLVE'], - ['systemd-sysext', 'ENABLE_SYSEXT'], - ['systemd-vmspawn', 'ENABLE_VMSPAWN'], - ['timedatectl', 'ENABLE_TIMEDATED'], - ['userdbctl', 'ENABLE_USERDB']] +foreach item : [ + ['bootctl', ''], + ['busctl', ''], + ['coredumpctl', 'ENABLE_COREDUMP'], + ['homectl', 'ENABLE_HOMED'], + ['hostnamectl', 'ENABLE_HOSTNAMED'], + ['importctl', 'ENABLE_IMPORTD'], + ['journalctl', ''], + ['kernel-install', 'ENABLE_KERNEL_INSTALL'], + ['localectl', 'ENABLE_LOCALED'], + ['loginctl', 'ENABLE_LOGIND'], + ['machinectl', 'ENABLE_MACHINED'], + ['networkctl', 'ENABLE_NETWORKD'], + ['oomctl', 'ENABLE_OOMD'], + ['portablectl', 'ENABLE_PORTABLED'], + ['resolvectl', 'ENABLE_RESOLVE'], + ['run0', ''], + ['systemd-analyze', ''], + ['systemd-cat', ''], + ['systemd-cgls', ''], + ['systemd-cgtop', ''], + ['systemd-confext', 'ENABLE_SYSEXT'], + ['systemd-creds', ''], + ['systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'], + ['systemd-delta', ''], + ['systemd-detect-virt', ''], + ['systemd-dissect', 'HAVE_BLKID'], + ['systemd-id128', ''], + ['systemd-nspawn', 'ENABLE_NSPAWN'], + ['systemd-path', ''], + ['systemd-resolve', 'ENABLE_RESOLVE'], + ['systemd-run', ''], + ['systemd-sysext', 'ENABLE_SYSEXT'], + ['systemd-vmspawn', 'ENABLE_VMSPAWN'], + ['systemd-vpick', ''], + ['timedatectl', 'ENABLE_TIMEDATED'], + ['udevadm', ''], + ['userdbctl', 'ENABLE_USERDB'], + ['varlinkctl', ''], +] -foreach item : items if bashcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1) install_data(item[0], install_dir : bashcompletiondir) diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build index 4de28388ce..f2db67881b 100644 --- a/shell-completion/zsh/meson.build +++ b/shell-completion/zsh/meson.build @@ -12,37 +12,38 @@ custom_target( install : zshcompletiondir != 'no', install_dir : zshcompletiondir) -items = [['_busctl', ''], - ['_journalctl', ''], - ['_systemd-analyze', ''], - ['_systemd-delta', ''], - ['_systemd-nspawn', ''], - ['_systemd', ''], - ['_systemd-path', ''], - ['_systemd-run', ''], - ['_run0', ''], - ['_udevadm', ''], - ['_varlinkctl', ''], - ['_kernel-install', 'ENABLE_KERNEL_INSTALL'], - ['_sd_bus_address', ''], - ['_sd_hosts_or_user_at_host', ''], - ['_sd_outputmodes', ''], - ['_sd_unit_files', ''], - ['_sd_machines', ''], - ['_bootctl', ''], - ['_coredumpctl', 'ENABLE_COREDUMP'], - ['_hostnamectl', 'ENABLE_HOSTNAMED'], - ['_localectl', 'ENABLE_LOCALED'], - ['_loginctl', 'ENABLE_LOGIND'], - ['_machinectl', 'ENABLE_MACHINED'], - ['_networkctl', 'ENABLE_NETWORKD'], - ['_oomctl', 'ENABLE_OOMD'], - ['_systemd-inhibit', 'ENABLE_LOGIND'], - ['_resolvectl', 'ENABLE_RESOLVE'], - ['_systemd-tmpfiles', 'ENABLE_TMPFILES'], - ['_timedatectl', 'ENABLE_TIMEDATED']] +foreach item : [ + ['_bootctl', ''], + ['_busctl', ''], + ['_coredumpctl', 'ENABLE_COREDUMP'], + ['_hostnamectl', 'ENABLE_HOSTNAMED'], + ['_journalctl', ''], + ['_kernel-install', 'ENABLE_KERNEL_INSTALL'], + ['_localectl', 'ENABLE_LOCALED'], + ['_loginctl', 'ENABLE_LOGIND'], + ['_machinectl', 'ENABLE_MACHINED'], + ['_networkctl', 'ENABLE_NETWORKD'], + ['_oomctl', 'ENABLE_OOMD'], + ['_resolvectl', 'ENABLE_RESOLVE'], + ['_run0', ''], + ['_sd_bus_address', ''], + ['_sd_hosts_or_user_at_host', ''], + ['_sd_machines', ''], + ['_sd_outputmodes', ''], + ['_sd_unit_files', ''], + ['_systemd', ''], + ['_systemd-analyze', ''], + ['_systemd-delta', ''], + ['_systemd-inhibit', 'ENABLE_LOGIND'], + ['_systemd-nspawn', ''], + ['_systemd-path', ''], + ['_systemd-run', ''], + ['_systemd-tmpfiles', 'ENABLE_TMPFILES'], + ['_timedatectl', 'ENABLE_TIMEDATED'], + ['_udevadm', ''], + ['_varlinkctl', ''], +] -foreach item : items if zshcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1) install_data(item[0], install_dir : zshcompletiondir) From d2b8e42742689730b7484f9a8ffb77753a515c61 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 20 Nov 2025 14:46:18 +0900 Subject: [PATCH 2/2] meson: exit earlier from the subdirectory when bash/zshcompletiondir is 'no' --- shell-completion/bash/meson.build | 8 +++++--- shell-completion/zsh/meson.build | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index 43b9c28cb3..178986e171 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -1,7 +1,9 @@ # SPDX-License-Identifier: LGPL-2.1-or-later bashcompletiondir = get_option('bashcompletiondir') -if bashcompletiondir == '' +if bashcompletiondir == 'no' + subdir_done() +elif bashcompletiondir == '' bash_completion = dependency('bash-completion', required : false) if bash_completion.found() bashcompletiondir = bash_completion.get_variable(pkgconfig : 'completionsdir') @@ -14,7 +16,7 @@ custom_target( input : 'systemctl.in', output : 'systemctl', command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], - install : bashcompletiondir != 'no', + install : true, install_dir : bashcompletiondir) foreach item : [ @@ -58,7 +60,7 @@ foreach item : [ ['varlinkctl', ''], ] - if bashcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1) + if item[1] == '' or conf.get(item[1]) == 1 install_data(item[0], install_dir : bashcompletiondir) endif diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build index f2db67881b..221c30627f 100644 --- a/shell-completion/zsh/meson.build +++ b/shell-completion/zsh/meson.build @@ -1,7 +1,9 @@ # SPDX-License-Identifier: LGPL-2.1-or-later zshcompletiondir = get_option('zshcompletiondir') -if zshcompletiondir == '' +if zshcompletiondir == 'no' + subdir_done() +elif zshcompletiondir == '' zshcompletiondir = datadir / 'zsh/site-functions' endif @@ -9,7 +11,7 @@ custom_target( input : '_systemctl.in', output : '_systemctl', command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], - install : zshcompletiondir != 'no', + install : true, install_dir : zshcompletiondir) foreach item : [ @@ -44,7 +46,7 @@ foreach item : [ ['_varlinkctl', ''], ] - if zshcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1) + if item[1] == '' or conf.get(item[1]) == 1 install_data(item[0], install_dir : zshcompletiondir) endif