Commit Graph

24524 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
b68bb97971 cli: Assert we don't require multiple commands during client initalization
If a new command was requested while a client was in the process of being
created we were just requesting a new client.

This was causing leak, so let's strongly ensure this is not the case.
2019-10-02 09:11:28 +02:00
Thomas Haller
c4c8889256 cli: fix leaking error variable in command_done() 2019-10-02 09:11:28 +02:00
Marco Trevisan (Treviño)
479c269766 cli: Use GTask to perform async requests 2019-10-02 09:11:28 +02:00
Marco Trevisan (Treviño)
36bd0565b7 test-client.py: Close pipes and print logs on timeout failures
If we failed on process wait, we didn't close the pipes and no clear output
of what happened was exposed.

So use a finally stanza to close the pipes and print stdout and stderr
on failure.
2019-10-02 09:11:28 +02:00
Marco Trevisan (Treviño)
6a58c55ca4 run-nm-test: Just use exec instead of running and exiting 2019-10-02 09:11:28 +02:00
Marco Trevisan (Treviño)
073eda68fc run-nm-test: Set NM_TEST_UNDER_VALGRIND accordingly
When a test is going to be run under valgrind we set NM_TEST_UNDER_VALGRIND
so that we can properly check whether this is happening.
2019-10-02 09:11:28 +02:00
Beniamino Galvani
5307b1ed73 wifi: guess metered flag based on Network Cost information element
Network Cost [1] is a vendor-specific information element defined by
Microsoft and used to advertise the cost of Wi-Fi networks to clients.

We can use it together with the ANDROID_METERED mechanism to
automatically set the metered flag on the device.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/mobilebroadband/network-cost-information-element

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/200
2019-10-01 13:37:50 +02:00
Thomas Haller
44193d3def gitlab-ci: workaround unit test failure for iproute2 bug in "ubuntu:devel"
"ubuntu:devel" ships iproute2 version "5.2.0-1ubuntu1". This has a well known
bug that prevents it from creating IP tunnels during the unit tests.

We already workaround that on Debian. Add the same workaround to match the
Ubuntu package.
2019-10-01 09:55:39 +02:00
Thomas Haller
2cff04ea09 build/meson: merge branch 'inigomartinez:meson-update'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/256
2019-10-01 09:49:41 +02:00
Iñigo Martínez
42a8533d5f meson: Remove devices tests' meson build files
The devices tests' meson build files include only the build of a
single executable file and its execution as a test unit.

This has been moved to the devices' main meson build files so this
files can be removed.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
05c7a77022 meson: Add missing "nm-bt-test" helper program
In 878d4963e a new `nm-bt-test` helper program was added. However,
although `autotools` build steps were included, meson build steps
were not.

This add meson's build steps.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
95abecb24d meson: Make use of gnome.mkenums_simple
There are different enum files created that make use of different
template files. However, `mkenums_simple` method allows the creation
of the same enum files without the need of template files.

The creation of the `nm-core-enum-types` and
`nm-core-tests-enum-types` use now `mkenums_simple` so template
files are now unnecessary.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
23b4dc5f77 meson: Rename variables related to pkg-config variables
Some variables belong to variables in their correspondent pkg-config
file.

These variables have been renamed to `dependency_variable` to
reflect the dependency and variables from pkg-config files they are
related to.

Some of these has also been fixed to use paths relative to
installation prefix.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
2172b885b4 meson: Improve the wwan test build file
The test unit name string is used in different place so it has been
replaced by a variable.

The `nm-service-providers.c` source file is appended by using a
`files` generated object.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
7e1aacaef2 meson: Remove tests related to check_so_symbols
These tests are already working since 19a718bc1 so `FIXME` comments
are not needed anymore.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
f0b7041063 meson: Improve api documentation build file
the `doc_module` variable has been removed. It was created because
its used in the autotools build file but actually `nm_name` variable
can be used easily.

Different objects used in the documentation target have been grouped
together.

The content file `version.xml`, and different build files are now
added properly.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
9d4e1ad5e3 meson: Improve libnm documentation build file
the `doc_module` variable has been removed. It was created because
its used in the autotools build file but actually `libnm_name`
variable can be used easily.

Different objects used in the documentation target have been grouped
together.

The content file `version.xml` is now added properly.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
700f6f6b5f meson: Improve Qt examples
Qt dependencies have been moved to the main build file where the
rest of dependencies are located. This makes it easier to find them.

The included directories has also reviewed and removed the
unnecessary ones.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
da40a6597f meson: Improve nmtui and libnmt-newt build
The dependencies used in the build of the `nmtui` executable and the
`libnmt-newt` library have been reviewed.

The compiler flags used in common by them has also been moved to a
`common_c_flags` variable to avoid any confussion.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
8a5a38f74a meson: Improve nmcli build
The dependencies used in the build of `nmcli` has been reviewed and
removed the unnecessary ones. The used compiler flags has also been
moved to one line.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
f5d74ce179 meson: Improve the client common test build file
The build file in the `client` `common` directory has been improved
by grouping the objects used in properties and by reviewing the
dependencies used by tests built. Finally the indentation has also
been fixed.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
83b760cf98 meson: Improve the client common build file
The build file in the `client` `common` directory has been improved
by grouping the objects used in properties and by reviewing the
dependencies used by libraries built in the file.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
25bb43f4db meson: Ease the use of the libnm-libnm-core-intern library
The dependency for the `libnm-libnm-core-intern` library has been
recovered to ease its use.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
60b2c8683f meson: Make one liner compiler flag 2019-10-01 09:49:33 +02:00
Iñigo Martínez
096748a196 meson: Rename cflags variable
The variable holding the compiler flags, `cflags`, has been renamed
to `c_flags` to be consistent with the rest of build files.

Different objects used in the `test-dispatcher-envp` target
have been grouped together.

The dependency over the `libnm` library has been removed as it is
unnecessary.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
70da6993c8 meson: Improve dispatcher test build file
Different objects used in the `test-dispatcher-envp` target
have been grouped together.

The dependency over the `libnm` library has been removed as it is
unnecessary.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
4e85fdcdb7 meson: Avoid the creation of extra variables
Extra variables are used for sources of targets in the `dispatcher`
build file. These have been moved to the `source` parameter because
using them directly avoiding the creation of extra variablse doesn't
hurt readibility.

The compiler flags `cflags` variable has also been renamed to be
consistent with the rest of build files.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
c5e80a23fe meson: Remove extra new line 2019-10-01 09:49:33 +02:00
Iñigo Martínez
509706b62b meson: Avoid the creation of an extra variable
An extra variable is used for sources of
`libnm-settings-plugin-ifupdown` module. However, it only contains
one source file and using it directly avoiding the creation of the
extra variable doesn't hurt readibility.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
146348199e meson: Remove unused variable 2019-10-01 09:49:33 +02:00
Iñigo Martínez
a010fcb5f7 meson: Move network-config directory creation to main install file
The `ifcfg-rh` meson build file installs a new post install script
to create the `network-config` directory.

This has been moved to the main post install file so it's easier to
find because all post install steps are together and it avoids and
extra post install script execution.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
f5f9c071ba meson: Improve ifcfg-rh plugin build
The file has been fixed to be consistent with the rest of the files.
The data files to be installed have been grouped together. The
sourc files has been listed vertically and the link target in
`nm-settings-plugin-ifcfg-rh` does not use an array anymore.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
4e5b1e257e meson: Improve nm-initrd-generator target
The set of link targets used when building `nm-initrd-generator`
target has been grouped together.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
c4dc02c9bd meson: Avoid the use of unnecessary array
The linker flags used when building `libnm_wwan` target uses an
array even when it only uses one value.

When using only one value the array is unnecessary so it has been
removed.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
dababfa59e meson: Improve ppp build file
The set of c_flags used when building `ppp` targets has been grouped
together. Used dependencies have also been reviewed and removed
the unnecessary one.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
23bd02110c meson: Rename the compiler flags variable
Renamed the variable holding the compiler flags to be consistent
with different meson ports.

This naming pattern improves the use of different compiler flags
in environments with multiple languages.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
780585952d meson: Use variable for test program name
The name of the `monitor` test program is duplicated. A variable
has been used to avoid using the same string twice.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
31f1516760 meson: Improve the src build file
The targets that involve the use of the `NetworkManager` library,
built in the `src` build file have been improved by applying a set
of changes:

- Indentation has been fixed.
- Set of objects used in targets have been grouped together.
- Aritificial dependencies used to group dependencies and custom
  compiler flags have been removed and their use replaced with
  proper dependencies and compiler flags to avoid any confussion.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
1066ddb3a1 meson: Improve the systemd build file
The `systemd` build file has been improved by grouping together all
the objects used in the building of the `libnm-systemd-core`
library.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
caf470f788 meson: Improve targets involving libnm library
The targets that involve the use of the `libnm` library have been
improved by applying a set of changes:

- Generated enum sources variable `libnm_enum` has been renamed to
  `libnm_enum_sources` to clearly specify what it is holding.
- Indentation in the `libnm` build and test files has been fixed.
- Set of objects used in targets have been grouped together.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
1cd615288e meson: Improve the libnm-core test build file
All variables used in every test have been moved to the start of the
build file.

Generated enum sources variable has been renamed to `enum_sources`
to clearly specify what it is holding.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
f427f4771e meson: Improve the libnm-core build file
The `libnm-core` build file has been improved by applying a set of
changes:

- Indentation has been fixed to be consistent.
- Library variable names have been changed to `lib{name}` pattern
  following their filename pattern.
- `shared` prefix has been removed from all variables using it.
- Dependencies have been reviewed to store the necessary data.
- The use of the libraries and dependencies created in this file
  has been reviewed through the entire source code. This has
  required the addition or the removal of different libraries and
  dependencies in different targets.
- Some files used directly with the `files` function have been moved
  to their nearest path build file because meson stores their full
  path seamessly and they can be used anywhere later.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
ad4834009b meson: Improve crypto support build
There are multiple conditional steps for building encryption
support. This is because the support varies from `gnutls` or `nss`.

This has been improved to reduce the number of used conditions.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
de90fc0810 meson: Improve the shared utils test build file
A new variable has been created for the C compiler flags to avoid
polluting the target creation call so the flags are encapsulated.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
70a34c54fe meson: Use dependency for nm-default header
The `nm-default.h` header is used widely in the code by many
targets. This header includes different headers and needs different
libraries depending the compilation flags.

A new set of `*nm_default_dep` dependencies have been created to
ease the inclusion of different directorires and libraries.

This allows cleaner build files and avoiding linking unnecessary
libraries so this has been applied allowing the removal of some
dependencies involving the linking of unnecessary libraries.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
c74e428342 meson: Improve the shared build file
The `shared` build file has been improved by applying a set of
changes:

- Indentation has been fixed to be consistent.
- Unused libraries and dependencies have been removed.
- Dependencies have been reviewed to store the necessary data.
- Set of objects used in targets have been grouped together.
- Header files have been removed from sources lists as it's
  unnecessary.
- Library variable names have been changed to `lib{name}` pattern
  following their filename pattern.
- `shared` prefix has been removed from all variables using it.
- `version_header` its related configuration `version_conf`
  variables have been renamed to `nm_version_macro*` following
  its input and final file names.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
31a2710f11 meson: Simplified WiFi detection when IWD is enabled 2019-10-01 09:49:33 +02:00
Iñigo Martínez
82e79e40a5 meson: Avoid the use of source_root and build_root methods
The way some directory paths are defined has also been changed to
avoid the use of the `source_root` and `build_root` functions
because they are discouraged[0]

[0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
2019-10-01 09:49:33 +02:00
Iñigo Martínez
48bb5b68e3 meson: Define meson information early
The used meson modules, default directories and includes have been
moved to the start of the build file, just after project related
information, so they are available early.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
bfbcf8f3fe meson: Use generators placeholders
Functions derived from generators as `configure_file`,
`custom_target` and `i18n.merge_file` can use placeholders like
`@BASENAME@` that removes the extension from the input filename
string.

The output string has been replaced by this placeholder that
allows in some cases the use of less variables.
2019-10-01 09:49:33 +02:00