From 08f15d49a22cae654678766a98ef84c5d35404da Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 28 May 2020 14:51:11 +0200 Subject: [PATCH 01/16] build/meson: bump minimal required meson version The build for 0.46.0 probably isn't working anymore. Also, I'd like to use dictionaries, which might not be available in such old meson versions. Anyway, it's not a problem. We in general aim to build on ancient distros, like CentOS-7.5 and Ubuntu-16.04. But on those systems we install meson using `pip3 install` anyway, where we get a recent meson version. Note that on Ubuntu 16.04, `pip3 install meson` would currently give us meson 0.54.2. However, that meson requires a newer Python 3 version than we have available. Hence, on Ubuntu 16.04 we actually want to install `pip3 install meson==0.53.2`. See commit 5feba97cd186 ('gitlab-ci: use old meson version on Ubuntu 16.04 to work with ninja-1.5.1'). We also still build on Fedora 28, which installs meson 0.47.2 from packaging system. So, let's stick to 0.47.2 for now. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() From 2f78a824d885e1aaced6bc48128ce2e57461d3cd Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 28 May 2020 10:19:21 +0200 Subject: [PATCH 02/16] docs: merge settings docs in a separate step The script "libnm/generate-setting-docs.py" generates property info based on GObject introspection data. Optionally, when creating the manual for D-Bus documentation, it would accept an argument "--override" to merge the generated information with the information from an XML generated by "libnm/generate-plugin-docs.xml". Change this. Instead, let "libnm/generate-setting-docs.py" just do one thing: generate the XML based on GObject introspection data. Then, a second script "libnm/generate-docs-nm-settings-docs-merge.py" can merge the XMLs. Note that currently the manual for "nm-settings-keyfile" only contains information about properties that are explicitly mentioned for keyfile. It think that is not right. In NetworkManager there are multiple "aspects" about connection profiles: D-Bus, libnm, nmcli, keyfile and ifcfg-rh. When we generate a manual page for any of these aspects, we should always detail all properties. At least for nmcli and D-Bus. That means, we will do the merging multiple times. Hence, keep the steps for parsing GObject introspection data and the merging separate. Also, "generate-setting-docs.py" and "generate-plugin-docs.pl" should generate the same XML scheme, so that merge doesn't need special hacks. That is currently not the case, for example, the override XML contains a "format" attribute, while the other one contains a "type". Merging these is a special hack. This should be unified. --- Makefile.am | 15 +- libnm/generate-docs-nm-settings-docs-merge.py | 146 ++++++++++++++++++ libnm/generate-setting-docs.py | 51 ++---- libnm/meson.build | 21 ++- 4 files changed, 181 insertions(+), 52 deletions(-) create mode 100755 libnm/generate-docs-nm-settings-docs-merge.py diff --git a/Makefile.am b/Makefile.am index 98c81ef4d8..97b9708231 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1579,16 +1579,8 @@ libnm/nm-property-docs.xml: libnm/generate-setting-docs.py $(libnm_docs_sources) --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 $@ +libnm/nm-settings-docs.xml: libnm/nm-settings-docs-overrides.xml libnm/nm-property-docs.xml libnm/generate-docs-nm-settings-docs-merge.py + $(AM_V_GEN) "$(PYTHON)" $(srcdir)/libnm/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) 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 $<,$^) @@ -1600,8 +1592,9 @@ EXTRA_DIST += $(libnm_noinst_data) endif EXTRA_DIST += \ - libnm/generate-setting-docs.py \ libnm/generate-plugin-docs.pl \ + libnm/generate-docs-nm-settings-docs-merge.py \ + libnm/generate-setting-docs.py \ libnm/nm-enum-types.c.template \ libnm/nm-enum-types.h.template \ libnm/meson.build diff --git a/libnm/generate-docs-nm-settings-docs-merge.py b/libnm/generate-docs-nm-settings-docs-merge.py new file mode 100755 index 0000000000..8aba67391a --- /dev/null +++ b/libnm/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.startswith('nm-') 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/libnm/generate-setting-docs.py b/libnm/generate-setting-docs.py index 38b914b3c9..f63c48b1ae 100755 --- a/libnm/generate-setting-docs.py +++ b/libnm/generate-setting-docs.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/libnm/meson.build b/libnm/meson.build index 406766c707..1e8a4b388c 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -240,8 +240,6 @@ if enable_introspection ) endif - generate_setting_docs = join_paths(meson.current_source_dir(), 'generate-setting-docs.py') - gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH').stdout() if gi_typelib_path != '' gi_typelib_path = ':' + gi_typelib_path @@ -265,16 +263,29 @@ if enable_introspection name, 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@'], + command: [ + generate_setting_docs_env, + python.path(), + join_paths(meson.current_source_dir(), 'generate-setting-docs.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], + input: [nm_property_docs, 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@'], + command: [ + python.path(), + join_paths(meson.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), + '@OUTPUT@', + nm_settings_docs_overrides, + nm_property_docs, + ], depends: libnm_gir, ) endif From 7682e76de5e0c8d12867fc95a92150c1318775b8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 2 Jun 2020 17:47:30 +0200 Subject: [PATCH 03/16] docs: fix dependency of "nm-settings*xml" to "common.ent" "man/nm-settings%.xml" really should depend on "common.ent". The reason is that XSL files like "man/nm-settings.xsl" include "common.ent". The previous code already tried to express that, but for some reasons this dependency was not honored. Fix that. However, that uncovers another problem with gtk-doc.make. If we do that without the workaround for "docs/api/Makefile.am", then $ ./autogen.sh && make V=1 SHELL='sh -x' distcheck breaks. The reason is not clear to me. The new dependency leads to rebuild "man/nm-settings-keyfile.xml". But that is worse, somehow the file "$(top_srcdir)/man/nm-settings-keyfile.xml" ends up being read-only. Afterwards, gtk-doc.make does 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 || true; \ done; \ fi; \ fi $(AM_V_at)touch setup-build.stamp so that the files in build dir are also read-only. Then, make distcheck goes ahead and builds the files once again, which fails. You are welcome to understand why this workaround is necessary. Please then create a better fix. --- Makefile.am | 6 ++---- docs/api/Makefile.am | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 97b9708231..8406a5af62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4970,10 +4970,8 @@ man_nm_settings_xml = \ if HAVE_INTROSPECTION -man/nm-setting%.xml: man/common.ent - -man/nm-setting%.xml: man/nm-setting%.xsl libnm/nm-setting%-docs.xml - $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $^ +man/nm-setting%.xml: man/nm-setting%.xsl libnm/nm-setting%-docs.xml man/common.ent + $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) CLEANFILES += $(man_nm_settings_xml) diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am index 44933bc980..376cf613a0 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -8,7 +8,7 @@ GENERATED_FILES = if BUILD_DOCS settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm/nm-settings-docs.xml - $(AM_V_GEN) xsltproc --output $@ $^ + $(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 @@ -104,6 +104,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) From a9001261fbc0c7d8a51ed56e8cd3c5e880f0443b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 28 May 2020 13:51:56 +0200 Subject: [PATCH 04/16] docs: rename "nm-property-infos" doc files The naming was inconsistent. Rename. - all the property infos of this kind a now consistently called "libnm/nm-property-infos-$TAG.xml". - the script to generate files "libnm/nm-property-infos-$TAG.xml" is now called "libnm/generate-docs-nm-property-infos.pl". --- .gitignore | 9 ++- Makefile.am | 31 ++++----- ....pl => generate-docs-nm-property-infos.pl} | 0 libnm/meson.build | 65 ++++++++++++------- man/meson.build | 4 +- 5 files changed, 64 insertions(+), 45 deletions(-) rename libnm/{generate-plugin-docs.pl => generate-docs-nm-property-infos.pl} (100%) diff --git a/.gitignore b/.gitignore index cfb77444e8..e3c7cd895f 100644 --- a/.gitignore +++ b/.gitignore @@ -147,11 +147,11 @@ 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-property-infos-dbus.xml +/libnm/nm-property-infos-ifcfg-rh.xml +/libnm/nm-property-infos-keyfile.xml /libnm/nm-settings-docs.xml -/libnm/nm-settings-docs-overrides.xml -/libnm/nm-settings-keyfile-docs.xml /libnm/tests/test-libnm /libnm/tests/test-nm-client /libnm/tests/test-remote-settings-client @@ -327,6 +327,9 @@ test-*.trs /libnm/nm-keyfile-docs.xml /libnm/nm-setting-docs-overrides.xml /libnm/nm-setting-docs.xml +/libnm/nm-settings-docs-overrides.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 8406a5af62..78c7a30932 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1554,17 +1554,18 @@ INTROSPECTION_GIRS += libnm/NM-1.0.gir libnm_noinst_data = \ libnm/nm-property-docs.xml \ - libnm/nm-settings-docs-overrides.xml \ + libnm/nm-property-infos-dbus.xml \ + libnm/nm-property-infos-ifcfg-rh.xml \ + libnm/nm-property-infos-keyfile.xml \ libnm/nm-settings-docs.xml \ - libnm/nm-settings-keyfile-docs.xml \ - libnm/nm-settings-ifcfg-rh-docs.xml + $(NULL) noinst_DATA += $(libnm_noinst_data) 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: libnm/generate-docs-nm-property-infos.pl $(libnm_docs_sources) + $(AM_V_GEN) $(srcdir)/libnm/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 @@ -1579,25 +1580,21 @@ libnm/nm-property-docs.xml: libnm/generate-setting-docs.py $(libnm_docs_sources) --gir $(builddir)/libnm/NM-1.0.gir \ --output $@ -libnm/nm-settings-docs.xml: libnm/nm-settings-docs-overrides.xml libnm/nm-property-docs.xml libnm/generate-docs-nm-settings-docs-merge.py +libnm/nm-settings-docs.xml: libnm/nm-property-infos-dbus.xml libnm/nm-property-docs.xml libnm/generate-docs-nm-settings-docs-merge.py $(AM_V_GEN) "$(PYTHON)" $(srcdir)/libnm/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) -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 $<,$^) - EXTRA_DIST += $(libnm_noinst_data) endif EXTRA_DIST += \ - libnm/generate-plugin-docs.pl \ + libnm/generate-docs-nm-property-infos.pl \ libnm/generate-docs-nm-settings-docs-merge.py \ libnm/generate-setting-docs.py \ + libnm/meson.build \ libnm/nm-enum-types.c.template \ libnm/nm-enum-types.h.template \ - libnm/meson.build + $(NULL) ############################################################################### @@ -4966,11 +4963,15 @@ endif man_nm_settings_xml = \ man/nm-settings.xml \ man/nm-settings-keyfile.xml \ - man/nm-settings-ifcfg-rh.xml + man/nm-settings-ifcfg-rh.xml \ + $(NULL) if HAVE_INTROSPECTION -man/nm-setting%.xml: man/nm-setting%.xsl libnm/nm-setting%-docs.xml man/common.ent +man/nm-settings.xml: man/nm-settings.xsl libnm/nm-settings-docs.xml man/common.ent + $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) + +man/nm-settings-%.xml: man/nm-settings-%.xsl libnm/nm-property-infos-%.xml man/common.ent $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) CLEANFILES += $(man_nm_settings_xml) diff --git a/libnm/generate-plugin-docs.pl b/libnm/generate-docs-nm-property-infos.pl similarity index 100% rename from libnm/generate-plugin-docs.pl rename to libnm/generate-docs-nm-property-infos.pl diff --git a/libnm/meson.build b/libnm/meson.build index 1e8a4b388c..66fce80c8b 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -212,32 +212,47 @@ 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', 'keyfile' ] if enable_ifcfg_rh - name = 'nm-settings-ifcfg-rh-docs.xml' - nm_settings_ifcfg_rh_docs = custom_target( - name, + infos += [ 'ifcfg-rh' ] + endif + foreach info: infos + t = custom_target( + 'nm-propery-infos-' + info + '.xml', input: libnm_core_settings_sources, - output: name, - command: [perl, generate_plugin_docs, 'ifcfg-rh', '@OUTPUT@', '@INPUT@'], + output: 'nm-propery-infos-' + info + '.xml', + command: [ + perl, + join_paths(meson.current_source_dir(), 'generate-docs-nm-property-infos.pl'), + info, + '@OUTPUT@', + '@INPUT@' + ], ) + + # 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 + 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, + '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, + } endif gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH').stdout() @@ -277,13 +292,13 @@ if enable_introspection name = 'nm-settings-docs.xml' nm_settings_docs = custom_target( name, - input: [nm_property_docs, nm_settings_docs_overrides], + input: [nm_property_docs, nm_property_infos_xml['dbus']], output: name, command: [ python.path(), join_paths(meson.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), '@OUTPUT@', - nm_settings_docs_overrides, + nm_property_infos_xml['dbus'], nm_property_docs, ], depends: libnm_gir, diff --git a/man/meson.build b/man/meson.build index 407d027e90..24e6a6dc20 100644 --- a/man/meson.build +++ b/man/meson.build @@ -57,12 +57,12 @@ endforeach if enable_introspection mans = [ - ['nm-settings-keyfile', '5', nm_settings_keyfile_docs], + ['nm-settings-keyfile', '5', nm_property_infos_xml['keyfile']], ['nm-settings', '5', nm_settings_docs], ] 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 From 960ab397397a2688833fda6cf00e873624d42fd9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 28 May 2020 19:09:12 +0200 Subject: [PATCH 05/16] docs: rename "nm-property-docs.xml" to "nm-settings-docs-gir.xml" The name is bad. For one, we will have more files of the same format ("nm-settings-docs-nmcli.xml"). Also, "libnm/nm-settings-docs.xml" and "libnm/nm-property-docs.xml" had basically the same file format. Their name should be similar. Also the tool to generate the file should have a name that reminds to the file that it creates. --- .gitignore | 3 ++- Makefile.am | 16 +++++++--------- clients/common/meson.build | 2 +- ...py => generate-docs-nm-settings-docs-gir.py} | 0 libnm/meson.build | 17 ++++++++++------- 5 files changed, 20 insertions(+), 18 deletions(-) rename libnm/{generate-setting-docs.py => generate-docs-nm-settings-docs-gir.py} (100%) diff --git a/.gitignore b/.gitignore index e3c7cd895f..205a8cc1e9 100644 --- a/.gitignore +++ b/.gitignore @@ -147,10 +147,10 @@ test-*.trs /libnm-core/nm-dbus-types.xml /libnm-core/nm-vpn-dbus-types.xml -/libnm/nm-property-docs.xml /libnm/nm-property-infos-dbus.xml /libnm/nm-property-infos-ifcfg-rh.xml /libnm/nm-property-infos-keyfile.xml +/libnm/nm-settings-docs-gir.xml /libnm/nm-settings-docs.xml /libnm/tests/test-libnm /libnm/tests/test-nm-client @@ -325,6 +325,7 @@ 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 diff --git a/Makefile.am b/Makefile.am index 78c7a30932..f6fcfc7e65 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1553,10 +1553,10 @@ libnm/libnm.typelib: libnm/libnm.gir INTROSPECTION_GIRS += libnm/NM-1.0.gir libnm_noinst_data = \ - libnm/nm-property-docs.xml \ libnm/nm-property-infos-dbus.xml \ libnm/nm-property-infos-ifcfg-rh.xml \ libnm/nm-property-infos-keyfile.xml \ + libnm/nm-settings-docs-gir.xml \ libnm/nm-settings-docs.xml \ $(NULL) @@ -1567,30 +1567,28 @@ libnm_docs_sources = $(libnm_core_lib_c_settings_real) libnm/nm-property-infos-%.xml: libnm/generate-docs-nm-property-infos.pl $(libnm_docs_sources) $(AM_V_GEN) $(srcdir)/libnm/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: libnm/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)/libnm/generate-docs-nm-settings-docs-gir.py \ --gir $(builddir)/libnm/NM-1.0.gir \ --output $@ -libnm/nm-settings-docs.xml: libnm/nm-property-infos-dbus.xml libnm/nm-property-docs.xml libnm/generate-docs-nm-settings-docs-merge.py +libnm/nm-settings-docs.xml: libnm/nm-property-infos-dbus.xml libnm/nm-settings-docs-gir.xml libnm/generate-docs-nm-settings-docs-merge.py $(AM_V_GEN) "$(PYTHON)" $(srcdir)/libnm/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) EXTRA_DIST += $(libnm_noinst_data) +DISTCLEANFILES += $(libnm_noinst_data) endif EXTRA_DIST += \ libnm/generate-docs-nm-property-infos.pl \ libnm/generate-docs-nm-settings-docs-merge.py \ - libnm/generate-setting-docs.py \ + libnm/generate-docs-nm-settings-docs-gir.py \ libnm/meson.build \ libnm/nm-enum-types.c.template \ libnm/nm-enum-types.h.template \ @@ -4366,7 +4364,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) diff --git a/clients/common/meson.build b/clients/common/meson.build index c32bb5e7cc..95cf04d078 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/libnm/generate-setting-docs.py b/libnm/generate-docs-nm-settings-docs-gir.py similarity index 100% rename from libnm/generate-setting-docs.py rename to libnm/generate-docs-nm-settings-docs-gir.py diff --git a/libnm/meson.build b/libnm/meson.build index 66fce80c8b..b77a759640 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -273,15 +273,14 @@ 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, + output: 'nm-settings-docs-gir.xml', command: [ generate_setting_docs_env, python.path(), - join_paths(meson.current_source_dir(), 'generate-setting-docs.py'), + join_paths(meson.current_source_dir(), 'generate-docs-nm-settings-docs-gir.py'), '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@' @@ -289,17 +288,21 @@ if enable_introspection depends: libnm_gir, ) + nm_settings_docs_xml = { + 'gir': nm_settings_docs_xml_gir, + } + name = 'nm-settings-docs.xml' nm_settings_docs = custom_target( name, - input: [nm_property_docs, nm_property_infos_xml['dbus']], + input: [nm_settings_docs_xml_gir, nm_property_infos_xml['dbus']], output: name, command: [ python.path(), join_paths(meson.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), '@OUTPUT@', nm_property_infos_xml['dbus'], - nm_property_docs, + nm_settings_docs_xml_gir, ], depends: libnm_gir, ) From d8992ce931d4648836b466270c757905b9fadab6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 29 May 2020 10:21:07 +0200 Subject: [PATCH 06/16] docs: rename "nm-settings-docs.xml" to "nm-settings-docs-dbus.xml" "nm-settings-docs-dbus.xml" is "nm-settings-docs-gir.xml" merged with "nm-property-infos-dbus.xml". The name should reflect that, also because we will get more files with this naming scheme. --- .gitignore | 3 ++- Makefile.am | 6 +++--- docs/api/Makefile.am | 2 +- docs/api/meson.build | 2 +- libnm/meson.build | 22 ++++++++++++---------- man/meson.build | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 205a8cc1e9..ed39ed7e02 100644 --- a/.gitignore +++ b/.gitignore @@ -150,8 +150,8 @@ test-*.trs /libnm/nm-property-infos-dbus.xml /libnm/nm-property-infos-ifcfg-rh.xml /libnm/nm-property-infos-keyfile.xml +/libnm/nm-settings-docs-dbus.xml /libnm/nm-settings-docs-gir.xml -/libnm/nm-settings-docs.xml /libnm/tests/test-libnm /libnm/tests/test-nm-client /libnm/tests/test-remote-settings-client @@ -329,6 +329,7 @@ test-*.trs /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 diff --git a/Makefile.am b/Makefile.am index f6fcfc7e65..dbdcd12318 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1556,8 +1556,8 @@ libnm_noinst_data = \ libnm/nm-property-infos-dbus.xml \ libnm/nm-property-infos-ifcfg-rh.xml \ libnm/nm-property-infos-keyfile.xml \ + libnm/nm-settings-docs-dbus.xml \ libnm/nm-settings-docs-gir.xml \ - libnm/nm-settings-docs.xml \ $(NULL) noinst_DATA += $(libnm_noinst_data) @@ -1577,7 +1577,7 @@ libnm/nm-settings-docs-gir.xml: libnm/generate-docs-nm-settings-docs-gir.py libn --gir $(builddir)/libnm/NM-1.0.gir \ --output $@ -libnm/nm-settings-docs.xml: libnm/nm-property-infos-dbus.xml libnm/nm-settings-docs-gir.xml libnm/generate-docs-nm-settings-docs-merge.py +libnm/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml libnm/generate-docs-nm-settings-docs-merge.py $(AM_V_GEN) "$(PYTHON)" $(srcdir)/libnm/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) EXTRA_DIST += $(libnm_noinst_data) @@ -4966,7 +4966,7 @@ man_nm_settings_xml = \ if HAVE_INTROSPECTION -man/nm-settings.xml: man/nm-settings.xsl libnm/nm-settings-docs.xml man/common.ent +man/nm-settings.xml: man/nm-settings.xsl libnm/nm-settings-docs-dbus.xml man/common.ent $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) man/nm-settings-%.xml: man/nm-settings-%.xsl libnm/nm-property-infos-%.xml man/common.ent diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am index 376cf613a0..5a79197c8f 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -7,7 +7,7 @@ GENERATED_FILES = if BUILD_DOCS -settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm/nm-settings-docs.xml +settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm/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 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/libnm/meson.build b/libnm/meson.build index b77a759640..1b8d128a43 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -288,24 +288,26 @@ if enable_introspection depends: libnm_gir, ) - nm_settings_docs_xml = { - 'gir': nm_settings_docs_xml_gir, - } - - name = 'nm-settings-docs.xml' - nm_settings_docs = custom_target( - name, - input: [nm_settings_docs_xml_gir, nm_property_infos_xml['dbus']], - output: name, + 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.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), '@OUTPUT@', - nm_property_infos_xml['dbus'], + nm_property_infos_xml[name], nm_settings_docs_xml_gir, ], depends: libnm_gir, ) + + nm_settings_docs_xml = { + 'gir': nm_settings_docs_xml_gir, + 'dbus': nm_settings_docs_xml_dbus, + } + endif if enable_tests diff --git a/man/meson.build b/man/meson.build index 24e6a6dc20..7d9de1ffe9 100644 --- a/man/meson.build +++ b/man/meson.build @@ -58,7 +58,7 @@ endforeach if enable_introspection mans = [ ['nm-settings-keyfile', '5', nm_property_infos_xml['keyfile']], - ['nm-settings', '5', nm_settings_docs], + ['nm-settings', '5', nm_settings_docs_xml['dbus']], ] if enable_ifcfg_rh From 47d39a7fb7fe035e85b4e85748451ce85bc40608 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 2 Jun 2020 19:24:12 +0200 Subject: [PATCH 07/16] docs: add more nm-settings manpages (dbus,nmcli,keyfile,ifcfg-rh) A significant part of NetworkManager's API are the connection profiles, documented in `man nm-settings*`. But there are different aspects about profiles, depending on what you are interested. There is the D-Bus API, nmcli options, keyfile format, and ifcfg-rh format. Additionally, there is also libnm API. Add distinct manual pages for the four aspects. Currently the two new manual pages "nm-settings-dbus" and "nm-settings-nmcli" are still identical to the former "nm-settings.5" manual. In the future, they will diverge to account for the differences. There are the following aspects: - "dbus" - "keyfile" - "ifcfg-rh" - "nmcli" For "libnm" we don't generate a separate "nm-settings-libnm" manual page. That is instead documented via gtk-doc. Currently the keyfile and ifcfg-rh manual pages only detail settings which differ. But later I think also these manual pages should contain all settings that apply. --- .gitignore | 6 +- Makefile.am | 40 +++-- configure.ac | 3 +- docs/api/Makefile.am | 3 +- docs/api/network-manager-docs.xml | 3 +- libnm/meson.build | 53 +++--- man/meson.build | 3 +- man/{nm-settings.xsl => nm-settings-dbus.xsl} | 10 +- man/nm-settings-nmcli.xsl | 165 ++++++++++++++++++ tools/meson-post-install.sh | 1 + 10 files changed, 242 insertions(+), 45 deletions(-) rename man/{nm-settings.xsl => nm-settings-dbus.xsl} (95%) create mode 100644 man/nm-settings-nmcli.xsl diff --git a/.gitignore b/.gitignore index ed39ed7e02..dec2a8ed46 100644 --- a/.gitignore +++ b/.gitignore @@ -150,8 +150,10 @@ test-*.trs /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-dbus.xml /libnm/nm-settings-docs-gir.xml +/libnm/nm-settings-docs-nmcli.xml /libnm/tests/test-libnm /libnm/tests/test-nm-client /libnm/tests/test-remote-settings-client @@ -192,9 +194,10 @@ test-*.trs /m4/xsize.m4 /man/*.[1785] -/man/nm-settings.xml +/man/nm-settings-dbus.xml /man/nm-settings-ifcfg-rh.xml /man/nm-settings-keyfile.xml +/man/nm-settings-nmcli.xml /man/common.ent /po/*.gmo @@ -298,6 +301,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 diff --git a/Makefile.am b/Makefile.am index dbdcd12318..031bd9f12c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1556,8 +1556,10 @@ libnm_noinst_data = \ 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-dbus.xml \ libnm/nm-settings-docs-gir.xml \ + libnm/nm-settings-docs-nmcli.xml \ $(NULL) noinst_DATA += $(libnm_noinst_data) @@ -4959,17 +4961,20 @@ 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-keyfile.xml \ + man/nm-settings-dbus.xml \ man/nm-settings-ifcfg-rh.xml \ + man/nm-settings-keyfile.xml \ + man/nm-settings-nmcli.xml \ $(NULL) if HAVE_INTROSPECTION -man/nm-settings.xml: man/nm-settings.xsl libnm/nm-settings-docs-dbus.xml man/common.ent +man/nm-settings-%.xml: man/nm-settings-%.xsl libnm/nm-settings-docs-%.xml man/common.ent $(AM_V_GEN) $(XSLTPROC) --output $@ $(xsltproc_flags) $< $(word 2,$^) -man/nm-settings-%.xml: man/nm-settings-%.xsl libnm/nm-property-infos-%.xml man/common.ent +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) @@ -4986,15 +4991,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 @@ -5003,6 +5003,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 @@ -5012,7 +5019,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 @@ -5021,7 +5029,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 @@ -5029,7 +5038,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/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 5a79197c8f..520bb3f14d 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -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) 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/libnm/meson.build b/libnm/meson.build index 1b8d128a43..b0d4e9f876 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -212,7 +212,7 @@ if enable_introspection install: true, ) - infos = [ 'dbus', 'keyfile' ] + infos = [ 'dbus', 'nmcli', 'keyfile' ] if enable_ifcfg_rh infos += [ 'ifcfg-rh' ] endif @@ -238,20 +238,24 @@ if enable_introspection 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, + '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, + 'dbus': nm_property_infos_xml_dbus, 'keyfile': nm_property_infos_xml_keyfile, + 'nmcli': nm_property_infos_xml_nmcli, } endif @@ -288,24 +292,33 @@ if enable_introspection depends: libnm_gir, ) - 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.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), - '@OUTPUT@', - nm_property_infos_xml[name], - nm_settings_docs_xml_gir, - ], - depends: libnm_gir, - ) + foreach name: ['dbus', 'nmcli'] + t = 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.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), + '@OUTPUT@', + nm_property_infos_xml[name], + nm_settings_docs_xml_gir, + ], + depends: libnm_gir, + ) + if name == 'dbus' + nm_settings_docs_xml_dbus = t + elif name == 'nmcli' + nm_settings_docs_xml_nmcli = t + else + assert(false) + endif + endforeach nm_settings_docs_xml = { - 'gir': nm_settings_docs_xml_gir, - 'dbus': nm_settings_docs_xml_dbus, + 'gir': nm_settings_docs_xml_gir, + 'dbus': nm_settings_docs_xml_dbus, + 'nmcli': nm_settings_docs_xml_nmcli, } endif diff --git a/man/meson.build b/man/meson.build index 7d9de1ffe9..8e1150833f 100644 --- a/man/meson.build +++ b/man/meson.build @@ -58,7 +58,8 @@ endforeach if enable_introspection mans = [ ['nm-settings-keyfile', '5', nm_property_infos_xml['keyfile']], - ['nm-settings', '5', nm_settings_docs_xml['dbus']], + ['nm-settings-dbus', '5', nm_settings_docs_xml['dbus']], + ['nm-settings-nmcli', '5', nm_settings_docs_xml['nmcli']], ] if enable_ifcfg_rh diff --git a/man/nm-settings.xsl b/man/nm-settings-dbus.xsl similarity index 95% rename from man/nm-settings.xsl rename to man/nm-settings-dbus.xsl index 57d5ce41cf..0573d0d3b8 100644 --- a/man/nm-settings.xsl +++ b/man/nm-settings-dbus.xsl @@ -13,20 +13,20 @@ /> - + - nm-settings + nm-settings-dbus NetworkManager developers - nm-settings + nm-settings-dbus 5 NetworkManager Configuration &NM_VERSION; - nm-settings + nm-settings-dbus Description of settings and properties of NetworkManager connection profiles @@ -155,7 +155,7 @@ - nm-settings.property.. + nm-settings-dbus.property.. (see for flag values) diff --git a/man/nm-settings-nmcli.xsl b/man/nm-settings-nmcli.xsl new file mode 100644 index 0000000000..28e7504931 --- /dev/null +++ b/man/nm-settings-nmcli.xsl @@ -0,0 +1,165 @@ + + +%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 + + + 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. The connection profiles are handled by + NetworkManager via settings service and are exported on D-Bus + (/org/freedesktop/NetworkManager/Settings/<num> objects). + The conceptual objects can be described as follows: + + + Connection (profile) + + + A specific, encapsulated, independent group of settings describing + all the configuration required to connect to a specific network. + It is referred to by a unique identifier called the UUID. A connection + is tied to a one specific device type, but not necessarily a specific + hardware device. It is composed of one or more Settings + objects. + + + + + + + Setting + + + A group of related key/value pairs describing a specific piece of a + Connection (profile). Settings keys and allowed values are + described in the tables below. Keys are also referred to as properties. + Developers can find the setting objects and their properties in the libnm-core + sources. Look for the *_class_init functions near the bottom + of each setting source file. + + + + + + + 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. NetworkManager provides a command-line tool nmcli + that allows direct configuration of the settings and properties according to a connection + profile type. 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 + 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/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 From 09f484ae9fec482f8db39771717acf0514b0274a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Jun 2020 16:41:43 +0200 Subject: [PATCH 08/16] docs: update documentation for nm-settings-nmcli manual --- man/nm-settings-dbus.xsl | 10 ++++-- man/nm-settings-nmcli.xsl | 74 ++++++++++++++------------------------- 2 files changed, 34 insertions(+), 50 deletions(-) diff --git a/man/nm-settings-dbus.xsl b/man/nm-settings-dbus.xsl index 0573d0d3b8..b4841ce200 100644 --- a/man/nm-settings-dbus.xsl +++ b/man/nm-settings-dbus.xsl @@ -27,7 +27,7 @@ nm-settings-dbus - Description of settings and properties of NetworkManager connection profiles + 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 + diff --git a/man/nm-settings-nmcli.xsl b/man/nm-settings-nmcli.xsl index 28e7504931..a1dd94b6e0 100644 --- a/man/nm-settings-nmcli.xsl +++ b/man/nm-settings-nmcli.xsl @@ -27,7 +27,7 @@ nm-settings-nmcli - Description of settings and properties of NetworkManager connection profiles + Description of settings and properties of NetworkManager connection profiles for nmcli Description @@ -37,51 +37,28 @@ 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. The connection profiles are handled by - NetworkManager via settings service and are exported on D-Bus - (/org/freedesktop/NetworkManager/Settings/<num> objects). - The conceptual objects can be described as follows: - - - Connection (profile) - - - A specific, encapsulated, independent group of settings describing - all the configuration required to connect to a specific network. - It is referred to by a unique identifier called the UUID. A connection - is tied to a one specific device type, but not necessarily a specific - hardware device. It is composed of one or more Settings - objects. - - - - - - - Setting - - - A group of related key/value pairs describing a specific piece of a - Connection (profile). Settings keys and allowed values are - described in the tables below. Keys are also referred to as properties. - Developers can find the setting objects and their properties in the libnm-core - sources. Look for the *_class_init functions near the bottom - of each setting source file. - - - - - - - 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. NetworkManager provides a command-line tool nmcli - that allows direct configuration of the settings and properties according to a connection - profile type. nmcli connection editor has also a built-in - describe command that can display description of particular settings - and properties of this page. - - + 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. @@ -122,7 +99,10 @@ See Also - NetworkManager8, + + nm-settings-dbus5, + nm-settings-keyfile5, + NetworkManager8, nmcli1, nmcli-examples7, NetworkManager.conf5 From 98f3d68cbea3367c00e5d5dc00fabd7ad024edf7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Jun 2020 17:22:00 +0200 Subject: [PATCH 09/16] docs: unify "nm-property-infos-*.xml" and "nm-settings-docs-*.xml" (root element) There is no need that two XML files that essentially hold similar information are fundamentally different. Make them more alike. This way, we can use the same tools that operate on either of these input files. --- libnm/generate-docs-nm-property-infos.pl | 8 ++------ libnm/generate-docs-nm-settings-docs-merge.py | 2 +- man/nm-settings-ifcfg-rh.xsl | 4 ++-- man/nm-settings-keyfile.xsl | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libnm/generate-docs-nm-property-infos.pl b/libnm/generate-docs-nm-property-infos.pl index 540ecb6e6c..bbdec3b632 100755 --- a/libnm/generate-docs-nm-property-infos.pl +++ b/libnm/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-docs-nm-settings-docs-merge.py b/libnm/generate-docs-nm-settings-docs-merge.py index 8aba67391a..64f899ff17 100755 --- a/libnm/generate-docs-nm-settings-docs-merge.py +++ b/libnm/generate-docs-nm-settings-docs-merge.py @@ -107,7 +107,7 @@ output_xml_file = sys.argv[1] xml_roots = list([ET.parse(f).getroot() for f in sys.argv[2:]]) -assert(all([root.tag.startswith('nm-') for root in xml_roots])) +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]) 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 From b760dee8c86ce0ab61ef3c1cda2cdb32e0519f85 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Jun 2020 17:20:40 +0200 Subject: [PATCH 10/16] all: move "shared/nm-keyfile" to "libnm-core/nm-keyfile" Originally, these files were part of libnm-core and linked together. However, that is a licensing violation, because the code is GPL-2.0+ licensed, while libnm-core also gets linked with libnm (it must thus be LGPL-2.1+). The original intent behind moving the code to "shared/" was to avoid the licensing issue, but also to prepare when we would add a separate, GPL licensed libnm-keyfile. However, currently we hope to be able to relicense the code, so that it actually could be exposed as part of libnm. This is work in progress at ([1]). [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/ ## 517 Anyway, the current directory layout is problematic. libnm-keyfile depends on libnm-core, while libnm-core depends on code under shared. That means, there is a circular dependency and meson's subdir() does not work well. Move the code. --- Makefile.am | 28 +++++++++---------- docs/libnm/Makefile.am | 14 ++++++---- docs/libnm/meson.build | 12 ++++---- libnm-core/meson.build | 5 +++- .../nm-keyfile/nm-keyfile-internal.h | 0 .../nm-keyfile/nm-keyfile-utils.c | 0 .../nm-keyfile/nm-keyfile-utils.h | 0 .../nm-keyfile/nm-keyfile.c | 0 po/POTFILES.in | 4 +-- shared/meson.build | 5 ---- 10 files changed, 36 insertions(+), 32 deletions(-) rename {shared => libnm-core}/nm-keyfile/nm-keyfile-internal.h (100%) rename {shared => libnm-core}/nm-keyfile/nm-keyfile-utils.c (100%) rename {shared => libnm-core}/nm-keyfile/nm-keyfile-utils.h (100%) rename {shared => libnm-core}/nm-keyfile/nm-keyfile.c (100%) diff --git a/Makefile.am b/Makefile.am index 031bd9f12c..47fe4d5a1c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -528,9 +528,9 @@ $(shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_OBJECTS): $(libnm_core_lib_h_ ############################################################################### -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,23 +543,23 @@ 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) ############################################################################### @@ -1221,7 +1221,7 @@ nodist_libnm_core_tests_test_general_SOURCES = \ libnm_core_tests_ldadd = \ shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ - shared/nm-keyfile/libnm-keyfile.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 \ @@ -2305,7 +2305,7 @@ 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-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ @@ -2396,7 +2396,7 @@ 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-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ @@ -2445,7 +2445,7 @@ 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-keyfile/libnm-keyfile.la \ libnm-core/libnm-core.la \ $(libnm_crypto_lib) \ shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index ce82d7eb94..7d16b8ca65 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,13 @@ 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 + \ + $(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..92dce23d0c 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,11 @@ 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', ] scan_args = [ diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 955e17766b..37fc514e4c 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -236,7 +236,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/po/POTFILES.in b/po/POTFILES.in index 93df2fa2a5..b248eac726 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -56,6 +56,8 @@ 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-setting-6lowpan.c libnm-core/nm-setting-8021x.c libnm-core/nm-setting-adsl.c @@ -140,8 +142,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 diff --git a/shared/meson.build b/shared/meson.build index 9a8768f539..81975685a3 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -113,11 +113,6 @@ 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') From e17a067e684d070c438febcc3e5c756eb984e821 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Jun 2020 18:06:15 +0200 Subject: [PATCH 11/16] all: move "shared/nm-libnm-core-intern" to "libnm-core/nm-libnm-core-intern" The "shared" directory is used by libnm-core, it should thus only depend on code that is in the "shared" directory. Otherwise there is a circular dependency, and meson's subdir() does not work nicely. Also, libnm-core is really part of (and also an extension of) libnm-core, so it belongs there. I guess, the original idea was that this is also an extension for libnm, so another project could take these utility functions (by copying them into their source tree) and use them. That is still possible, it's just that the sources are no longer under the shared directory. Also add a readme to explain the non-obvious meaning of these files. --- Makefile.am | 46 ++++++++++--------- docs/libnm/Makefile.am | 5 ++ docs/libnm/meson.build | 5 ++ libnm-core/meson.build | 6 ++- libnm-core/nm-libnm-core-intern/README.md | 20 ++++++++ .../nm-libnm-core-intern/nm-auth-subject.c | 0 .../nm-libnm-core-intern/nm-auth-subject.h | 0 .../nm-libnm-core-intern/nm-common-macros.h | 0 .../nm-libnm-core-intern/nm-ethtool-utils.c | 0 .../nm-libnm-core-intern/nm-ethtool-utils.h | 0 .../nm-libnm-core-utils.c | 0 .../nm-libnm-core-utils.h | 0 shared/meson.build | 6 --- 13 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 libnm-core/nm-libnm-core-intern/README.md rename {shared => libnm-core}/nm-libnm-core-intern/nm-auth-subject.c (100%) rename {shared => libnm-core}/nm-libnm-core-intern/nm-auth-subject.h (100%) rename {shared => libnm-core}/nm-libnm-core-intern/nm-common-macros.h (100%) rename {shared => libnm-core}/nm-libnm-core-intern/nm-ethtool-utils.c (100%) rename {shared => libnm-core}/nm-libnm-core-intern/nm-ethtool-utils.h (100%) rename {shared => libnm-core}/nm-libnm-core-intern/nm-libnm-core-utils.c (100%) rename {shared => libnm-core}/nm-libnm-core-intern/nm-libnm-core-utils.h (100%) diff --git a/Makefile.am b/Makefile.am index 47fe4d5a1c..caa02d9a93 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,26 +471,28 @@ 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 ############################################################################### @@ -1224,7 +1226,7 @@ libnm_core_tests_ldadd = \ 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 \ @@ -1452,7 +1454,7 @@ libnm_liblibnm_la_LIBADD = \ shared/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 \ @@ -2308,7 +2310,7 @@ src_libNetworkManager_la_LIBADD = \ 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 \ @@ -2399,7 +2401,7 @@ src_nm_iface_helper_LDADD = \ 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 \ @@ -2448,7 +2450,7 @@ src_initrd_nm_initrd_generator_LDADD = \ 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 \ @@ -4433,7 +4435,7 @@ 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-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 \ @@ -4524,7 +4526,7 @@ 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-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 \ @@ -4725,7 +4727,7 @@ clients_tui_nmtui_LDADD = \ 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-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 \ @@ -4792,7 +4794,7 @@ clients_cloud_setup_nm_cloud_setup_LDFLAGS = \ 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-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 \ diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index 7d16b8ca65..f02c2de4f1 100644 --- a/docs/libnm/Makefile.am +++ b/docs/libnm/Makefile.am @@ -58,6 +58,11 @@ IGNORE_HFILES= \ nm-keyfile-internal.h \ nm-keyfile-utils.h \ \ + nm-auth-subject.h \ + nm-common-macros.h \ + nm-ethtool-utils.h \ + nm-libnm-core-utils.h \ + \ $(NULL) # Images to copy into HTML directory. diff --git a/docs/libnm/meson.build b/docs/libnm/meson.build index 92dce23d0c..460e3e224d 100644 --- a/docs/libnm/meson.build +++ b/docs/libnm/meson.build @@ -30,6 +30,11 @@ private_headers = [ 'nm-keyfile-internal.h', 'nm-keyfile-utils.h', + + 'nm-auth-subject.h', + 'nm-common-macros.h', + 'nm-ethtool-utils.h', + 'nm-libnm-core-utils.h', ] scan_args = [ diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 37fc514e4c..a5914519fb 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, ) 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..284a82ed5f --- /dev/null +++ b/libnm-core/nm-libnm-core-intern/README.md @@ -0,0 +1,20 @@ +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. + +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/shared/meson.build b/shared/meson.build index 81975685a3..7399e55118 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -107,12 +107,8 @@ 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_libnm_aux_source = files('nm-libnm-aux/nm-libnm-aux.c') nm_meta_setting_source = files('nm-meta-setting.c') @@ -121,8 +117,6 @@ 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', From a9408e34974b62e60b5e71fb975e09b7c5c82b7d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Jun 2020 18:06:15 +0200 Subject: [PATCH 12/16] all: move "shared/nm-libnm-core-aux" to "libnm-core/nm-libnm-core-aux" Like the previous commit. Move code that depends on libnm-core out of shared to avoid circular dependency. Also add a readme file explaining the reason for existence of the helper libraries nm-libnm-core-intern and nm-libnm-core-aux. --- Makefile.am | 40 ++++++++++--------- docs/libnm/Makefile.am | 3 ++ docs/libnm/meson.build | 3 ++ libnm-core/meson.build | 4 +- libnm-core/nm-libnm-core-aux/README.md | 21 ++++++++++ .../nm-libnm-core-aux/nm-dispatcher-api.h | 0 .../nm-libnm-core-aux/nm-libnm-core-aux.c | 0 .../nm-libnm-core-aux/nm-libnm-core-aux.h | 0 libnm-core/nm-libnm-core-intern/README.md | 3 +- po/POTFILES.in | 2 +- shared/meson.build | 2 - 11 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 libnm-core/nm-libnm-core-aux/README.md rename {shared => libnm-core}/nm-libnm-core-aux/nm-dispatcher-api.h (100%) rename {shared => libnm-core}/nm-libnm-core-aux/nm-libnm-core-aux.c (100%) rename {shared => libnm-core}/nm-libnm-core-aux/nm-libnm-core-aux.h (100%) diff --git a/Makefile.am b/Makefile.am index caa02d9a93..2f7dca7f31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -496,9 +496,9 @@ 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 \ @@ -511,22 +511,24 @@ 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 ############################################################################### @@ -1222,7 +1224,7 @@ nodist_libnm_core_tests_test_general_SOURCES = \ $(NULL) libnm_core_tests_ldadd = \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.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) \ @@ -1451,7 +1453,7 @@ 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) \ libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ @@ -2306,7 +2308,7 @@ src_libNetworkManager_la_SOURCES = \ src_libNetworkManager_la_LIBADD = \ src/libNetworkManagerBase.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.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) \ @@ -2397,7 +2399,7 @@ src_nm_iface_helper_SOURCES = \ src_nm_iface_helper_LDADD = \ src/libNetworkManagerBase.la \ - shared/nm-libnm-core-aux/libnm-libnm-core-aux.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) \ @@ -2446,7 +2448,7 @@ 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 \ + 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) \ @@ -4434,7 +4436,7 @@ 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 \ + 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 \ @@ -4478,7 +4480,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 \ @@ -4525,7 +4527,7 @@ 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 \ + 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 \ @@ -4726,7 +4728,7 @@ clients_tui_nmtui_LDADD = \ 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 \ + 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 \ @@ -4793,7 +4795,7 @@ clients_cloud_setup_nm_cloud_setup_LDFLAGS = \ 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 \ + 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 \ diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index f02c2de4f1..e1a019b313 100644 --- a/docs/libnm/Makefile.am +++ b/docs/libnm/Makefile.am @@ -63,6 +63,9 @@ IGNORE_HFILES= \ nm-ethtool-utils.h \ nm-libnm-core-utils.h \ \ + nm-dispatcher-api.h \ + nm-libnm-core-aux.h \ + \ $(NULL) # Images to copy into HTML directory. diff --git a/docs/libnm/meson.build b/docs/libnm/meson.build index 460e3e224d..275522db2a 100644 --- a/docs/libnm/meson.build +++ b/docs/libnm/meson.build @@ -35,6 +35,9 @@ private_headers = [ '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 a5914519fb..89acaf72ad 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -225,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, 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 index 284a82ed5f..2dcc3c80cd 100644 --- a/libnm-core/nm-libnm-core-intern/README.md +++ b/libnm-core/nm-libnm-core-intern/README.md @@ -13,7 +13,8 @@ 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. + - 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 diff --git a/po/POTFILES.in b/po/POTFILES.in index b248eac726..25cb5c4a6c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -58,6 +58,7 @@ 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 @@ -142,7 +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-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 7399e55118..32a0b23c3c 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -107,8 +107,6 @@ nm_version_macro_header = configure_file( configuration: data_conf, ) -nm_libnm_core_aux_source = files('nm-libnm-core-aux/nm-libnm-core-aux.c') - nm_libnm_aux_source = files('nm-libnm-aux/nm-libnm-aux.c') nm_meta_setting_source = files('nm-meta-setting.c') From caa70a50d747a21d95e4b74c4e0472a153767466 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Jun 2020 18:06:15 +0200 Subject: [PATCH 13/16] all: move "shared/nm-libnm-aux" to "libnm/nm-libnm-aux" Like the previous commit. Move code that depends on libnm out of shared to avoid circular dependency. Also add a readme file explaining the reason for existence of the helper library. --- Makefile.am | 28 ++++++++++--------- docs/libnm/Makefile.am | 2 ++ libnm/meson.build | 4 ++- libnm/nm-libnm-aux/README.md | 15 ++++++++++ {shared => libnm}/nm-libnm-aux/nm-libnm-aux.c | 0 {shared => libnm}/nm-libnm-aux/nm-libnm-aux.h | 0 shared/meson.build | 2 -- 7 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 libnm/nm-libnm-aux/README.md rename {shared => libnm}/nm-libnm-aux/nm-libnm-aux.c (100%) rename {shared => libnm}/nm-libnm-aux/nm-libnm-aux.h (100%) diff --git a/Makefile.am b/Makefile.am index 2f7dca7f31..13f41fbfe5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -567,9 +567,9 @@ $(libnm_core_nm_keyfile_libnm_keyfile_la_OBJECTS): $(libnm_core_lib_h_pub_mkenum ############################################################################### -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 \ @@ -584,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 ############################################################################### @@ -4306,7 +4308,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 \ @@ -4532,7 +4534,7 @@ clients_cli_nmcli_LDADD = \ 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) @@ -4727,7 +4729,7 @@ 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 \ + 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 \ @@ -4794,7 +4796,7 @@ clients_cloud_setup_nm_cloud_setup_LDFLAGS = \ $(NULL) clients_cloud_setup_nm_cloud_setup_LDADD = \ - shared/nm-libnm-aux/libnm-libnm-aux.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 \ diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index e1a019b313..6f04cd1e4d 100644 --- a/docs/libnm/Makefile.am +++ b/docs/libnm/Makefile.am @@ -66,6 +66,8 @@ IGNORE_HFILES= \ nm-dispatcher-api.h \ nm-libnm-core-aux.h \ \ + nm-libnm-aux.h \ + \ $(NULL) # Images to copy into HTML directory. diff --git a/libnm/meson.build b/libnm/meson.build index b0d4e9f876..3cb20b4e3a 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -329,7 +329,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/shared/meson.build b/shared/meson.build index 32a0b23c3c..48880ec4f6 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -107,8 +107,6 @@ nm_version_macro_header = configure_file( configuration: data_conf, ) -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') From d2f8d5a4fa7983da0bda4d15e6218aeb895cac89 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Jun 2020 18:53:47 +0200 Subject: [PATCH 14/16] docs: move "nm-settings-docs-{dbus,nmcli}.xml" from "libnm/" to "man/" "nm-settings-docs-nmcli.xml" will be generated by a tool that depends on "clients/common/". The file should thus not be in libnm directory, otherwise there is a circular dependency. Move the file to "man/" directory. For consistency, also move "nm-settings-docs-dbus.xml". Note that we cannot move "nm-settings-docs-gir.xml" to "man/", because that one is needed for building clients. --- .gitignore | 4 ++-- Makefile.am | 8 ++++---- clients/common/meson.build | 2 +- docs/api/Makefile.am | 2 +- libnm/meson.build | 29 ----------------------------- man/meson.build | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index dec2a8ed46..704afc3094 100644 --- a/.gitignore +++ b/.gitignore @@ -151,9 +151,7 @@ test-*.trs /libnm/nm-property-infos-ifcfg-rh.xml /libnm/nm-property-infos-keyfile.xml /libnm/nm-property-infos-nmcli.xml -/libnm/nm-settings-docs-dbus.xml /libnm/nm-settings-docs-gir.xml -/libnm/nm-settings-docs-nmcli.xml /libnm/tests/test-libnm /libnm/tests/test-nm-client /libnm/tests/test-remote-settings-client @@ -195,6 +193,8 @@ test-*.trs /man/*.[1785] /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 diff --git a/Makefile.am b/Makefile.am index 13f41fbfe5..006869f928 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1563,9 +1563,9 @@ libnm_noinst_data = \ libnm/nm-property-infos-ifcfg-rh.xml \ libnm/nm-property-infos-keyfile.xml \ libnm/nm-property-infos-nmcli.xml \ - libnm/nm-settings-docs-dbus.xml \ libnm/nm-settings-docs-gir.xml \ - libnm/nm-settings-docs-nmcli.xml \ + man/nm-settings-docs-dbus.xml \ + man/nm-settings-docs-nmcli.xml \ $(NULL) noinst_DATA += $(libnm_noinst_data) @@ -1585,7 +1585,7 @@ libnm/nm-settings-docs-gir.xml: libnm/generate-docs-nm-settings-docs-gir.py libn --gir $(builddir)/libnm/NM-1.0.gir \ --output $@ -libnm/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml libnm/generate-docs-nm-settings-docs-merge.py +man/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml libnm/generate-docs-nm-settings-docs-merge.py $(AM_V_GEN) "$(PYTHON)" $(srcdir)/libnm/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) EXTRA_DIST += $(libnm_noinst_data) @@ -4975,7 +4975,7 @@ man_nm_settings_xml = \ if HAVE_INTROSPECTION -man/nm-settings-%.xml: man/nm-settings-%.xsl libnm/nm-settings-docs-%.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-settings-keyfile.xml: man/nm-settings-keyfile.xsl libnm/nm-property-infos-keyfile.xml man/common.ent diff --git a/clients/common/meson.build b/clients/common/meson.build index 95cf04d078..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_settings_docs_xml['gir'], + 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/docs/api/Makefile.am b/docs/api/Makefile.am index 520bb3f14d..dfa3210c68 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -7,7 +7,7 @@ GENERATED_FILES = if BUILD_DOCS -settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm/nm-settings-docs-dbus.xml +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 diff --git a/libnm/meson.build b/libnm/meson.build index 3cb20b4e3a..aab946ece6 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -292,35 +292,6 @@ if enable_introspection depends: libnm_gir, ) - foreach name: ['dbus', 'nmcli'] - t = 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.current_source_dir(), 'generate-docs-nm-settings-docs-merge.py'), - '@OUTPUT@', - nm_property_infos_xml[name], - nm_settings_docs_xml_gir, - ], - depends: libnm_gir, - ) - if name == 'dbus' - nm_settings_docs_xml_dbus = t - elif name == 'nmcli' - nm_settings_docs_xml_nmcli = t - else - assert(false) - endif - endforeach - - nm_settings_docs_xml = { - 'gir': nm_settings_docs_xml_gir, - 'dbus': nm_settings_docs_xml_dbus, - 'nmcli': nm_settings_docs_xml_nmcli, - } - endif if enable_tests diff --git a/man/meson.build b/man/meson.build index 8e1150833f..c2fc150792 100644 --- a/man/meson.build +++ b/man/meson.build @@ -56,6 +56,43 @@ 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(), 'libnm', 'generate-docs-nm-settings-docs-merge.py'), + '@OUTPUT@', + nm_property_infos_xml[name], + nm_settings_docs_xml_gir, + ], + depends: libnm_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(), 'libnm', 'generate-docs-nm-settings-docs-merge.py'), + '@OUTPUT@', + nm_property_infos_xml[name], + nm_settings_docs_xml_gir, + ], + depends: libnm_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_property_infos_xml['keyfile']], ['nm-settings-dbus', '5', nm_settings_docs_xml['dbus']], From 87edf2f2986370768c4dba2c9c64aa842579ca3a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Jun 2020 23:22:34 +0200 Subject: [PATCH 15/16] docs: move generate-docs scripts from "libnm/" to "tools/" They are not only used in "libnm/" directory. Move to "tools/". --- Makefile.am | 18 +++++++++--------- libnm/meson.build | 4 ++-- man/meson.build | 4 ++-- .../generate-docs-nm-property-infos.pl | 0 .../generate-docs-nm-settings-docs-gir.py | 0 .../generate-docs-nm-settings-docs-merge.py | 0 6 files changed, 13 insertions(+), 13 deletions(-) rename {libnm => tools}/generate-docs-nm-property-infos.pl (100%) rename {libnm => tools}/generate-docs-nm-settings-docs-gir.py (100%) rename {libnm => tools}/generate-docs-nm-settings-docs-merge.py (100%) diff --git a/Makefile.am b/Makefile.am index 006869f928..ac40aee84a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1572,21 +1572,21 @@ noinst_DATA += $(libnm_noinst_data) libnm_docs_sources = $(libnm_core_lib_c_settings_real) -libnm/nm-property-infos-%.xml: libnm/generate-docs-nm-property-infos.pl $(libnm_docs_sources) - $(AM_V_GEN) $(srcdir)/libnm/generate-docs-nm-property-infos.pl $(patsubst nm-property-infos-%.xml,%,$(notdir $@)) $@ $(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 $<,$^) -libnm/nm-settings-docs-gir.xml: libnm/generate-docs-nm-settings-docs-gir.py libnm/NM-1.0.gir libnm/NM-1.0.typelib libnm/libnm.la $(libnm_docs_sources) +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-docs-nm-settings-docs-gir.py \ + $(srcdir)/tools/generate-docs-nm-settings-docs-gir.py \ --gir $(builddir)/libnm/NM-1.0.gir \ --output $@ -man/nm-settings-docs-%.xml: libnm/nm-property-infos-%.xml libnm/nm-settings-docs-gir.xml libnm/generate-docs-nm-settings-docs-merge.py - $(AM_V_GEN) "$(PYTHON)" $(srcdir)/libnm/generate-docs-nm-settings-docs-merge.py $@ $(wordlist 1,2,$^) +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) @@ -1594,9 +1594,9 @@ DISTCLEANFILES += $(libnm_noinst_data) endif EXTRA_DIST += \ - libnm/generate-docs-nm-property-infos.pl \ - libnm/generate-docs-nm-settings-docs-merge.py \ - libnm/generate-docs-nm-settings-docs-gir.py \ + 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 \ diff --git a/libnm/meson.build b/libnm/meson.build index aab946ece6..d3991ab19c 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -223,7 +223,7 @@ if enable_introspection output: 'nm-propery-infos-' + info + '.xml', command: [ perl, - join_paths(meson.current_source_dir(), 'generate-docs-nm-property-infos.pl'), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-property-infos.pl'), info, '@OUTPUT@', '@INPUT@' @@ -284,7 +284,7 @@ if enable_introspection command: [ generate_setting_docs_env, python.path(), - join_paths(meson.current_source_dir(), 'generate-docs-nm-settings-docs-gir.py'), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-gir.py'), '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--output', '@OUTPUT@' diff --git a/man/meson.build b/man/meson.build index c2fc150792..5e76a9f1be 100644 --- a/man/meson.build +++ b/man/meson.build @@ -64,7 +64,7 @@ if enable_introspection output: 'nm-settings-docs-' + name + '.xml', command: [ python.path(), - join_paths(meson.source_root(), 'libnm', 'generate-docs-nm-settings-docs-merge.py'), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py'), '@OUTPUT@', nm_property_infos_xml[name], nm_settings_docs_xml_gir, @@ -79,7 +79,7 @@ if enable_introspection output: 'nm-settings-docs-' + name + '.xml', command: [ python.path(), - join_paths(meson.source_root(), 'libnm', 'generate-docs-nm-settings-docs-merge.py'), + join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py'), '@OUTPUT@', nm_property_infos_xml[name], nm_settings_docs_xml_gir, diff --git a/libnm/generate-docs-nm-property-infos.pl b/tools/generate-docs-nm-property-infos.pl similarity index 100% rename from libnm/generate-docs-nm-property-infos.pl rename to tools/generate-docs-nm-property-infos.pl diff --git a/libnm/generate-docs-nm-settings-docs-gir.py b/tools/generate-docs-nm-settings-docs-gir.py similarity index 100% rename from libnm/generate-docs-nm-settings-docs-gir.py rename to tools/generate-docs-nm-settings-docs-gir.py diff --git a/libnm/generate-docs-nm-settings-docs-merge.py b/tools/generate-docs-nm-settings-docs-merge.py similarity index 100% rename from libnm/generate-docs-nm-settings-docs-merge.py rename to tools/generate-docs-nm-settings-docs-merge.py From 10020a94662ddee18fd9cb80c08ce5d071b31ce7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Jun 2020 16:53:40 +0200 Subject: [PATCH 16/16] docs: generate nm-settings-docs-nmcli.xml based on nmcli meta data We have the correct meta-data of supported properties for nmcli. It is in clients/common. Use that for generating the manual page instead of the properties that are part of libnm (some properties may be in libnm but not supported by nmcli, or some properties may not be GObject properties, and not detected as by GObject introspection). --- .gitignore | 3 + Makefile.am | 44 ++++++++++++++ clients/cli/generate-docs-nm-settings-nmcli.c | 57 +++++++++++++++++++ clients/cli/meson.build | 44 ++++++++++---- clients/meson.build | 5 +- man/meson.build | 3 +- 6 files changed, 139 insertions(+), 17 deletions(-) create mode 100644 clients/cli/generate-docs-nm-settings-nmcli.c diff --git a/.gitignore b/.gitignore index 704afc3094..5cb43a0374 100644 --- a/.gitignore +++ b/.gitignore @@ -157,6 +157,9 @@ test-*.trs /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 diff --git a/Makefile.am b/Makefile.am index ac40aee84a..d47df9624e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1559,6 +1559,7 @@ libnm/libnm.typelib: libnm/libnm.gir INTROSPECTION_GIRS += libnm/NM-1.0.gir libnm_noinst_data = \ + 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 \ @@ -1570,6 +1571,9 @@ libnm_noinst_data = \ 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-property-infos-%.xml: tools/generate-docs-nm-property-infos.pl $(libnm_docs_sources) @@ -1585,6 +1589,9 @@ libnm/nm-settings-docs-gir.xml: tools/generate-docs-nm-settings-docs-gir.py libn --gir $(builddir)/libnm/NM-1.0.gir \ --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,$^) + 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,$^) @@ -4559,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 \ 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/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/man/meson.build b/man/meson.build index 5e76a9f1be..0be202bae1 100644 --- a/man/meson.build +++ b/man/meson.build @@ -69,7 +69,6 @@ if enable_introspection nm_property_infos_xml[name], nm_settings_docs_xml_gir, ], - depends: libnm_gir, ) name = 'nmcli' @@ -81,10 +80,10 @@ if enable_introspection 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, ], - depends: libnm_gir, ) nm_settings_docs_xml = {