nmcli has documentation strings embedded. Those strings are extracted
from gtk-doc comments, using pygobject and put in the generated file
"clients/common/settings-docs.c".
This file "clients/common/settings-docs.c" is disted, so from
a source tarball you can build nmcli without enabling introspection.
However, when building from a git-tree, the file is missing and
thus one cannot build --with-nmcli unless also using at least
--enable-introspection to generate "clients/common/settings-docs.c".
That is inconvenient. Especially during cross-compilation, where
one also needs python and pygobject in the foreign architecture (because
the generation of "settings-docs.c" loads the built libnm.so via
pygobject). It is bad because nmcli is an essential part of
NetworkManager, so building --without-nmcli is not a great option.
Previously, the only alternative was to pre-generate a source tarball
on a separate machine and build that. This however complicates efforts
to automatically build git snapshots of NetworkManager.
Fix that by commiting "clients/common/settings-docs.c.in" to git.
When building with --disable-introspection, the pre-generated
file is used instead. This is fine, because the file only depends
on static, checked-in documentation strings that seldomly change.
Also add a check target to notice when the pre-generated file differs
from what we are about to generate during --enable-introspection.
That happens when editing one of the gtk-doc entires. In this case,
`make check` will notify that the pre-generated "settings-docs.c.in"
file needs updating too.
Yes, when changing gtk-doc comments you need to updte the file manually.
At least, the check failure notifies you.
"nm-meta-setting-desc.h" contains static type description, vtable and (internal)
accessor functions. Add accessor functions that operate on top of the type description
to "nm-meta-setting-access.h".
libnm contains the public function nm_utils_enum_from_str() et al.
The function is not flexible enough for nmcli's usecase. So, I would
need another public function like nm_utils_enum_from_str_full() that
has an extended API.
That was already required previously for ifcfg-rh writer, but in that
case I could just add it as internal API as libnm-core is linked statically
with NetworkManager.
I don't want to commit to a public API for an utility function. So move
the code instead to the shared directory, so that nmcli may link
statically against it and use the internal API.
These functions are only used by nm-meta-setting-desc.c. Make them internal.
Unfortunately, they are part of "common.h" which cannot be used without
the rest of nmcli. Still todo.
This part contains static functions and variables to describe
settings. It is distinct from the mechanism to use them, or
access them.
Split it out.
It still uses clients/cli/common.h and clients/cli/utils.h
which shall be fixed next.
This moves tracking of connectivity to NMDevice and makes the NMManager
negotiate the best of known connectivity states of devices. The NMConnectivity
singleton handles its own configuration and scheduling of the permission
checks, but otherwise greatly simplifies it.
This will be useful to determine correct metrics for multiple default routes
depending on actual internet connectivity.
The per-device connection checks is not yet exposed on the D-Bus, since they
probably should be per-address-family as well.
Works by dumb luck for in-tree build, because the .deps files that are
meant for the distribution happen to be the builddir. The out-of-tree
builds would generate an empty file.
We also dist libnm/nm-property-docs.xml, so depending on
whether we build from git or source tarball, the file
is in $(srcdir) or $(builddir).
Fixes: d7ad13591b
There are very few places where we actually use floating point
or #include <math.h>.
Drop that library, although we very likely still get it as indirect
dependency (e.g. on my system it is still dragged in by libsystemd.so,
libudev.so and libnl-3.so).
One day, I wish we would have more setting metadata in shared via
"shared/nm-setting-metadata.h", ready for nmcli and nmtui to use
(by statically linking against the internal API).
Anyway, it is still unused, so drop the files from the SOURCES of
nmcli.
"$(srcdir)/clients/cli/settings.c" includes "$(builddir)/clients/cli/settings-docs.c",
hence, we need "-I$(builddir)/clients/cli".
This basically reverts commit bbce089840,
but adds dependencies so that the build directory exists.
The sources should reach files in the $builddir using #include "".
Besides, it is not guarranteed to be around:
CC shared/clients_cli_nmcli-nm-setting-metadata.o
cc1: error: ./clients/cli: No such file or directory [-Werror=missing-include-dirs]
cc1: all warnings being treated as errors
Makefile:12971: recipe for target 'shared/clients_cli_nmcli-nm-setting-metadata.o' failed
It's not sufficient to make nm-core-enum-types.[ch] depend on the
dirstamp, because they also depend on their own stamps that are to be
placed in libnm-core.
$ make libnm-core/nm-core-enum-types.h.stamp
GEN libnm-core/nm-core-enum-types.h
/bin/sh: libnm-core/nm-core-enum-types.h.tmp: No such file or directory
../../Makefile.glib:107: recipe for target 'libnm-core/nm-core-enum-types.h.stamp' failed
make: *** [libnm-core/nm-core-enum-types.h.stamp] Error 1
We use output redirection in numerous places; leaving the half-built
artifacts in place would cause the subsequent builds to succeed when it
should not.
The only reliable way of setting a MAC address for the team is through
the "hwaddr" property in the configuration passed to teamd. In order
to rewrite the configuration we need Jansson support; since it is
already a requirement for teamd, let the team plugin depend on it.
If configure is called without --enable-json-validation or
--disable-json-validation, let's automatically choose a value
depending on the availability of the library.
Add support for creating dummy devices. This commit adds a D-Bus
interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used
primarily for determining the device type but does not carry any
properties.
Since we generate "libnm-core/nm-core-enum-types.h" via GLIB_GENERAED,
there is no obvious place to $(MKDIR_P). Add a dependency to the
.dirstamp of the directory to instruct automake to create the directory.
"shared/nm-setting-metadata.h" will contain data structures
to handle NM setting properties in a generic way.
For now, this is internal API, but shared between libnm-core (which
extends to libnm, NetworkManager, device-plugins, settings-plugins),
and nmcli.
Related: https://bugzilla.gnome.org/show_bug.cgi?id=732292
Otherwise, substitions are not properly expanded.
For example
- "AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state directory])"
gives ${runstatedir}/NetworkManager/resolv.conf
- "AC_SUBST(nmrundir, "${runstatedir}/$PACKAGE", [NetworkManager runtime state directory])"
gives ${prefix}/var/run/NetworkManager/resolv.conf
Building the man pages via xsltproc requires "docbook.xsl"
which is part of docbook.
Previously, we would build the man pages solely based on
"--enable-introspection", which checks for the presence of
xsltproc, but not docbook. This can lead to build failure
when docbook is not available, but "--enable-introspection"
is given.
Instead of adding yet another configure option to fine-tune
and say "--with-docbook --disable-gtk-doc", just simplify it.
Now, documentation (both man pages and setting docs) will be generated
with "--enable-gtk-doc" and "--enable-introspection".
If the documentation is not about to be generated, pre-generated docs
will be installed if they are available. That is commonly the case
with a source tarball, but not with a git checkout.
Finally, if documentation is nither generated nor pre-generated,
no documentation will be installed *duh*.
This removes the possibility to treat man pages separate from settings
docs. Now you either generate both, install both pre-generated, or don't
get any of them.
https://bugzilla.gnome.org/show_bug.cgi?id=778551
`nm` is used by "tools/create-exports-NetworkManager.sh" script.
Alloc configuring an explicit path during configure.
BINUTILS_NM=/usr/bin/nm ./configure
The new NMSettingMacsec contains information necessary to establish a
MACsec connection. At the moment we support two different MACsec
modes, both using wpa_supplicant: PSK and EAP.
PSK mode is based on a static CAK key for the MACsec key agreement
protocol, while EAP mode derives keys from a 802.1x authentication and
thus requires the presence of a NMSetting8021x in the connection.
Generating "src/NetworkManager.ver" each time seems to work well.
Thus, src/NetworkManager.ver-orig is unused an gets easily out
of date. Just remove it. It's not useful anymore.
As build-requirement, we either require
- python2 with python-gobject-base
- python3 with python3-gobject-base
Previously, we would require that a plain `python` gives the desired
interpreter version.
If somebody's "/usr/bin/env python" however points to a different
python version, there was no easy way to change it -- aside
resetting the $PATH variable to some desired "python" binary.
Now, you can specify it during configure:
./configure PYTHON=python3 ...
This especially matters, if you only have python3-gobject-base
installed, you /usr/bin/python is a symlink to python2.
https://bugzilla.gnome.org/show_bug.cgi?id=775768
Extend the D-Bus API and introduce a new NMDnsManager interface that
contains all the information related to DNS configuration.
At the moment the new DnsManager object only contains basic properties
describing the current DNS mode and resolv.conf manager.
Moving the PPP manager to a separate plugin that is loaded when needed
has the advantage of slightly reducing memory footprint and makes it
possible to install the PPP support only where needed.
https://bugzilla.gnome.org/show_bug.cgi?id=773482
- `make dist` requires --enable-gtk-doc --enable-introspection --with-libnm-glib
- --enable-gtk-doc requires --enable-introspection
- --with-nmcli requires either --enable-introspection or pregenerated
settings-docs.c files from the dist tarball. It does not require
--enable-gtk-doc.
There is a bit of a problem in that --enable-introspection requires
now xsltproc. However, gobject-introspection does itself not depend
on xsltproc. So, more correct might be a special --enable-doc argument,
that combines --enable-introspection --with-xsltproc. Anyway, that
seems to make it more complicated then it already is so just implicitly
(and surprisingly?) require xsltproc with --enable-introspection.
https://bugzilla.gnome.org/show_bug.cgi?id=775003
Need to pass --path to xsltproc to find common.ent in the
build-directory.
$ git clean -fdx && NMTST_MAKE='V=1 -d' ./tools/test-build.sh man/nm-settings-ifcfg-rh.xml
When building "libnm/nm-settings-docs.xml", we require
"nm-settings-docs-overrides.xml". As we dist the overrides files,
we must consult VPATH to locate the proper version of the file.
BUILT_SOURCES only matters during `make all`, `make check`
and `make install`.
It would be nice to be able to build every target specifically
from an empty git-tree.
Drop the use of BUILT_SOURCES where we already have the explicit
dependencies declared.
This makes it easier to install the files with proper names.
Also, it makes the makefile rules slightly simpler.
Lastly, the documentation is now generated into docs/api, which makes it
possible to get rid of the awkward relative file names in docbook.
Instead of relying on BUILT_SOURCES.
$ git clean -fdx && NOCONFIGURE=x ./autogen.sh && ./configure --enable-gtk-doc && make clients/cli/nmcli
Also, add the file to DISTCLEANFILES.
- Use -I$() instead of -I${}
- omit "top_" for -I$(srcdir)
- remove quoting for include paths
We don't quote other places either. You just cannot
build NetworkManager in a path that contain invalid
characters.
- remove trailing slash from include paths
- fix indention with spaces in Makefile.am
Keep the include paths clean and separate. We use directories to group source
files together. That makes sense (I guess), but then we should use this
grouping also when including files. Thus require to #include files with their
path relative to "src/".
Also, we build various artifacts from the "src/" tree. Instead of having
individual CFLAGS for each artifact in Makefile.am, the CFLAGS should be
unified. Previously, the CFLAGS for each artifact differ and are inconsistent
in which paths they add to the search path. Fix the inconsistency by just
don't add the paths at all.
We have generated headers, and non-generated.
We have public headers and internal headers.
We have headers/sources for libnm-glib and libnm-glib-vpn.
We want that non-generated files depend on generated files.
Thus, reorder it all and assign the groups to different variables.
Source files like libnm/nm-client.c include introspection files like
nmdbus-manager.h. These files are part of BUILT_SOURCES, which is
a pre-requisite to "all" target.
However, that is not sufficient for
./autogen --enable-gtk-doc && make dist
Generating the docs, requires man/nm-settings.xml. That is only present
when
- ./configure --enable-gtk-doc --with-introspecton
- in a dist-tarball, contrary to a git-tree
Only create docs, when we also regenerate the manuals (BUILD_SETTING_DOCS).
That is, you can no longer generate docs, by relying on the pre-generated
manual pages.
If you want to generate docs, you have to regenerate the manual pages
as well.
Previously, doing the following in a git-tree failed:
$ git clean -fdx
$ ./autogen.sh --enable-gtk-doc --enable-introspection=no && make
...
make[2]: Entering directory './NetworkManager/docs/api'
DOC Preparing build
DOC Scanning header files
DOC Introspecting gobjects
DOC Building XML
DOC Building XML
make[2]: *** No rule to make target '../../man/nm-settings.xml', needed by 'html-build.stamp'. Stop.
make[2]: Leaving directory './NetworkManager/docs/api'
This adds 0.4 seconds to the build time.
You can disable it by setting $NM_BUILD_NO_CREATE_EXPORTS environment
variable. This is useful in the unexpected case that the script
is broken.
Or, if you just want to use a different, non-generated version-script.
Or, if you want to save 0.4 seconds build-time.
This speeds up the initial object tree load significantly. Also, it
reduces the object management complexity by shifting the duties to
GDBusObjectManager.
The lifetime of all NMObjects is now managed by the NMClient via the
object manager. The NMClient creates the NMObjects for GDBus objects,
triggers the initialization and serves as an object registry (replaces
the nm-cache).
The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
object creation, removal and property changes. It takes care of the
property changes so that we don't have to and lets us always see a
consistent object state. Thus at the time we learn of a new object we
already know its properties.
The NMObject unfortunately can't be made synchronously initializable as
the NMRemoteConnection's settings are not managed with standard
o.fd.DBus Properties and ObjectManager APIs and thus are not known to
the ObjectManager. Thus most of the asynchronous object property
changing code in nm-object.c is preserved. The objects notify the
properties that reference them of their initialization in from their
init_finish() methods, thus the asynchronously created objects are not
allowed to fail creation (or the dependees would wait forever). Not a
problem -- if a connection can't get its Settings, it's either invisible
or being removed (presumably we'd learn of the removal from the object
manager soon).
The NMObjects can't be created by the object manager itself, since we
can't determine the resulting object type in proxy_type() yet (we can't
tell from the name and can't access the interface list). Therefore the
GDBusObject is coupled with a NMObject later on.
Lastly, now that all the objects are managed by the object manager, the
NMRemoteSettings and NMManager go away when the daemon is stopped. The
complexity of dealing with calls to NMClient that would require any of
the resources that these objects manage (connection or device lists,
etc.) had to be moved to NMClient. The bright side is that his allows
for removal all of the daemon presence tracking from NMObject.
We'll soon not only do the router discovery, but announce ourselves as a
reouter. "Neighbor discovery" sounds to be a more appropriate name for
the class than "Router discovery".
This is especially important because we don't support
line continuation. Thus, with
FOO='val
bar=3'
wrong line
F2=b
F3='b
XXX=adf'
XXX2=val2
'
we now write
FOO=
#NM: FOO='val
bar=
#NM: bar=3'
#NM: wrong line
F2=b
F3=
#NM: F3='b
XXX=
#NM: XXX=adf'
XXX2=val2
#NM: '
Basically, the writer will comment out any line that is
- not all-whitespace
- not a '#' comment (possibly proceeded by whitespace)
- not a valid variable assignment
This avoids that writer writes lines that are not understood by
ifcfg-rh plugin, but interferes with initscripts. E.g.
NAME=old-name'
rm -rf /
'
becomes
NAME=new-name
#NM: rm -rf /
#NM: '
make[2]: Entering directory './NetworkManager/NetworkManager-1.5.1/_build/sub'
VAPIGEN vapi/libnm.vapi
Gio-2.0.gir:62318.7-62318.47: warning: Virtual method `G.Resolver.lookup_service_async' conflicts with method of the same name
Gio-2.0.gir:64704.7-64704.31: warning: Signal `G.Settings.change_event' conflicts with method of the same name
Gio-2.0.gir:84847.7-84851.24: error: `UnixSocketAddress' already contains a definition for `abstract'
Gio-2.0.gir:84690.7-84692.21: note: previous definition of `abstract' was here
Makefile:16410: recipe for target 'vapi/libnm.vapi' failed
Fixes: 0fa2cf19e5
NetworkManager and nm-iface-helper compiled nm-dhcp-manager.c twice,
the latter with setting -DNM_DHCP_INTERNAL_ONLY to only enable the
internal plugin.
Change that to compile nm-dhcp-manager.c once for both users
by putting it into libNetworkManagerBase.
We only needed proper glib enum types for having properties
and signal arguments. These got all converted to plain int,
so no longer generate such an enum type.
There is an strange automake warning
Makefile.vapigen:49: warning: $(1) was already defined in condition TRUE, which includes condition ENABLE_VAPIGEN ...
Makefile.am:4: 'Makefile.vapigen' included from here
Makefile.glib:124: ... '$(1)' previously defined here
Makefile.am:1: 'Makefile.glib' included from here
when having
if ENABLE_VAPIGEN
include Makefile.vapigen
endif
That is worked around by removing the "if", which however
requires us to remove the error check in Makefile.vapigen.
Let's always build with tests, regardless of --enable-tests.
If the user builds with --enable-tests=no, we automake the tests
as check_PROGRAMS, which only compiles the tests during `make check`.
Otherwise, we automake them as noinst_PROGRAMS, which builds the
tests regularly as a normal build.
This way, a user who doesn't want to build the tests regularly,
still can build and run them via `make check`.
Had to rename "nm-enum-types.h" because it works badly with
"libnm/nm-enum-types.h". Maybe I could fix that differently,
but duplicate names is anyway error prone.
Note that "nm-core-enum-types.h" is already taken too, so
"nm-src-enum-types.h" it is.
Originally, the "callouts" directory contained various programs
that NetworkManager would call, for example the dhcp helper.
For a while, it only contains nm-dispatcher. Thus rename the directory
to indicate that it's for dispatcher.
Up to now, the "include" directory contained (only) header files that were
used project-wide by libs, core, clients, et al.
Since the directory now also contains a non-header file, the "include"
name is misleading. Instead of adding yet another directory that is
project-wide, with non-header-only content, rename the "include"
directory to "shared".
Add --without-libnm-glib, for people who don't want to build the
legacy client libraries. When building with this option, dbus-glib and
libdbus are not required.
After the hostname functionality has been moved from plugins to core,
the ifcfg-suse plugin contains only boilerplate code with no actual
functionality.
Remove the plugin, mark it as deprecated in manual page and print a
warning when it is selected in configuration file.
It seems like a poor default for various downstream toolchains. We can't
anticipate the compiler warnings for future compiler versions and older
ones are prone to false positives. Also, older gdbus-codegen is known
to generate code that triggers compiler warnings.
Let's keep it enabled for maintainer builds and distcheck so that we're
sure a tool chain that builds releases without warnings exists.
Port libnm-core/libnm to GDBus.
The NetworkManager daemon continues to use dbus-glib; the
previously-added connection hash/variant conversion methods are now
moved to NetworkManagerUtils (along with a few other utilities that
are now only needed by the daemon code).
This fixes up the code from the previous "clean" import, and adds
build infrastructure.
[There are two slightly orthogonal sets of changes in this patch.
First, the files added in the previous commit were modified as followed:
# Replace internal references to "libnm-util" and "libnm-glib" with "libnm"
perl -pi -e 's/libnm-(util|glib)/libnm/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]
# Fix includes of the enum-types files
perl -pi -e 's/nm-utils-enum-types/nm-core-enum-types/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]
perl -pi -e 's/nm-glib-enum-types/nm-enum-types/;' libnm/*.[ch] libnm/tests/*.[ch]
# Fix some python example code
perl -pi -e 's/import NMClient/import NM/;' -e 's/NMClient.Client\(\)/NM.Client()/;' libnm/nm-client.c
Then, the build infrastructure was added (without further modifying
any existing files in libnm-core or libnm.)
Note: to regenerate libnm.ver after rebase:
(head -2 libnm-util/libnm-util.ver; (grep -h '\s'nm_ libnm-util/libnm-util.ver libnm-glib/libnm-glib.ver | env LANG=C sort); tail -3 libnm-util/libnm-util.ver) > libnm/libnm.ver
]
The remaining contents of the test/ directory are:
- 2 python example programs that aren't as good as the ones in examples/
- a test of the deprecated libnm_glib API which isn't as good as the one
in libnm-glib/
- A DHCP-related test program that hasn't been relevant since 2005
Let's just kill it all
Create a new clients/ subdirectory at the top level, and move cli/ and
tui/ into it, as well as nm-online.c (which was previously in test/,
which made no sense).
cli/ was split into two subdirectories, src/ and completion/. While
this does simplify things (given that the completion file and the
binary both need to be named "nmcli"), it bloats the source tree, and
we can work around it by just renaming the completion file at install
time. Then we can combine the two directories into one and just have
it all under clients/cli/.
Certain build configurations (like --enable-gtk-doc
--disable-introspection) were broken with respect to nm-setting-docs.
Fix this. Also, we don't require just gobject-introspection, we need
pygobject specifically as well.
Add generate-setting-docs.py, based on tools/generate-settings-spec.c,
which generates a simple XML file describing all libnm setting
properties (still getting the default values via GParamSpec
introspection like generate-settings-spec.c does, but getting the
documentation out of the gtk-doc strings in the GIR file instead).
We were setting GLIB_VERSION_MAX_ALLOWED to 2.34, since we provide
reimplementations of a few 2.34 functions in nm-glib-compat.h. But
this was turning off warnings for the 2.34+ APIs we *didn't* have
compat versions of too.
Fix this by setting MAX_ALLOWED to 2.32 (same as MIN_REQUIRED), and
defining macros to wrap calls to compat-ified functions and disable
deprecation warnings around them.
This points out several places where we were accidentally using 2.34
APIs without noticing, which need to be fixed now.
Without this patch, the following fails with a rather obscure message
about missing make target.
./autogen.sh && make && make distcheck
...
*** No rule to make target `NetworkManager.8', needed by `distdir'. Stop.
Swap the order of the subdirectories 'docs' and 'man' to build
'docs' earlier. This way, `make distcheck` fails in the directory 'docs'
with a better error message:
*** gtk-doc must be installed and enabled in order to make dist
Also, add 'man/nmcli-examples.5' to the list of files, to determine
whether to use the pre generated doc files.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Update the tests flag to the latest syntax, and make sure we
don't run valgrind on distcheck for now, since new valgrind
errors may show up when things like glib change.
And change src/main.c to use the local allocation macros. This
results in much cleaner code, as one can see from the diff.
Because libgsystem is designed for nonrecursive make, it fits best in
the current recursive setup if we build . first. This will be a lot
nicer when we switch NM to a nonrecursive setup.
dist tarballs shouldn't ever be released without the documentation,
and this allows us to build the tarballs with pre-generated docs
that get installed on the end system, but don't need to be built
there. So the end system doesn't need gtk-doc installed, only
the dist system does.
https://bugzilla.gnome.org/show_bug.cgi?id=700093
It doesn't make much sense to install initscripts in current distributions. Most
of them either don't use initscripts at all, locally patch the initscripts or
supply their own. This allows us to eventually drop the --with-distro configure
option.
Many current distributions support multiple init systems and it doesn't make
sense for upstream to make the choice for them. Distributors can still make
their scripts copy one of the initscripts from the source tree if they wish so.
This patch adds the autotools facilities to generate vapi files so that
libnm-util and libnm-glib can be consumed from Vala.
It depends on vapigen and it is a soft dependency.
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.
Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.
Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.
To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.
Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
Add the necessary annotations (the mininum required, that is those
on return values. NULL parameters or container types may require
more), and the Autotools stuff to get a NetworkManager GIR for
libnm-util and a NMClient for libnm-glib.