diff --git a/.gitignore b/.gitignore index cfb77444e8..5cb43a0374 100644 --- a/.gitignore +++ b/.gitignore @@ -147,16 +147,19 @@ test-*.trs /libnm-core/nm-dbus-types.xml /libnm-core/nm-vpn-dbus-types.xml -/libnm/nm-settings-ifcfg-rh-docs.xml -/libnm/nm-property-docs.xml -/libnm/nm-settings-docs.xml -/libnm/nm-settings-docs-overrides.xml -/libnm/nm-settings-keyfile-docs.xml +/libnm/nm-property-infos-dbus.xml +/libnm/nm-property-infos-ifcfg-rh.xml +/libnm/nm-property-infos-keyfile.xml +/libnm/nm-property-infos-nmcli.xml +/libnm/nm-settings-docs-gir.xml /libnm/tests/test-libnm /libnm/tests/test-nm-client /libnm/tests/test-remote-settings-client /libnm/tests/test-secret-agent +/clients/cli/generate-docs-nm-settings-nmcli +/clients/cli/generate-docs-nm-settings-nmcli.xml + /m4/codeset.m4 /m4/gettext.m4 /m4/glibc2.m4 @@ -192,9 +195,12 @@ test-*.trs /m4/xsize.m4 /man/*.[1785] -/man/nm-settings.xml +/man/nm-settings-dbus.xml +/man/nm-settings-docs-dbus.xml +/man/nm-settings-docs-nmcli.xml /man/nm-settings-ifcfg-rh.xml /man/nm-settings-keyfile.xml +/man/nm-settings-nmcli.xml /man/common.ent /po/*.gmo @@ -298,6 +304,7 @@ test-*.trs /docs/libnm-util/tmpl/ /docs/libnm-util/version.xml /docs/libnm-util/xml/ +/man/nm-settings.xml /include/ /initscript/*/[Nn]etwork[Mm]anager /initscript/Slackware/rc.networkmanager @@ -325,8 +332,13 @@ test-*.trs /libnm/fake-typelib/typelibs.c /libnm/nm-ifcfg-rh-docs.xml /libnm/nm-keyfile-docs.xml +/libnm/nm-property-docs.xml /libnm/nm-setting-docs-overrides.xml /libnm/nm-setting-docs.xml +/libnm/nm-settings-docs-overrides.xml +/libnm/nm-settings-docs.xml +/libnm/nm-settings-ifcfg-rh-docs.xml +/libnm/nm-settings-keyfile-docs.xml /libnm/tests/test-general /policy/org.freedesktop.NetworkManager.policy /policy/org.freedesktop.NetworkManager.policy.in diff --git a/Makefile.am b/Makefile.am index 98c81ef4d8..d47df9624e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -456,9 +456,9 @@ shared_nm_udev_aux_libnm_udev_aux_la_LIBADD = \ ############################################################################### -noinst_LTLIBRARIES += shared/nm-libnm-core-intern/libnm-libnm-core-intern.la +noinst_LTLIBRARIES += libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la -shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_CPPFLAGS = \ +libnm_core_nm_libnm_core_intern_libnm_libnm_core_intern_la_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ -I$(builddir)/shared \ @@ -471,32 +471,34 @@ shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE \ $(NULL) -shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_SOURCES = \ - shared/nm-libnm-core-intern/nm-common-macros.h \ - shared/nm-libnm-core-intern/nm-ethtool-utils.c \ - shared/nm-libnm-core-intern/nm-ethtool-utils.h \ - shared/nm-libnm-core-intern/nm-libnm-core-utils.c \ - shared/nm-libnm-core-intern/nm-libnm-core-utils.h \ - shared/nm-libnm-core-intern/nm-auth-subject.c \ - shared/nm-libnm-core-intern/nm-auth-subject.h \ +libnm_core_nm_libnm_core_intern_libnm_libnm_core_intern_la_SOURCES = \ + libnm-core/nm-libnm-core-intern/nm-auth-subject.c \ + libnm-core/nm-libnm-core-intern/nm-auth-subject.h \ + libnm-core/nm-libnm-core-intern/nm-common-macros.h \ + libnm-core/nm-libnm-core-intern/nm-ethtool-utils.c \ + libnm-core/nm-libnm-core-intern/nm-ethtool-utils.h \ + libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c \ + libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h \ $(NULL) -shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_LDFLAGS = \ +libnm_core_nm_libnm_core_intern_libnm_libnm_core_intern_la_LDFLAGS = \ $(CODE_COVERAGE_LDFLAGS) \ $(SANITIZER_LIB_LDFLAGS) \ $(NULL) -shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_LIBADD = \ +libnm_core_nm_libnm_core_intern_libnm_libnm_core_intern_la_LIBADD = \ $(GLIB_LIBS) \ $(NULL) -$(shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(libnm_core_nm_libnm_core_intern_libnm_libnm_core_intern_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) + +EXTRA_DIST += libnm-core/nm-libnm-core-intern/README.md ############################################################################### -noinst_LTLIBRARIES += shared/nm-libnm-core-aux/libnm-libnm-core-aux.la +noinst_LTLIBRARIES += libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la -shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_CPPFLAGS = \ +libnm_core_nm_libnm_core_aux_libnm_libnm_core_aux_la_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ -I$(builddir)/shared \ @@ -509,28 +511,30 @@ shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \ $(NULL) -shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_SOURCES = \ - shared/nm-libnm-core-aux/nm-dispatcher-api.h \ - shared/nm-libnm-core-aux/nm-libnm-core-aux.c \ - shared/nm-libnm-core-aux/nm-libnm-core-aux.h \ +libnm_core_nm_libnm_core_aux_libnm_libnm_core_aux_la_SOURCES = \ + libnm-core/nm-libnm-core-aux/nm-dispatcher-api.h \ + libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.c \ + libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.h \ $(NULL) -shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_LDFLAGS = \ +libnm_core_nm_libnm_core_aux_libnm_libnm_core_aux_la_LDFLAGS = \ $(CODE_COVERAGE_LDFLAGS) \ $(SANITIZER_LIB_LDFLAGS) \ $(NULL) -shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_LIBADD = \ +libnm_core_nm_libnm_core_aux_libnm_libnm_core_aux_la_LIBADD = \ $(GLIB_LIBS) \ $(NULL) -$(shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(libnm_core_nm_libnm_core_aux_libnm_libnm_core_aux_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) + +EXTRA_DIST += libnm-core/nm-libnm-core-aux/README.md ############################################################################### -noinst_LTLIBRARIES += shared/nm-keyfile/libnm-keyfile.la +noinst_LTLIBRARIES += libnm-core/nm-keyfile/libnm-keyfile.la -shared_nm_keyfile_libnm_keyfile_la_CPPFLAGS = \ +libnm_core_nm_keyfile_libnm_keyfile_la_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ -I$(builddir)/shared \ @@ -543,29 +547,29 @@ shared_nm_keyfile_libnm_keyfile_la_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \ $(NULL) -shared_nm_keyfile_libnm_keyfile_la_SOURCES = \ - shared/nm-keyfile/nm-keyfile-internal.h \ - shared/nm-keyfile/nm-keyfile-utils.c \ - shared/nm-keyfile/nm-keyfile-utils.h \ - shared/nm-keyfile/nm-keyfile.c \ +libnm_core_nm_keyfile_libnm_keyfile_la_SOURCES = \ + libnm-core/nm-keyfile/nm-keyfile-internal.h \ + libnm-core/nm-keyfile/nm-keyfile-utils.c \ + libnm-core/nm-keyfile/nm-keyfile-utils.h \ + libnm-core/nm-keyfile/nm-keyfile.c \ $(NULL) -shared_nm_keyfile_libnm_keyfile_la_LDFLAGS = \ +libnm_core_nm_keyfile_libnm_keyfile_la_LDFLAGS = \ $(CODE_COVERAGE_LDFLAGS) \ $(SANITIZER_LIB_LDFLAGS) \ $(NULL) -shared_nm_keyfile_libnm_keyfile_la_LIBADD = \ +libnm_core_nm_keyfile_libnm_keyfile_la_LIBADD = \ $(GLIB_LIBS) \ $(NULL) -$(shared_nm_keyfile_libnm_keyfile_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(libnm_core_nm_keyfile_libnm_keyfile_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) ############################################################################### -noinst_LTLIBRARIES += shared/nm-libnm-aux/libnm-libnm-aux.la +noinst_LTLIBRARIES += libnm/nm-libnm-aux/libnm-libnm-aux.la -shared_nm_libnm_aux_libnm_libnm_aux_la_CPPFLAGS = \ +libnm_nm_libnm_aux_libnm_libnm_aux_la_CPPFLAGS = \ $(dflt_cppflags) \ -I$(srcdir)/shared \ -I$(builddir)/shared \ @@ -580,23 +584,25 @@ shared_nm_libnm_aux_libnm_libnm_aux_la_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ $(NULL) -shared_nm_libnm_aux_libnm_libnm_aux_la_SOURCES = \ - shared/nm-libnm-aux/nm-libnm-aux.c \ - shared/nm-libnm-aux/nm-libnm-aux.h \ +libnm_nm_libnm_aux_libnm_libnm_aux_la_SOURCES = \ + libnm/nm-libnm-aux/nm-libnm-aux.c \ + libnm/nm-libnm-aux/nm-libnm-aux.h \ $(NULL) -shared_nm_libnm_aux_libnm_libnm_aux_la_LDFLAGS = \ +libnm_nm_libnm_aux_libnm_libnm_aux_la_LDFLAGS = \ $(CODE_COVERAGE_LDFLAGS) \ $(SANITIZER_LIB_LDFLAGS) \ $(NULL) -shared_nm_libnm_aux_libnm_libnm_aux_la_LIBADD = \ +libnm_nm_libnm_aux_libnm_libnm_aux_la_LIBADD = \ $(GLIB_LIBS) \ libnm/libnm.la \ $(NULL) -$(shared_nm_libnm_aux_libnm_libnm_aux_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(shared_nm_libnm_aux_libnm_libnm_aux_la_OBJECTS): $(libnm_lib_h_pub_mkenums) +$(libnm_nm_libnm_aux_libnm_libnm_aux_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(libnm_nm_libnm_aux_libnm_libnm_aux_la_OBJECTS): $(libnm_lib_h_pub_mkenums) + +EXTRA_DIST += libnm/nm-libnm-aux/README.md ############################################################################### @@ -1220,11 +1226,11 @@ nodist_libnm_core_tests_test_general_SOURCES = \ $(NULL) libnm_core_tests_ldadd = \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-keyfile/libnm-keyfile.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/systemd/libnm-systemd-shared.la \ shared/systemd/libnm-systemd-logging-stub.la \ shared/nm-glib-aux/libnm-glib-aux.la \ @@ -1449,10 +1455,10 @@ nodist_libnm_liblibnm_la_SOURCES = \ $(NULL) libnm_liblibnm_la_LIBADD = \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ introspection/libnmdbus.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/systemd/libnm-systemd-shared.la \ @@ -1553,58 +1559,55 @@ libnm/libnm.typelib: libnm/libnm.gir INTROSPECTION_GIRS += libnm/NM-1.0.gir libnm_noinst_data = \ - libnm/nm-property-docs.xml \ - libnm/nm-settings-docs-overrides.xml \ - libnm/nm-settings-docs.xml \ - libnm/nm-settings-keyfile-docs.xml \ - libnm/nm-settings-ifcfg-rh-docs.xml + clients/cli/generate-docs-nm-settings-nmcli.xml \ + libnm/nm-property-infos-dbus.xml \ + libnm/nm-property-infos-ifcfg-rh.xml \ + libnm/nm-property-infos-keyfile.xml \ + libnm/nm-property-infos-nmcli.xml \ + libnm/nm-settings-docs-gir.xml \ + man/nm-settings-docs-dbus.xml \ + man/nm-settings-docs-nmcli.xml \ + $(NULL) noinst_DATA += $(libnm_noinst_data) +clients/cli/generate-docs-nm-settings-nmcli.xml: clients/cli/generate-docs-nm-settings-nmcli + $(AM_V_GEN) clients/cli/generate-docs-nm-settings-nmcli > $@ + libnm_docs_sources = $(libnm_core_lib_c_settings_real) -libnm/nm-settings-docs-overrides.xml: libnm/generate-plugin-docs.pl $(libnm_docs_sources) - $(AM_V_GEN) $(srcdir)/libnm/generate-plugin-docs.pl dbus $@ $(filter-out $<,$^) +libnm/nm-property-infos-%.xml: tools/generate-docs-nm-property-infos.pl $(libnm_docs_sources) + $(AM_V_GEN) $(srcdir)/tools/generate-docs-nm-property-infos.pl $(patsubst nm-property-infos-%.xml,%,$(notdir $@)) $@ $(filter-out $<,$^) -# When the python scripts loads libnm and the address sanitizers is -# enabled, we must LD_PRELOAD libasan otherwise it will complain that -# it was not loaded as initial library. -libnm/nm-property-docs.xml: libnm/generate-setting-docs.py $(libnm_docs_sources) | libnm/NM-1.0.gir libnm/NM-1.0.typelib libnm/libnm.la +libnm/nm-settings-docs-gir.xml: tools/generate-docs-nm-settings-docs-gir.py libnm/NM-1.0.gir libnm/NM-1.0.typelib libnm/libnm.la $(libnm_docs_sources) $(AM_V_GEN) \ export GI_TYPELIB_PATH=$(abs_builddir)/libnm$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}; \ export LD_LIBRARY_PATH=$(abs_builddir)/libnm/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}; \ $(call set_sanitizer_env,$(abs_builddir)/libnm/.libs/libnm.so); \ "$(PYTHON)" \ - $(srcdir)/libnm/generate-setting-docs.py \ + $(srcdir)/tools/generate-docs-nm-settings-docs-gir.py \ --gir $(builddir)/libnm/NM-1.0.gir \ --output $@ -libnm/nm-settings-docs.xml: libnm/generate-setting-docs.py libnm/nm-settings-docs-overrides.xml $(libnm_docs_sources) | libnm/NM-1.0.gir libnm/NM-1.0.typelib libnm/libnm.la - $(AM_V_GEN) \ - export GI_TYPELIB_PATH=$(abs_builddir)/libnm$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}; \ - export LD_LIBRARY_PATH=$(abs_builddir)/libnm/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}; \ - $(call set_sanitizer_env,$(abs_builddir)/libnm/.libs/libnm.so); \ - "$(PYTHON)" \ - $(srcdir)/libnm/generate-setting-docs.py \ - --gir $(builddir)/libnm/NM-1.0.gir \ - --overrides $(word 2,$^) \ - --output $@ +man/nm-settings-docs-nmcli.xml: clients/cli/generate-docs-nm-settings-nmcli.xml libnm/nm-property-infos-nmcli.xml libnm/nm-settings-docs-gir.xml tools/generate-docs-nm-settings-docs-merge.py + $(AM_V_GEN) "$(PYTHON)" $(srcdir)/tools/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,3,$^) -libnm/nm-settings-keyfile-docs.xml: libnm/generate-plugin-docs.pl $(libnm_docs_sources) - $(AM_V_GEN) $(srcdir)/libnm/generate-plugin-docs.pl keyfile $@ $(filter-out $<,$^) -libnm/nm-settings-ifcfg-rh-docs.xml: libnm/generate-plugin-docs.pl $(libnm_docs_sources) - $(AM_V_GEN) $(srcdir)/libnm/generate-plugin-docs.pl ifcfg-rh $@ $(filter-out $<,$^) +man/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml tools/generate-docs-nm-settings-docs-merge.py + $(AM_V_GEN) "$(PYTHON)" $(srcdir)/tools/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) EXTRA_DIST += $(libnm_noinst_data) +DISTCLEANFILES += $(libnm_noinst_data) endif EXTRA_DIST += \ - libnm/generate-setting-docs.py \ - libnm/generate-plugin-docs.pl \ + tools/generate-docs-nm-property-infos.pl \ + tools/generate-docs-nm-settings-docs-merge.py \ + tools/generate-docs-nm-settings-docs-gir.py \ + libnm/meson.build \ libnm/nm-enum-types.c.template \ libnm/nm-enum-types.h.template \ - libnm/meson.build + $(NULL) ############################################################################### @@ -2314,11 +2317,11 @@ src_libNetworkManager_la_SOURCES = \ src_libNetworkManager_la_LIBADD = \ src/libNetworkManagerBase.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-keyfile/libnm-keyfile.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ @@ -2405,11 +2408,11 @@ src_nm_iface_helper_SOURCES = \ src_nm_iface_helper_LDADD = \ src/libNetworkManagerBase.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-keyfile/libnm-keyfile.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ @@ -2454,11 +2457,11 @@ src_initrd_nm_initrd_generator_SOURCES = \ src_initrd_nm_initrd_generator_LDADD = \ src/initrd/libnmi-core.la \ src/libNetworkManagerBase.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-keyfile/libnm-keyfile.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ @@ -4312,7 +4315,7 @@ clients_nm_online_LDFLAGS = \ clients_nm_online_LDADD = \ libnm/libnm.la \ - shared/nm-libnm-aux/libnm-libnm-aux.la \ + libnm/nm-libnm-aux/libnm-libnm-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ @@ -4376,7 +4379,7 @@ $(clients_common_libnmc_base_la_OBJECTS): clients/common/.dirstamp clients_common_settings_doc_h = clients/common/settings-docs.h if HAVE_INTROSPECTION -$(clients_common_settings_doc_h): clients/common/settings-docs.xsl libnm/nm-property-docs.xml clients/common/.dirstamp +$(clients_common_settings_doc_h): clients/common/settings-docs.xsl libnm/nm-settings-docs-gir.xml clients/common/.dirstamp $(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^) DISTCLEANFILES += $(clients_common_settings_doc_h) check-local-settings-docs: $(clients_common_settings_doc_h) @@ -4442,8 +4445,8 @@ clients_common_tests_test_clients_common_LDFLAGS = \ clients_common_tests_test_clients_common_LDADD = \ clients/common/libnmc.la \ clients/common/libnmc-base.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ @@ -4486,7 +4489,7 @@ clients_common_tests_test_libnm_core_aux_LDFLAGS = \ $(NULL) clients_common_tests_test_libnm_core_aux_LDADD = \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ @@ -4533,12 +4536,12 @@ clients_cli_nmcli_CPPFLAGS = \ clients_cli_nmcli_LDADD = \ clients/common/libnmc.la \ clients/common/libnmc-base.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ - shared/nm-libnm-aux/libnm-libnm-aux.la \ + libnm/nm-libnm-aux/libnm-libnm-aux.la \ libnm/libnm.la \ $(GLIB_LIBS) \ $(READLINE_LIBS) @@ -4563,6 +4566,43 @@ uninstall_hook += uninstall-hook-nmcli endif +############################################################################### + +noinst_PROGRAMS += clients/cli/generate-docs-nm-settings-nmcli + +clients_cli_generate_docs_nm_settings_nmcli_SOURCES = \ + clients/cli/generate-docs-nm-settings-nmcli.c \ + $(NULL) + +clients_cli_generate_docs_nm_settings_nmcli_CPPFLAGS = \ + -I$(srcdir)/clients/common \ + $(clients_cppflags) \ + -DG_LOG_DOMAIN=\""nmcli"\" \ + $(NULL) + +clients_cli_generate_docs_nm_settings_nmcli_LDADD = \ + clients/common/libnmc.la \ + clients/common/libnmc-base.la \ + libnm/nm-libnm-aux/libnm-libnm-aux.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm/libnm.la \ + shared/nm-glib-aux/libnm-glib-aux.la \ + shared/nm-std-aux/libnm-std-aux.la \ + shared/libcsiphash.la \ + $(GLIB_LIBS) \ + $(NULL) + +clients_cli_generate_docs_nm_settings_nmcli_LDFLAGS = \ + -Wl,--version-script="$(srcdir)/linker-script-binary.ver" \ + $(SANITIZER_EXEC_LDFLAGS) \ + $(NULL) + +$(clients_cli_generate_docs_nm_settings_nmcli_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(clients_cli_generate_docs_nm_settings_nmcli_OBJECTS): $(libnm_lib_h_pub_mkenums) + +############################################################################### + EXTRA_DIST += \ clients/cli/nmcli-completion \ clients/cli/meson.build \ @@ -4733,9 +4773,9 @@ clients_tui_nmtui_LDADD = \ clients/tui/newt/libnmt-newt.a \ clients/common/libnmc.la \ clients/common/libnmc-base.la \ - shared/nm-libnm-aux/libnm-libnm-aux.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm/nm-libnm-aux/libnm-libnm-aux.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ @@ -4800,9 +4840,9 @@ clients_cloud_setup_nm_cloud_setup_LDFLAGS = \ $(NULL) clients_cloud_setup_nm_cloud_setup_LDADD = \ - shared/nm-libnm-aux/libnm-libnm-aux.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ + libnm/nm-libnm-aux/libnm-libnm-aux.la \ + libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \ + libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ @@ -4971,16 +5011,21 @@ man/%.1 man/%.5 man/%.7 man/%.8: man/%.xml man/common.ent endif man_nm_settings_xml = \ - man/nm-settings.xml \ + man/nm-settings-dbus.xml \ + man/nm-settings-ifcfg-rh.xml \ man/nm-settings-keyfile.xml \ - man/nm-settings-ifcfg-rh.xml + man/nm-settings-nmcli.xml \ + $(NULL) if HAVE_INTROSPECTION -man/nm-setting%.xml: man/common.ent +man/nm-settings-%.xml: man/nm-settings-%.xsl man/nm-settings-docs-%.xml man/common.ent + $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) -man/nm-setting%.xml: man/nm-setting%.xsl libnm/nm-setting%-docs.xml - $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $^ +man/nm-settings-keyfile.xml: man/nm-settings-keyfile.xsl libnm/nm-property-infos-keyfile.xml man/common.ent + $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) +man/nm-settings-ifcfg-rh.xml: man/nm-settings-ifcfg-rh.xsl libnm/nm-property-infos-ifcfg-rh.xml man/common.ent + $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) CLEANFILES += $(man_nm_settings_xml) @@ -4996,15 +5041,10 @@ man_pages += \ man/nmtui.1 man_pages_autogen += \ + man/nm-settings-dbus.5 \ man/nm-settings-keyfile.5 \ - man/nm-settings.5 - -if WITH_OPENVSWITCH -man_pages += man/nm-openvswitch.7 -else -EXTRA_DIST += man/nm-openvswitch.7 -dist_dependencies += man/nm-openvswitch.7 -endif + man/nm-settings-nmcli.5 \ + $(NULL) if CONFIG_PLUGIN_IFCFG_RH man_pages_autogen += man/nm-settings-ifcfg-rh.5 @@ -5013,6 +5053,13 @@ EXTRA_DIST += man/nm-settings-ifcfg-rh.5 dist_dependencies += man/nm-settings-ifcfg-rh.5 endif +if WITH_OPENVSWITCH +man_pages += man/nm-openvswitch.7 +else +EXTRA_DIST += man/nm-openvswitch.7 +dist_dependencies += man/nm-openvswitch.7 +endif + CLEANFILES += \ man/common.ent @@ -5022,7 +5069,8 @@ EXTRA_DIST += \ $(addsuffix .xsl,$(basename $(man_nm_settings_xml))) \ $(man_pages) \ $(addsuffix .xml,$(basename $(man_pages))) \ - $(man_pages_autogen) + $(man_pages_autogen) \ + $(NULL) if HAVE_DOCS @@ -5031,7 +5079,8 @@ install-data-hook-man: for link in $(nmtui_links); do \ ln -f $(DESTDIR)$(mandir)/man1/nmtui.1 $(DESTDIR)$(mandir)/man1/$$link.1; \ done; \ - ln -f $(DESTDIR)$(mandir)/man5/NetworkManager.conf.5 $(DESTDIR)$(mandir)/man5/nm-system-settings.conf.5; + ln -f $(DESTDIR)$(mandir)/man5/NetworkManager.conf.5 $(DESTDIR)$(mandir)/man5/nm-system-settings.conf.5; \ + ln -f $(DESTDIR)$(mandir)/man5/nm-settings-nmcli.5 $(DESTDIR)$(mandir)/man5/nm-settings.5; install_data_hook += install-data-hook-man @@ -5039,7 +5088,8 @@ uninstall-hook-man: for link in $(nmtui_links); do \ rm -f $(DESTDIR)$(mandir)/man1/$$link.1; \ done; \ - rm -f $(DESTDIR)$(mandir)/man5/nm-system-settings.conf.5; + rm -f $(DESTDIR)$(mandir)/man5/nm-system-settings.conf.5; \ + rm -f $(DESTDIR)$(mandir)/man5/nm-settings.5; uninstall_hook += uninstall-hook-man diff --git a/clients/cli/generate-docs-nm-settings-nmcli.c b/clients/cli/generate-docs-nm-settings-nmcli.c new file mode 100644 index 0000000000..8ae5b13e49 --- /dev/null +++ b/clients/cli/generate-docs-nm-settings-nmcli.c @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: LGPL-2.1+ + +#include "nm-default.h" + +#include "nm-meta-setting-desc.h" + +#define INDENT 4 + +static char * +_xml_escape_attribute (const char *value) +{ + gs_free char *s = NULL; + + s = g_markup_escape_text (value, -1); + return g_strdup_printf ("\"%s\"", s); +} + +static const char * +_indent_level (guint num_spaces) +{ + static const char spaces[] = " "; + + nm_assert (num_spaces < G_N_ELEMENTS (spaces)); + return &spaces[G_N_ELEMENTS (spaces) - num_spaces - 1]; +} + +int +main (int argc, char *argv[]) +{ + int i_sett_infos; + int i_property; + + g_print ("\n"); + for (i_sett_infos = 0; i_sett_infos < G_N_ELEMENTS (nm_meta_setting_infos_editor); i_sett_infos++) { + const NMMetaSettingInfoEditor *sett_info = &nm_meta_setting_infos_editor[i_sett_infos]; + gs_free char *tmp1 = NULL; + + g_print ("%s\n", tmp1 = _xml_escape_attribute (sett_info->general->setting_name)); + + for (i_property = 0; i_property < sett_info->properties_num; i_property++) { + const NMMetaPropertyInfo *prop_info = sett_info->properties[i_property]; + gs_free char *tmp2 = NULL; + gs_free char *tmp3 = NULL; + + g_print ("%sproperty_name)); + if (prop_info->property_alias) + g_print ("\n%salias=%s", _indent_level (2*INDENT + 10), tmp3 = _xml_escape_attribute (prop_info->property_alias)); + g_print (" />\n"); + } + + g_print ("%s\n", _indent_level (INDENT)); + } + g_print ("\n"); + return 0; +} diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 8dd05affcc..517deffa69 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1+ -name = 'nmcli' +if enable_nmcli # FIXME: nmcli-completion should be renamed to nmcli install_data( @@ -8,15 +8,8 @@ install_data( install_dir: join_paths(nm_datadir, 'bash-completion', 'completions'), ) -deps = [ - libnmc_base_dep, - libnmc_dep, - readline_dep, - libnm_libnm_aux_dep, -] - executable( - name, + 'nmcli', files( 'agent.c', 'common.c', @@ -28,9 +21,38 @@ executable( 'settings.c', 'utils.c', ), - dependencies: deps, - c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)], + dependencies: [ + libnmc_base_dep, + libnmc_dep, + readline_dep, + libnm_libnm_aux_dep, + ], + c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format('nmcli')], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, ) + +endif + +generate_docs_nm_settings_nmcli = executable( + 'generate-docs-nm-settings-nmcli', + files( + 'generate-docs-nm-settings-nmcli.c', + ), + dependencies: [ + libnmc_base_dep, + libnmc_dep, + libnm_libnm_aux_dep, + ], + c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format('nmcli')], + link_args: ldflags_linker_script_binary, + link_depends: linker_script_binary, +) + +generate_docs_nm_settings_nmcli_xml = custom_target( + 'generate-docs-nm-settings-nmcli.xml', + output: 'generate-docs-nm-settings-nmcli.xml', + command: [ generate_docs_nm_settings_nmcli ], + capture: true, +) diff --git a/clients/common/meson.build b/clients/common/meson.build index c32bb5e7cc..cefcfce02d 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -34,7 +34,7 @@ settings_docs = 'settings-docs.h' if enable_introspection settings_docs_source = custom_target( settings_docs, - input: nm_property_docs, + input: nm_settings_docs_xml_gir, output: settings_docs, command: [xsltproc, '--output', '@OUTPUT@', join_paths(meson.current_source_dir(), 'settings-docs.xsl'), '@INPUT@'], ) diff --git a/clients/meson.build b/clients/meson.build index 5e6dd6a4c8..8d0ece7592 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -19,10 +19,7 @@ executable( ) subdir('common') - -if enable_nmcli - subdir('cli') -endif +subdir('cli') if enable_nmtui subdir('tui') diff --git a/configure.ac b/configure.ac index 174b86ea55..f1f6afbf28 100644 --- a/configure.ac +++ b/configure.ac @@ -1284,9 +1284,10 @@ if test "$build_docs" != "yes" -a \ \ -f "$srcdir"/man/nm-openvswitch.7 -a \ \ + -f "$srcdir"/man/nm-settings-dbus.5 -a \ -f "$srcdir"/man/nm-settings-ifcfg-rh.5 -a \ -f "$srcdir"/man/nm-settings-keyfile.5 -a \ - -f "$srcdir"/man/nm-settings.5 -a \ + -f "$srcdir"/man/nm-settings-nmcli.5 -a \ \ -f "$srcdir"/man/nm-settings.xml -a \ -f "$srcdir"/man/nm-settings-keyfile.xml -a \ diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am index 44933bc980..dfa3210c68 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -7,8 +7,8 @@ GENERATED_FILES = if BUILD_DOCS -settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm/nm-settings-docs.xml - $(AM_V_GEN) xsltproc --output $@ $^ +settings-spec.xml: settings-spec.xsl $(top_builddir)/man/nm-settings-docs-dbus.xml + $(AM_V_GEN) (! test -f $@ || chmod u+w $@) && xsltproc --output $@ $^ # Top-level SGML file includes (depends on) settings-spec.xml $(DOC_MAIN_SGML_FILE): settings-spec.xml @@ -88,8 +88,9 @@ content_files = \ $(top_builddir)/man/NetworkManager.xml \ $(top_builddir)/man/NetworkManager.conf.xml \ $(top_builddir)/man/nmcli-examples.xml \ - $(top_builddir)/man/nm-settings.xml \ + $(top_builddir)/man/nm-settings-dbus.xml \ $(top_builddir)/man/nm-settings-keyfile.xml \ + $(top_builddir)/man/nm-settings-nmcli.xml \ version.xml \ $(NULL) @@ -104,6 +105,25 @@ endif include $(top_srcdir)/gtk-doc.make +# workaround setup-build.stamp from gtk-doc.make, which copies +# the file as read-only. That breaks later build steps, as the +# file can no longer be written. Instead, copy the file with `cp -f` +# only. +setup-build.stamp: + -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \ + if test "x$$files" != "x" ; then \ + for file in $$files ; do \ + destdir=`dirname $(abs_builddir)/$$file`; \ + test -d "$$destdir" || mkdir -p "$$destdir"; \ + test -f $(abs_srcdir)/$$file && \ + ( cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file ; \ + chmod u+w $(abs_builddir)/$$file ) || true; \ + done; \ + fi; \ + fi + $(AM_V_at)touch setup-build.stamp + #################################### EXTRA_DIST += version.xml.in settings-spec.xsl meson.build $(GENERATED_FILES) diff --git a/docs/api/meson.build b/docs/api/meson.build index d4da41b0b9..5f502b23ac 100644 --- a/docs/api/meson.build +++ b/docs/api/meson.build @@ -6,7 +6,7 @@ if enable_introspection inputs = [ settings + '.xsl', - nm_settings_docs, + nm_settings_docs_xml['dbus'], ] content_files += custom_target( diff --git a/docs/api/network-manager-docs.xml b/docs/api/network-manager-docs.xml index 883df41d78..a97eaa895d 100644 --- a/docs/api/network-manager-docs.xml +++ b/docs/api/network-manager-docs.xml @@ -73,7 +73,8 @@ - + + diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index ce82d7eb94..6f04cd1e4d 100644 --- a/docs/libnm/Makefile.am +++ b/docs/libnm/Makefile.am @@ -34,11 +34,12 @@ CFILE_GLOB=$(top_srcdir)/libnm-core/*.c $(top_srcdir)/libnm/*.c # Header files to ignore when scanning. IGNORE_HFILES= \ common.h \ - nm-crypto.h \ - nm-crypto-impl.h \ - nm-dbus-helpers.h \ nm-core-internal.h \ + nm-core-tests-enum-types.h \ nm-core-types-internal.h \ + nm-crypto-impl.h \ + nm-crypto.h \ + nm-dbus-helpers.h \ nm-device-private.h \ nm-dhcp4-config.h \ nm-dhcp6-config.h \ @@ -51,10 +52,23 @@ IGNORE_HFILES= \ nm-remote-connection-private.h \ nm-setting-private.h \ nm-utils-private.h \ - nm-core-tests-enum-types.h \ + \ + test-general-enums.h \ + \ nm-keyfile-internal.h \ nm-keyfile-utils.h \ - test-general-enums.h + \ + nm-auth-subject.h \ + nm-common-macros.h \ + nm-ethtool-utils.h \ + nm-libnm-core-utils.h \ + \ + nm-dispatcher-api.h \ + nm-libnm-core-aux.h \ + \ + nm-libnm-aux.h \ + \ + $(NULL) # Images to copy into HTML directory. HTML_IMAGES = libnm.png diff --git a/docs/libnm/meson.build b/docs/libnm/meson.build index 66cd31e899..275522db2a 100644 --- a/docs/libnm/meson.build +++ b/docs/libnm/meson.build @@ -7,11 +7,12 @@ src_dirs = [ private_headers = [ 'common.h', - 'nm-crypto.h', - 'nm-crypto-impl.h', - 'nm-dbus-helpers.h', 'nm-core-internal.h', + 'nm-core-tests-enum-types.h', 'nm-core-types-internal.h', + 'nm-crypto-impl.h', + 'nm-crypto.h', + 'nm-dbus-helpers.h', 'nm-device-private.h', 'nm-dhcp4-config.h', 'nm-dhcp6-config.h', @@ -24,10 +25,19 @@ private_headers = [ 'nm-remote-connection-private.h', 'nm-setting-private.h', 'nm-utils-private.h', - 'nm-core-tests-enum-types.h', + + 'test-general-enums.h', + 'nm-keyfile-internal.h', 'nm-keyfile-utils.h', - 'test-general-enums.h', + + 'nm-auth-subject.h', + 'nm-common-macros.h', + 'nm-ethtool-utils.h', + 'nm-libnm-core-utils.h', + + 'nm-dispatcher-api.h', + 'nm-libnm-core-aux.h', ] scan_args = [ diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 955e17766b..89acaf72ad 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -88,7 +88,11 @@ libnm_core_enum_sources = gnome.mkenums_simple( libnm_libnm_core_intern = static_library( 'nm-libnm-core-intern', - sources: nm_ethtool_utils_source + nm_libnm_core_utils_source + nm_auth_subject_source + [libnm_core_enum_sources[1]], + sources: files( + 'nm-libnm-core-intern/nm-auth-subject.c', + 'nm-libnm-core-intern/nm-ethtool-utils.c', + 'nm-libnm-core-intern/nm-libnm-core-utils.c', + ) + [libnm_core_enum_sources[1]], dependencies: libnm_core_nm_default_dep, c_args: common_c_flags, ) @@ -221,7 +225,9 @@ c_flags = [ libnm_libnm_core_aux = static_library( 'nm-libnm-core-aux', - sources: nm_libnm_core_aux_source + [libnm_core_enum_sources[1]], + sources: files( + 'nm-libnm-core-aux/nm-libnm-core-aux.c', + ) + [libnm_core_enum_sources[1]], dependencies: libnm_utils_base_dep, c_args: c_flags, link_with: libnm_libnm_core_intern, @@ -236,7 +242,10 @@ libnm_libnm_core_aux_dep = declare_dependency( libnm_keyfile = static_library( 'nm-keyfile', - sources: nm_keyfile_source + [libnm_core_enum_sources[1]], + sources: files( + 'nm-keyfile/nm-keyfile-utils.c', + 'nm-keyfile/nm-keyfile.c', + ) + [libnm_core_enum_sources[1]], dependencies: libnm_utils_base_dep, c_args: [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), diff --git a/shared/nm-keyfile/nm-keyfile-internal.h b/libnm-core/nm-keyfile/nm-keyfile-internal.h similarity index 100% rename from shared/nm-keyfile/nm-keyfile-internal.h rename to libnm-core/nm-keyfile/nm-keyfile-internal.h diff --git a/shared/nm-keyfile/nm-keyfile-utils.c b/libnm-core/nm-keyfile/nm-keyfile-utils.c similarity index 100% rename from shared/nm-keyfile/nm-keyfile-utils.c rename to libnm-core/nm-keyfile/nm-keyfile-utils.c diff --git a/shared/nm-keyfile/nm-keyfile-utils.h b/libnm-core/nm-keyfile/nm-keyfile-utils.h similarity index 100% rename from shared/nm-keyfile/nm-keyfile-utils.h rename to libnm-core/nm-keyfile/nm-keyfile-utils.h diff --git a/shared/nm-keyfile/nm-keyfile.c b/libnm-core/nm-keyfile/nm-keyfile.c similarity index 100% rename from shared/nm-keyfile/nm-keyfile.c rename to libnm-core/nm-keyfile/nm-keyfile.c diff --git a/libnm-core/nm-libnm-core-aux/README.md b/libnm-core/nm-libnm-core-aux/README.md new file mode 100644 index 0000000000..01f361b44d --- /dev/null +++ b/libnm-core/nm-libnm-core-aux/README.md @@ -0,0 +1,21 @@ +nm-libnm-core-aux is a static library that: + + - uses parts of "libnm-core", that are public API of "libnm" + - can be statically linked into users of libnm-core (like libnm + and NetworkManager). + - that can also be statically linked into other users of libnm. + +Basically, it is a static library with utility functions that extends +libnm-core (the part that is public API of libnm), but can also be +used without full libnm. + +That means: + + - you can use it everywhere where you either statically link + with libnm-core, or dynamically link with libnm. + - you cannot use it inside libnm-core itself. This is the difference + between nm-libnm-core-intern and nm-libnm-core-aux. + +Also, since nm-libnm-core-aux itself only uses public (stable) +API of libnm, you theoretically can copy the sources into your +own source tree. diff --git a/shared/nm-libnm-core-aux/nm-dispatcher-api.h b/libnm-core/nm-libnm-core-aux/nm-dispatcher-api.h similarity index 100% rename from shared/nm-libnm-core-aux/nm-dispatcher-api.h rename to libnm-core/nm-libnm-core-aux/nm-dispatcher-api.h diff --git a/shared/nm-libnm-core-aux/nm-libnm-core-aux.c b/libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.c similarity index 100% rename from shared/nm-libnm-core-aux/nm-libnm-core-aux.c rename to libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.c diff --git a/shared/nm-libnm-core-aux/nm-libnm-core-aux.h b/libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.h similarity index 100% rename from shared/nm-libnm-core-aux/nm-libnm-core-aux.h rename to libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.h diff --git a/libnm-core/nm-libnm-core-intern/README.md b/libnm-core/nm-libnm-core-intern/README.md new file mode 100644 index 0000000000..2dcc3c80cd --- /dev/null +++ b/libnm-core/nm-libnm-core-intern/README.md @@ -0,0 +1,21 @@ +nm-libnm-core-intern is a static library that: + + - uses parts of "libnm-core", that are public API of "libnm" + - that is statically linked into libnm-core (and thus libnm + and NetworkManager). + - that can also be statically linked into other users of libnm. + +Basically, it is a static library with utility functions that extends +libnm-core (the part that is public API of libnm), but it is used +by libnm-core. + +That means: + + - you can use it everywhere where you either statically link + with libnm-core, or dynamically link with libnm. + - you can even use it inside of libnm-core itself. This is the difference + between nm-libnm-core-intern and nm-libnm-core-aux. + +Also, since nm-libnm-core-intern itself only uses public (stable) +API of libnm, you theoretically can copy the sources into your +own source tree. diff --git a/shared/nm-libnm-core-intern/nm-auth-subject.c b/libnm-core/nm-libnm-core-intern/nm-auth-subject.c similarity index 100% rename from shared/nm-libnm-core-intern/nm-auth-subject.c rename to libnm-core/nm-libnm-core-intern/nm-auth-subject.c diff --git a/shared/nm-libnm-core-intern/nm-auth-subject.h b/libnm-core/nm-libnm-core-intern/nm-auth-subject.h similarity index 100% rename from shared/nm-libnm-core-intern/nm-auth-subject.h rename to libnm-core/nm-libnm-core-intern/nm-auth-subject.h diff --git a/shared/nm-libnm-core-intern/nm-common-macros.h b/libnm-core/nm-libnm-core-intern/nm-common-macros.h similarity index 100% rename from shared/nm-libnm-core-intern/nm-common-macros.h rename to libnm-core/nm-libnm-core-intern/nm-common-macros.h diff --git a/shared/nm-libnm-core-intern/nm-ethtool-utils.c b/libnm-core/nm-libnm-core-intern/nm-ethtool-utils.c similarity index 100% rename from shared/nm-libnm-core-intern/nm-ethtool-utils.c rename to libnm-core/nm-libnm-core-intern/nm-ethtool-utils.c diff --git a/shared/nm-libnm-core-intern/nm-ethtool-utils.h b/libnm-core/nm-libnm-core-intern/nm-ethtool-utils.h similarity index 100% rename from shared/nm-libnm-core-intern/nm-ethtool-utils.h rename to libnm-core/nm-libnm-core-intern/nm-ethtool-utils.h diff --git a/shared/nm-libnm-core-intern/nm-libnm-core-utils.c b/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c similarity index 100% rename from shared/nm-libnm-core-intern/nm-libnm-core-utils.c rename to libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.c diff --git a/shared/nm-libnm-core-intern/nm-libnm-core-utils.h b/libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h similarity index 100% rename from shared/nm-libnm-core-intern/nm-libnm-core-utils.h rename to libnm-core/nm-libnm-core-intern/nm-libnm-core-utils.h diff --git a/libnm/meson.build b/libnm/meson.build index 406766c707..d3991ab19c 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -212,35 +212,52 @@ if enable_introspection install: true, ) - generate_plugin_docs = join_paths(meson.current_source_dir(), 'generate-plugin-docs.pl') - - name = 'nm-settings-keyfile-docs.xml' - nm_settings_keyfile_docs = custom_target( - name, - input: libnm_core_settings_sources, - output: name, - command: [perl, generate_plugin_docs, 'keyfile', '@OUTPUT@', '@INPUT@'], - ) - - name = 'nm-settings-docs-overrides.xml' - nm_settings_docs_overrides = custom_target( - name, - input: libnm_core_settings_sources, - output: name, - command: [perl, generate_plugin_docs, 'dbus', '@OUTPUT@', '@INPUT@'], - ) - + infos = [ 'dbus', 'nmcli', 'keyfile' ] if enable_ifcfg_rh - name = 'nm-settings-ifcfg-rh-docs.xml' - nm_settings_ifcfg_rh_docs = custom_target( - name, - input: libnm_core_settings_sources, - output: name, - command: [perl, generate_plugin_docs, 'ifcfg-rh', '@OUTPUT@', '@INPUT@'], - ) + infos += [ 'ifcfg-rh' ] endif + foreach info: infos + t = custom_target( + 'nm-propery-infos-' + info + '.xml', + input: libnm_core_settings_sources, + output: 'nm-propery-infos-' + info + '.xml', + command: [ + perl, + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-property-infos.pl'), + info, + '@OUTPUT@', + '@INPUT@' + ], + ) - generate_setting_docs = join_paths(meson.current_source_dir(), 'generate-setting-docs.py') + # meson 0.47 doesn't support non-static keys for dicts + # nor extending dicts incrementally. Workaround. + if info == 'dbus' + nm_property_infos_xml_dbus = t + elif info == 'keyfile' + nm_property_infos_xml_keyfile = t + elif info == 'ifcfg-rh' + nm_property_infos_xml_ifcfg_rh = t + elif info == 'nmcli' + nm_property_infos_xml_nmcli = t + else + assert(false) + endif + endforeach + if enable_ifcfg_rh + nm_property_infos_xml = { + 'dbus': nm_property_infos_xml_dbus, + 'keyfile': nm_property_infos_xml_keyfile, + 'nmcli': nm_property_infos_xml_nmcli, + 'ifcfg-rh': nm_property_infos_xml_ifcfg_rh, + } + else + nm_property_infos_xml = { + 'dbus': nm_property_infos_xml_dbus, + 'keyfile': nm_property_infos_xml_keyfile, + 'nmcli': nm_property_infos_xml_nmcli, + } + endif gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH').stdout() if gi_typelib_path != '' @@ -260,23 +277,21 @@ if enable_introspection 'LD_LIBRARY_PATH=' + ld_library_path, ] - name = 'nm-property-docs.xml' - nm_property_docs = custom_target( - name, + nm_settings_docs_xml_gir = custom_target( + 'nm-settings-docs-gir.xml', input: libnm_gir[0], - output: name, - command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@'], + output: 'nm-settings-docs-gir.xml', + command: [ + generate_setting_docs_env, + python.path(), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-gir.py'), + '--lib-path', meson.current_build_dir(), + '--gir', '@INPUT@', + '--output', '@OUTPUT@' + ], depends: libnm_gir, ) - name = 'nm-settings-docs.xml' - nm_settings_docs = custom_target( - name, - input: [libnm_gir[0], nm_settings_docs_overrides], - output: name, - command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT0@', '--overrides', '@INPUT1@', '--output', '@OUTPUT@'], - depends: libnm_gir, - ) endif if enable_tests @@ -285,7 +300,9 @@ endif libnm_libnm_aux = static_library( 'nm-libnm-aux', - sources: nm_libnm_aux_source, + sources: files( + 'nm-libnm-aux/nm-libnm-aux.c', + ), c_args: [ '-DG_LOG_DOMAIN="@0@"'.format('libnmc'), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', diff --git a/libnm/nm-libnm-aux/README.md b/libnm/nm-libnm-aux/README.md new file mode 100644 index 0000000000..460b269e6d --- /dev/null +++ b/libnm/nm-libnm-aux/README.md @@ -0,0 +1,15 @@ +nm-libnm-aux is a static library that: + + - uses the public parts of "libnm" + - that can also be statically linked into other users of libnm. + +Basically, it is a static library with utility functions that extends +libnm. + +That means: + + - you can use it everywhere where you dynamically link with libnm. + +Also, since nm-libnm-aux itself only uses public (stable) +API of libnm, you theoretically can copy the sources into your +own source tree. diff --git a/shared/nm-libnm-aux/nm-libnm-aux.c b/libnm/nm-libnm-aux/nm-libnm-aux.c similarity index 100% rename from shared/nm-libnm-aux/nm-libnm-aux.c rename to libnm/nm-libnm-aux/nm-libnm-aux.c diff --git a/shared/nm-libnm-aux/nm-libnm-aux.h b/libnm/nm-libnm-aux/nm-libnm-aux.h similarity index 100% rename from shared/nm-libnm-aux/nm-libnm-aux.h rename to libnm/nm-libnm-aux/nm-libnm-aux.h diff --git a/man/meson.build b/man/meson.build index 407d027e90..0be202bae1 100644 --- a/man/meson.build +++ b/man/meson.build @@ -56,13 +56,50 @@ foreach man: mans endforeach if enable_introspection + + name = 'dbus' + nm_settings_docs_xml_dbus = custom_target( + 'nm-settings-docs-' + name + '.xml', + input: [nm_settings_docs_xml_gir, nm_property_infos_xml[name]], + output: 'nm-settings-docs-' + name + '.xml', + command: [ + python.path(), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py'), + '@OUTPUT@', + nm_property_infos_xml[name], + nm_settings_docs_xml_gir, + ], + ) + + name = 'nmcli' + nm_settings_docs_xml_nmcli = custom_target( + 'nm-settings-docs-' + name + '.xml', + input: [nm_settings_docs_xml_gir, nm_property_infos_xml[name]], + output: 'nm-settings-docs-' + name + '.xml', + command: [ + python.path(), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py'), + '@OUTPUT@', + generate_docs_nm_settings_nmcli_xml, + nm_property_infos_xml[name], + nm_settings_docs_xml_gir, + ], + ) + + nm_settings_docs_xml = { + 'gir': nm_settings_docs_xml_gir, + 'dbus': nm_settings_docs_xml_dbus, + 'nmcli': nm_settings_docs_xml_nmcli, + } + mans = [ - ['nm-settings-keyfile', '5', nm_settings_keyfile_docs], - ['nm-settings', '5', nm_settings_docs], + ['nm-settings-keyfile', '5', nm_property_infos_xml['keyfile']], + ['nm-settings-dbus', '5', nm_settings_docs_xml['dbus']], + ['nm-settings-nmcli', '5', nm_settings_docs_xml['nmcli']], ] if enable_ifcfg_rh - mans += [['nm-settings-ifcfg-rh', '5', nm_settings_ifcfg_rh_docs]] + mans += [['nm-settings-ifcfg-rh', '5', nm_property_infos_xml['ifcfg-rh']]] endif foreach man: mans diff --git a/man/nm-settings.xsl b/man/nm-settings-dbus.xsl similarity index 89% rename from man/nm-settings.xsl rename to man/nm-settings-dbus.xsl index 57d5ce41cf..b4841ce200 100644 --- a/man/nm-settings.xsl +++ b/man/nm-settings-dbus.xsl @@ -13,21 +13,21 @@ /> - + - nm-settings + nm-settings-dbus NetworkManager developers - nm-settings + nm-settings-dbus 5 NetworkManager Configuration &NM_VERSION; - nm-settings - Description of settings and properties of NetworkManager connection profiles + nm-settings-dbus + Description of settings and properties of NetworkManager connection profiles on the D-Bus API Description @@ -122,10 +122,14 @@ See Also - NetworkManager8, + + nm-settings-nmcli5, + nm-settings-keyfile5, + NetworkManager8, nmcli1, nmcli-examples7, - NetworkManager.conf5 + NetworkManager.conf5 + @@ -155,7 +159,7 @@ - nm-settings.property.. + nm-settings-dbus.property.. (see for flag values) diff --git a/man/nm-settings-ifcfg-rh.xsl b/man/nm-settings-ifcfg-rh.xsl index e14b742fe9..13f4ad6bc4 100644 --- a/man/nm-settings-ifcfg-rh.xsl +++ b/man/nm-settings-ifcfg-rh.xsl @@ -8,7 +8,7 @@ - + - + nm-settings-ifcfg-rh diff --git a/man/nm-settings-keyfile.xsl b/man/nm-settings-keyfile.xsl index c22bd4fc04..c70228bbc8 100644 --- a/man/nm-settings-keyfile.xsl +++ b/man/nm-settings-keyfile.xsl @@ -12,7 +12,7 @@ doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" /> - + nm-settings-keyfile diff --git a/man/nm-settings-nmcli.xsl b/man/nm-settings-nmcli.xsl new file mode 100644 index 0000000000..a1dd94b6e0 --- /dev/null +++ b/man/nm-settings-nmcli.xsl @@ -0,0 +1,145 @@ + + +%entities; +]> + + + + + + + + nm-settings-nmcli + NetworkManager developers + + + nm-settings-nmcli + 5 + NetworkManager + Configuration + &NM_VERSION; + + + nm-settings-nmcli + Description of settings and properties of NetworkManager connection profiles for nmcli + + + Description + + NetworkManager is based on a concept of connection profiles, sometimes referred to as + connections only. These connection profiles contain a network configuration. When + NetworkManager activates a connection profile on a network device the configuration will + be applied and an active network connection will be established. Users are free to create + as many connection profiles as they see fit. Thus they are flexible in having various network + configurations for different networking needs. + + + NetworkManager provides an API for configuring connection profiles, for activating them + to configure the network, and inspecting the current network configuration. The command + line tool nmcli is a client application to NetworkManager that uses + this API. See nmcli1 + for details. + + + With commands like nmcli connection add, nmcli connection modify + and nmcli connection show, connection profiles can be created, modified + and inspected. A profile consists of properties. On D-Bus this follows the format + as described by nm-settings-dbus5, + while this manual page describes the settings format how they are expected by nmcli. + + + The settings and properties shown in tables below list all available connection + configuration options. However, note that not all settings are applicable to all + connection types. nmcli connection editor has also a built-in + describe command that can display description of particular settings + and properties of this page. + + + + Secret flag types: + + Each password or secret property in a setting has an associated flags property + that describes how to handle that secret. The flags property is a bitfield + that contains zero or more of the following values logically OR-ed together. + + + + 0x0 (none) - the system is responsible for providing and storing this secret. This + may be required so that secrets are already available before the user logs in. + It also commonly means that the secret will be stored in plain text on disk, accessible + to root only. For example via the keyfile settings plugin as described in the "PLUGINS" section + in NetworkManager.conf5. + + + + 0x1 (agent-owned) - a user-session secret agent is responsible for providing and storing + this secret; when it is required, agents will be asked to provide it. + + + 0x2 (not-saved) - this secret should not be saved but should be requested from the user + each time it is required. This flag should be used for One-Time-Pad secrets, PIN codes from hardware tokens, + or if the user simply does not want to save the secret. + + + 0x4 (not-required) - in some situations it cannot be automatically determined that a secret + is required or not. This flag hints that the secret is not required and should not be requested from the user. + + + + + + Files + /etc/NetworkManager/system-connections or distro plugin-specific location + + + See Also + + nm-settings-dbus5, + nm-settings-keyfile5, + NetworkManager8, + nmcli1, + nmcli-examples7, + NetworkManager.conf5 + + + + + + + <xsl:value-of select="@name"/> setting + . + + + + + Key Name + Value Type + Default Value + Value Description + + + + + + + + + + + + + + nm-settings-nmcli.property.. + + + (see for flag values) + + + + diff --git a/meson.build b/meson.build index 3e8c671144..39b07474d8 100644 --- a/meson.build +++ b/meson.build @@ -12,7 +12,7 @@ project( 'buildtype=debugoptimized', 'c_std=gnu11', ], - meson_version: '>= 0.46.0', + meson_version: '>= 0.47.2', ) nm_name = meson.project_name() diff --git a/po/POTFILES.in b/po/POTFILES.in index 93df2fa2a5..25cb5c4a6c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -56,6 +56,9 @@ libnm-core/nm-crypto-gnutls.c libnm-core/nm-crypto-nss.c libnm-core/nm-connection.c libnm-core/nm-dbus-utils.c +libnm-core/nm-keyfile/nm-keyfile-utils.c +libnm-core/nm-keyfile/nm-keyfile.c +libnm-core/nm-libnm-core-aux/nm-libnm-core-aux.c libnm-core/nm-setting-6lowpan.c libnm-core/nm-setting-8021x.c libnm-core/nm-setting-adsl.c @@ -140,9 +143,6 @@ libnm/nm-vpn-plugin-old.c libnm/nm-vpn-service-plugin.c data/org.freedesktop.NetworkManager.policy.in.in shared/nm-glib-aux/nm-shared-utils.c -shared/nm-keyfile/nm-keyfile-utils.c -shared/nm-keyfile/nm-keyfile.c -shared/nm-libnm-core-aux/nm-libnm-core-aux.c src/NetworkManagerUtils.c src/main.c src/main-utils.c diff --git a/shared/meson.build b/shared/meson.build index 9a8768f539..48880ec4f6 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -107,27 +107,12 @@ nm_version_macro_header = configure_file( configuration: data_conf, ) -nm_ethtool_utils_source = files('nm-libnm-core-intern/nm-ethtool-utils.c') - -nm_libnm_core_aux_source = files('nm-libnm-core-aux/nm-libnm-core-aux.c') - -nm_libnm_core_utils_source = files('nm-libnm-core-intern/nm-libnm-core-utils.c') - -nm_keyfile_source = files( - 'nm-keyfile/nm-keyfile-utils.c', - 'nm-keyfile/nm-keyfile.c', -) - -nm_libnm_aux_source = files('nm-libnm-aux/nm-libnm-aux.c') - nm_meta_setting_source = files('nm-meta-setting.c') nm_test_utils_impl_source = files('nm-test-utils-impl.c') nm_vpn_plugin_utils_source = files('nm-utils/nm-vpn-plugin-utils.c') -nm_auth_subject_source = files('nm-libnm-core-intern/nm-auth-subject.c') - c_flags = [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=0', diff --git a/libnm/generate-plugin-docs.pl b/tools/generate-docs-nm-property-infos.pl similarity index 96% rename from libnm/generate-plugin-docs.pl rename to tools/generate-docs-nm-property-infos.pl index 540ecb6e6c..bbdec3b632 100755 --- a/libnm/generate-plugin-docs.pl +++ b/tools/generate-docs-nm-property-infos.pl @@ -131,17 +131,13 @@ sub process_data { # - XML handling - sub write_header { (my $header = - qq{ - - - + qq{ }) =~ s/^ {7}//mg; print {$fo} $header; } sub write_footer { - my $footer = ""; + my $footer = ""; print {$fo} $footer; } diff --git a/libnm/generate-setting-docs.py b/tools/generate-docs-nm-settings-docs-gir.py similarity index 79% rename from libnm/generate-setting-docs.py rename to tools/generate-docs-nm-settings-docs-gir.py index 38b914b3c9..f63c48b1ae 100755 --- a/libnm/generate-setting-docs.py +++ b/tools/generate-docs-nm-settings-docs-gir.py @@ -172,7 +172,6 @@ def usage(): parser = argparse.ArgumentParser() parser.add_argument('-l', '--lib-path', metavar='PATH', action='append', help='path to scan for shared libraries') parser.add_argument('-g', '--gir', metavar='FILE', help='NM-1.0.gir file') -parser.add_argument('-x', '--overrides', metavar='FILE', help='documentation overrides file') parser.add_argument('-o', '--output', metavar='FILE', help='output file') args = parser.parse_args() @@ -195,9 +194,6 @@ settings = sorted(settings, key=settings_sort_key) init_constants(girxml, settings) -if args.overrides is not None: - overrides = ET.parse(args.overrides).getroot() - outfile.write(""" @@ -218,48 +214,31 @@ for settingxml in settings: outfile.write(" \n" % (setting.props.name, class_desc, get_setting_name_define (settingxml))) setting_properties = { prop.name: prop for prop in GObject.list_properties(setting) if prop.name != 'name' } - if args.overrides is None: - setting_overrides = {} - else: - setting_overrides = { override.attrib['name']: override for override in overrides.findall('./setting[@name="%s"]/property' % setting.props.name) } - properties = sorted(set.union(set(setting_properties.keys()), set(setting_overrides.keys()))) + for prop in sorted(setting_properties): + pspec = setting_properties[prop] - for prop in properties: - value_type = None - value_desc = None - default_value = None + propxml = settingxml.find('./gi:property[@name="%s"]' % pspec.name, ns_map) + if propxml is None: + propxml = basexml.find('./gi:property[@name="%s"]' % pspec.name, ns_map) + if propxml is None: + propxml = ipxml.find('./gi:property[@name="%s"]' % pspec.name, ns_map) - if prop in setting_properties: - pspec = setting_properties[prop] - propxml = settingxml.find('./gi:property[@name="%s"]' % pspec.name, ns_map) - if propxml is None: - propxml = basexml.find('./gi:property[@name="%s"]' % pspec.name, ns_map) - if propxml is None: - propxml = ipxml.find('./gi:property[@name="%s"]' % pspec.name, ns_map) - - value_type = get_prop_type(setting, pspec) - value_desc = get_docs(propxml) - default_value = get_default_value(setting, pspec, propxml) - - if prop in setting_overrides: - override = setting_overrides[prop] - if override.attrib['format'] != '': - value_type = override.attrib['format'] - if override.attrib['description'] != '': - value_desc = override.attrib['description'] + value_type = get_prop_type(setting, pspec) + value_desc = get_docs(propxml) + default_value = get_default_value(setting, pspec, propxml) prop_upper = prop.upper().replace('-', '_') if value_desc is None: raise Exception("%s.%s needs a documentation description" % (setting.props.name, prop)) + default_value_as_xml = '' if default_value is not None: - outfile.write(" \n" % - (prop, prop_upper, value_type, escape(default_value), escape(value_desc))) - else: - outfile.write(" \n" % - (prop, prop_upper, value_type, escape(value_desc))) + default_value_as_xml = (' default=\"%s\"' % (escape(default_value))) + + outfile.write(" \n" % + (prop, prop_upper, value_type, default_value_as_xml, escape(value_desc))) outfile.write(" \n") diff --git a/tools/generate-docs-nm-settings-docs-merge.py b/tools/generate-docs-nm-settings-docs-merge.py new file mode 100755 index 0000000000..64f899ff17 --- /dev/null +++ b/tools/generate-docs-nm-settings-docs-merge.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: LGPL-2.1+ + +from __future__ import print_function + +import os +import sys +import collections +import xml.etree.ElementTree as ET + +############################################################################### + +_setting_name_order = [ + "connection", + "6lowpan", + "802-1x", + "adsl", + "bluetooth", + "bond", + "bridge", + "bridge-port", + "cdma", + "dcb", + "dummy", + "ethtool", + "generic", + "gsm", + "infiniband", + "ipv4", + "ipv6", + "ip-tunnel", + "macsec", + "macvlan", + "match", + "802-11-olpc-mesh", + "ovs-bridge", + "ovs-dpdk", + "ovs-interface", + "ovs-patch", + "ovs-port", + "ppp", + "pppoe", + "proxy", + "serial", + "sriov", + "tc", + "team", + "team-port", + "tun", + "user", + "vlan", + "vpn", + "vrf", + "vxlan", + "wifi-p2p", + "wimax", + "802-3-ethernet", + "wireguard", + "802-11-wireless", + "802-11-wireless-security", + "wpan", +] + +def _setting_name_order_idx(name): + try: + return _setting_name_order.index(name) + except ValueError: + return len(_setting_name_order) + +def key_fcn_setting_name(n1): + return (_setting_name_order_idx(n1), n1) + +def iter_keys_of_dicts(dicts, key = None): + keys = set([k for d in dicts for k in d.keys()]) + return sorted(keys, key = key) + +def node_to_dict(node, tag, key_attr): + dictionary = collections.OrderedDict() + if node is not None: + for n in node.iter(tag): + k = n.get(key_attr) + assert(k is not None) + dictionary[k] = n + return dictionary + +def node_get_attr(nodes, name): + for n in nodes: + if n is None: + continue + x = n.get(name, None) + if x: + return x + return None + +def node_set_attr(dst_node, name, nodes): + x = node_get_attr(nodes, name) + if x: + dst_node.set(name, x) + +############################################################################### + +if len(sys.argv) < 3: + print("%s [OUT_FILE] [SETTING_XML [...]]" % (sys.argv[0])) + exit(1) + +output_xml_file = sys.argv[1] + +xml_roots = list([ET.parse(f).getroot() for f in sys.argv[2:]]) + +assert(all([root.tag == 'nm-setting-docs' for root in xml_roots])) + +settings_roots = list([node_to_dict(root, 'setting', 'name') for root in xml_roots]) + +root_node = ET.Element('nm-setting-docs') + +for setting_name in iter_keys_of_dicts(settings_roots, key_fcn_setting_name): + + settings = list([d.get(setting_name) for d in settings_roots]) + + setting_node = ET.SubElement(root_node, 'setting') + + setting_node.set('name', setting_name) + + node_set_attr(setting_node, 'description', settings) + node_set_attr(setting_node, 'name_upper', settings) + + properties = list([node_to_dict(s, 'property', 'name') for s in settings]) + + for property_name in iter_keys_of_dicts(properties): + + properties_attrs = list([p.get(property_name) for p in properties]) + + property_node = ET.SubElement(setting_node, 'property') + property_node.set('name', property_name) + property_node.set('name_upper', property_name.upper().replace('-', '_')) + + x = node_get_attr(properties_attrs, 'format') + if x: + property_node.set('type', x) + else: + node_set_attr(property_node, 'type', properties_attrs) + + node_set_attr(property_node, 'default', properties_attrs) + node_set_attr(property_node, 'description', properties_attrs) + +ET.ElementTree(root_node).write(output_xml_file) diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh index a6fd0961ef..897a8c5c76 100755 --- a/tools/meson-post-install.sh +++ b/tools/meson-post-install.sh @@ -52,6 +52,7 @@ if [ "$enable_docs" = 1 ]; then done ln -f "${DESTDIR}${nm_mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${nm_mandir}/man5/nm-system-settings.conf.5" + ln -f "${DESTDIR}${nm_mandir}/man5/nm-settings-nmcli.5" "${DESTDIR}${nm_mandir}/man5/nm-settings.5" fi if [ "$enable_ifcfg_rh" = 1 ]; then