From 4c890ad3cc7b3445683d7b52bc00e4a58bef5e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Jan 2021 08:46:42 +0100 Subject: [PATCH 1/4] meson: rename target to update-dbus-docs Very old versions of meson did not include the subdirectory name in the target name, so we started adding various "top-level" custom targets in subdirectories. This was nice because the main meson.build file wasn't as cluttered. But then meson started including the subdir name in the target name. So let's move the definition to the root so we can have all targets named uniformly. --- docs/RELEASE.md | 2 +- man/meson.build | 19 ------------------- meson.build | 19 +++++++++++++++++++ tools/update-dbus-docs.py | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 59144641070..31a06515a11 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -10,7 +10,7 @@ layout: default 2. Update the contributors list in NEWS (`meson compile -C build git-contrib`) 3. Update the time and place in NEWS 4. [RC1] Update version and library numbers in `meson.build` -5. Check dbus docs with `meson compile -C build man/update-dbus-docs` +5. Check dbus docs with `meson compile -C build update-dbus-docs` 6. Tag the release: `version=vXXX-rcY && git tag -s "${version}" -m "systemd ${version}"` 7. Do `meson compile -C build` 8. Make sure that the version string and package string match: `build/systemctl --version` diff --git a/man/meson.build b/man/meson.build index 88e06b384a0..327df94c27c 100644 --- a/man/meson.build +++ b/man/meson.build @@ -198,25 +198,6 @@ run_target( ############################################################ -if dbus_docs.length() > 0 - custom_target( - 'update-dbus-docs', - output : 'update-dbus-docs', - command : [update_dbus_docs_py, - '--build-dir=@0@'.format(project_build_root), - '@INPUT@'], - input : dbus_docs) - - if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER' - test('dbus-docs-fresh', - update_dbus_docs_py, - args : ['--build-dir=@0@'.format(project_build_root), - '--test'] + dbus_docs) - endif -endif - -############################################################ - custom_target( 'update-man-rules', output : 'update-man-rules', diff --git a/meson.build b/meson.build index 6d18355b0c6..f1de3a87d36 100644 --- a/meson.build +++ b/meson.build @@ -3605,6 +3605,25 @@ run_target( depends : [man, libsystemd, libudev], command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()]) +############################################################ + +if dbus_docs.length() > 0 + custom_target( + 'update-dbus-docs', + output : 'update-dbus-docs', + command : [update_dbus_docs_py, + '--build-dir=@0@'.format(project_build_root), + '@INPUT@'], + input : dbus_docs) + + if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER' + test('dbus-docs-fresh', + update_dbus_docs_py, + args : ['--build-dir=@0@'.format(project_build_root), + '--test'] + dbus_docs) + endif +endif + ############################################################ watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog diff --git a/tools/update-dbus-docs.py b/tools/update-dbus-docs.py index 8fea0b8a007..ebe67af836f 100755 --- a/tools/update-dbus-docs.py +++ b/tools/update-dbus-docs.py @@ -322,4 +322,4 @@ if __name__ == '__main__': if opts.test and outdated: exit(f'Outdated pages: {", ".join(outdated)}\n' - f'Hint: ninja -C {opts.build_dir} man/update-dbus-docs') + f'Hint: ninja -C {opts.build_dir} update-dbus-docs') From e3c368f63c8ec71ba06e699ff46eb3e0d8e3bb0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Jan 2021 09:10:25 +0100 Subject: [PATCH 2/4] meson: rename target to update-man-rules Same justification as for update-dbus-docs. --- docs/CODE_QUALITY.md | 2 +- man/html.in | 2 +- man/man.in | 2 +- man/meson.build | 11 ----------- man/rules/meson.build | 2 +- meson.build | 9 +++++++++ tools/update-man-rules.py | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/docs/CODE_QUALITY.md b/docs/CODE_QUALITY.md index a59912a6761..53fabb3581d 100644 --- a/docs/CODE_QUALITY.md +++ b/docs/CODE_QUALITY.md @@ -44,7 +44,7 @@ available functionality: 7. Use `meson compile -C build hwdb-update` to automatically download and import the PCI, USB and OUI databases into hwdb. -8. Use `meson compile -C build man/update-man-rules` to update the meson rules for +8. Use `meson compile -C build update-man-rules` to update the meson rules for building man pages automatically from the docbook XML files included in `man/`. diff --git a/man/html.in b/man/html.in index c142f581de0..3ae02bd77d3 100755 --- a/man/html.in +++ b/man/html.in @@ -6,7 +6,7 @@ if [ -z "$1" ]; then exit 1 fi -# make sure the rules have been regenerated (in case man/update-man-rules was just run) +# make sure the rules have been regenerated (in case update-man-rules was just run) ninja -C "@BUILD_ROOT@" version.h target="man/$1.html" diff --git a/man/man.in b/man/man.in index 12eb332ee00..40b7476bc5e 100755 --- a/man/man.in +++ b/man/man.in @@ -6,7 +6,7 @@ if [ -z "$1" ]; then exit 1 fi -# make sure the rules have been regenerated (in case man/update-man-rules was just run) +# make sure the rules have been regenerated (in case update-man-rules was just run) ninja -C "@BUILD_ROOT@" version.h page="$(echo "$1" | sed 's/\./\\./')" diff --git a/man/meson.build b/man/meson.build index 327df94c27c..3cae8446cda 100644 --- a/man/meson.build +++ b/man/meson.build @@ -198,17 +198,6 @@ run_target( ############################################################ -custom_target( - 'update-man-rules', - output : 'update-man-rules', - command : ['sh', '-c', - 'cd @0@ && '.format(meson.build_root()) + - 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) + - 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())], - depend_files : custom_entities_ent) - -############################################################ - configure_file( input : 'man.in', output : 'man', diff --git a/man/rules/meson.build b/man/rules/meson.build index 4a23648a215..c13c8efc5c3 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -2,7 +2,7 @@ # Do not edit. Generated by update-man-rules.py. # Update with: -# ninja -C build man/update-man-rules +# ninja -C build update-man-rules manpages = [ ['binfmt.d', '5', [], 'ENABLE_BINFMT'], ['bootctl', '1', [], 'ENABLE_EFI'], diff --git a/meson.build b/meson.build index f1de3a87d36..569cac92816 100644 --- a/meson.build +++ b/meson.build @@ -3624,6 +3624,15 @@ if dbus_docs.length() > 0 endif endif +custom_target( + 'update-man-rules', + output : 'update-man-rules', + command : ['sh', '-c', + 'cd @0@ && '.format(meson.build_root()) + + 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) + + 'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())], + depend_files : custom_entities_ent) + ############################################################ watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog diff --git a/tools/update-man-rules.py b/tools/update-man-rules.py index 8221a37d9a9..31ed91c432e 100755 --- a/tools/update-man-rules.py +++ b/tools/update-man-rules.py @@ -51,7 +51,7 @@ MESON_HEADER = '''\ # Do not edit. Generated by update-man-rules.py. # Update with: -# ninja -C build man/update-man-rules +# ninja -C build update-man-rules manpages = [''' MESON_FOOTER = '''\ From 4095cff07e1db4c220ff150e77287b8f4f6bc3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Jan 2021 09:17:26 +0100 Subject: [PATCH 3/4] meson: rename target to update-hwdb The goal is to have all "update-*" targets named uniformly so that tab-completion works. The script is renamed to match. --- docs/CODE_QUALITY.md | 2 +- hwdb.d/meson.build | 4 ++-- meson.build | 2 +- tools/{hwdb-update.sh => update-hwdb.sh} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename tools/{hwdb-update.sh => update-hwdb.sh} (100%) diff --git a/docs/CODE_QUALITY.md b/docs/CODE_QUALITY.md index 53fabb3581d..0933a0e4953 100644 --- a/docs/CODE_QUALITY.md +++ b/docs/CODE_QUALITY.md @@ -41,7 +41,7 @@ available functionality: symbols of `libsystemd.so` and `libudev.so` with the list of man pages. Symbols lacking documentation are highlighted. -7. Use `meson compile -C build hwdb-update` to automatically download and import the +7. Use `meson compile -C build update-hwdb` to automatically download and import the PCI, USB and OUI databases into hwdb. 8. Use `meson compile -C build update-man-rules` to update the meson rules for diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index 6a3456263a8..edaa81b7bbb 100644 --- a/hwdb.d/meson.build +++ b/hwdb.d/meson.build @@ -66,8 +66,8 @@ endif ############################################################ run_target( - 'hwdb-update', - command : [hwdb_update_sh, meson.current_source_dir()]) + 'update-hwdb', + command : [update_hwdb_sh, meson.current_source_dir()]) run_target( 'autosuspend-update', diff --git a/meson.build b/meson.build index 569cac92816..a1535526976 100644 --- a/meson.build +++ b/meson.build @@ -1590,7 +1590,7 @@ conf.set10('ENABLE_EFI', have) ############################################################ autosuspend_update_sh = find_program('tools/autosuspend-update.sh') -hwdb_update_sh = find_program('tools/hwdb-update.sh') +update_hwdb_sh = find_program('tools/update-hwdb.sh') make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') make_directive_index_py = find_program('tools/make-directive-index.py') make_man_index_py = find_program('tools/make-man-index.py') diff --git a/tools/hwdb-update.sh b/tools/update-hwdb.sh similarity index 100% rename from tools/hwdb-update.sh rename to tools/update-hwdb.sh From 816f31d0184c18f71c177a5c0bb15eaeddf3af2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Jan 2021 09:23:02 +0100 Subject: [PATCH 4/4] meson: rename target to update-hwdb-autosuspend The script is renamed to match. Now all targets are named uniformly in a tab-completion-friendly fashion, with the exception of systemd-update-po which is generated by the i18n module automatically: $ ninja -C build -t targets | grep update systemd-update-po: phony update-syscall-tables: phony update-syscall-header: phony update-hwdb: phony update-hwdb-autosuspend: phony update-dbus-docs: CUSTOM_COMMAND update-man-rules: CUSTOM_COMMAND --- hwdb.d/meson.build | 4 ++-- meson.build | 2 +- tools/{autosuspend-update.sh => update-hwdb-autosuspend.sh} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename tools/{autosuspend-update.sh => update-hwdb-autosuspend.sh} (100%) diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index edaa81b7bbb..54c6f4d5e2d 100644 --- a/hwdb.d/meson.build +++ b/hwdb.d/meson.build @@ -70,5 +70,5 @@ run_target( command : [update_hwdb_sh, meson.current_source_dir()]) run_target( - 'autosuspend-update', - command : [autosuspend_update_sh, project_source_root]) + 'update-hwdb-autosuspend', + command : [update_hwdb_autosuspend_sh, project_source_root]) diff --git a/meson.build b/meson.build index a1535526976..60d8dc7abc4 100644 --- a/meson.build +++ b/meson.build @@ -1589,8 +1589,8 @@ conf.set10('ENABLE_EFI', have) ############################################################ -autosuspend_update_sh = find_program('tools/autosuspend-update.sh') update_hwdb_sh = find_program('tools/update-hwdb.sh') +update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh') make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') make_directive_index_py = find_program('tools/make-directive-index.py') make_man_index_py = find_program('tools/make-man-index.py') diff --git a/tools/autosuspend-update.sh b/tools/update-hwdb-autosuspend.sh similarity index 100% rename from tools/autosuspend-update.sh rename to tools/update-hwdb-autosuspend.sh