Commit Graph

179 Commits

Author SHA1 Message Date
Thomas Haller
49b0a92b5a contrib: add "nm-python-black-format.sh" script
This is more for completeness, to go along "nm-code-format.sh"
script.

Usually it's very simple to run black directly (you may still do that).
However, black by default only reformats files with ".py" extension.
So to get all our python files, you'd need to know and explicitly
select them... or use this script.

Also, `black .` scans the entire source tree, and is rather slow.
This script knows which files to select and is thus faster.
2022-04-01 14:00:30 +02:00
Thomas Haller
670894b667 contrib: fix wrong usage text for "nm-code-format.sh" 2022-04-01 13:51:56 +02:00
Thomas Haller
a628a35e80 contrib/checkpatch: try to warn about uninitialized GError variables
When we have a GError* variable on the stack, we usually want to pass
it on to function that can fail. In that case, the variable MUST be
initialized to NULL. This is an easy mistake to make.

Note that this check still can have lots of false positives, for
example, if you have a struct with an GError field. In that case, you
would need to ensure that the entire struct is initialized. Ignore the
warning then.

Also, the check misses if you declare multiple variables on one line.
But that is already discouraged by our style.
2022-03-09 23:14:37 +01:00
Thomas Haller
5a5d9573e1 contrib: colorize releasing slave in NM-log 2022-02-23 17:07:16 +01:00
Lubomir Rintel
f15fb5ecaa contrib/modemu: extend PDP support
Improve it just a bit to make ModemManager 1.18 happy.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1087
2022-02-04 15:54:15 +01:00
Lubomir Rintel
ea37c42b16 contrib/modemu: respond to AT+COPS?
This queries the operator code. If NetworkManager got one, it can
connect the modem device automatically without setting the APN.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1086
2022-02-04 15:54:15 +01:00
Thomas Haller
b2f507cab6 contrib/scripts: fix package list for Fedora 35 in "nm-in-container.sh" script
"grc" got removed/orphaned in Fedora 35.

Also, "vala-tool" is gone and (for a long time) replaced by "vala".
2022-01-13 20:05:14 +01:00
Thomas Haller
2b449694e5 checkpatch: complain about tabs in source file
There are very few places left where we would accept tabs in a source
file. Warn about that, even if it might cause some false positives.

I think this line was commented out due to a mistake.
2022-01-07 07:32:04 +01:00
Thomas Haller
866e3a2b51 contrib/scripts: update "nm-copr-build.sh" script to use new nm-git-bundle 2022-01-06 10:03:57 +01:00
Thomas Haller
34c59c96c5 contrib/scripts: better explain the purpose of nm-git-bundle 2022-01-06 10:01:51 +01:00
Thomas Haller
99f82b4b84 contrib: fix "find-backports" script to properly handle "Ignore-Backport" tag
The "Ignore-Backport" tag can be used to mark a commit that should not
be backported. Similar to the "cherry picked from" line, which indicates
that the patch was backported.

Anyway, this didn't work correctly, because we first pre-filter the
commits we search (as a performance optimization) by using `git-log` to
get a subset of the commits we want to investigate.

So if you had a commit with an "Ignore-Backport" tag, but without "cherry
picked from" line, then it wasn't found.

Fix that.
2022-01-05 09:30:16 +01:00
Thomas Haller
a6ff5ee448 contrib/scripts: add Fedora version to podmain container name for "nm-code-format-container.sh"
Older branches, like "nm-1-32" will always be formatted with a
different, older clang-format version. Luckily we also have on "nm-1-32"
branch the "nm-code-format-container.sh" script, so we can still
reformat the sources using the container.

However, as the name of the container was always "nm-code-format",
we would have to re-generate the container when we switch between
branches. As the container really only depends on the Fedora version
(as the clang-format version is tied to the corresponding Fedora
version), let's include the Fedora version in the name of the container.
2022-01-04 21:17:19 +01:00
Thomas Haller
081510ed94 gitlab-ci: use Fedora 35 as default build target 2021-11-29 09:31:09 +00:00
Thomas Haller
3e6c18e9af checkpatch: suggest to use _nm_setting_property_define_direct_*() for setting properties
We have multiple ways to define properties (like, GVariant based
nm_setting_option_*() or GObject based properties). For the latter,
they nowadays should all be implemented via _nm_setting_property_define_direct_*()
API.
2021-11-04 20:25:19 +01:00
Lubomir Rintel
ae4412b2fc contrib/checkpatch: recognize git subtree merges
Make checkpatch.pl identify subtree merges in "git am"-formatted
patches and reconstruct the full path names based in the subtree root.

This fixes some spurious warnings for parts of the tree that use
different coding style from what we usually do.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/989
2021-10-12 15:13:44 +02:00
Thomas Haller
34410c9c3e contrib: fix motd comment in "nm-in-container.sh" 2021-10-08 12:35:15 +02:00
Thomas Haller
82260cc5c2 contrib: add "contrib/scripts/test-ppp.sh" test script 2021-10-04 15:40:15 +02:00
Thomas Haller
1b488fe34c contrib: make it easy to test PPPoE in container script
It doesn't actually work inside the root-less container...
Well, it works as far as starting to activate, before it
fails. That is still somewhat useful. So have it there...
2021-10-04 15:40:15 +02:00
Thomas Haller
b9ff90c87d checkpatch: discourage use of g_clear_pointer()
We have nm_clear_pointer() instead, which does not cast the function
argument, and thus the compiler is better at checking the arguments.
2021-09-22 17:26:02 +02:00
Thomas Haller
48691a2101 contrib: improve nm-in-container.sh script (7) 2021-09-21 13:56:37 +02:00
Thomas Haller
bf6d5f355e contrib: improve nm-in-container.sh script (6) 2021-09-21 09:13:44 +02:00
Thomas Haller
6f2c69f484 contrib: improve nm-in-container.sh script (5) 2021-09-16 20:54:49 +02:00
Thomas Haller
3e80b4fa63 contrib: reformat by default from "nm-code-format.sh" script
The majority of times when I call this script, I want it to do the reformatting,
not the check-only mode. This is also because we use git, so I start with a
clean working directory and run the reformatting code. In the best case, there
is nothing to reformat, and all is good. I seldom want to only check.

Change the default of the script.
2021-09-16 09:01:50 +02:00
Thomas Haller
1a56dcd4da contrib: explicitly pass "-n" to "nm-code-format.sh" in "code-style-git-post-commit-hook"
"nm-code-format.sh" is going to change the default behavior from "-n" to
"-i", that is, from check-only to reformat. Explicitly pass "-n" where
we want it.
2021-09-16 08:47:38 +02:00
Thomas Haller
ef7258eafe contrib: improve nm-in-container.sh script (4) 2021-09-15 22:08:42 +02:00
Thomas Haller
a9f6f49c8a gitignore: fix ignore file for nm-in-container.d 2021-09-15 22:08:41 +02:00
Thomas Haller
4c007c4c27 contrib: fix "nm-code-format.sh" to select files to format
There was always the idea that you could pass paths and filenames
to "nm-code-format.sh" to format only a subset. However, the script
also needs to honor files that should be excluded and don't need
formatting.

Previously, what was implemented via `git ls-files -- ':(exclude)...'`
command, but git-ls-files has a bug ([1]) and might not list all files.

Refactor and do the filtering ourselves.

[1] https://www.spinics.net/lists/git/msg397982.html
2021-09-15 22:08:13 +02:00
Thomas Haller
756757102f contrib: improve nm-in-container.sh script 2021-09-15 12:31:23 +02:00
Thomas Haller
dbcbb45224 contrib: improve nm-in-container.sh script 2021-09-14 22:26:12 +02:00
Thomas Haller
7fea431061 contrib: improve nm-in-container.sh script 2021-09-14 20:23:15 +02:00
Thomas Haller
d7c0dcc7b4 contrib: improve nm-in-container.sh script 2021-09-13 22:18:51 +02:00
Thomas Haller
549424273a contrib: add nm-in-container.sh script to build a (podman) container for testing
Only a first attempt. It needs more improvements.
2021-09-13 16:57:31 +02:00
Thomas Haller
023c8ad88b code-format: exclude "src/linux-headers" from "nm-code-format.sh" script 2021-09-06 10:00:35 +02:00
Thomas Haller
3a39ce6a99 checkpatch: encourage g_snprintf() over snprintf()
The only reason is consistency. The majority of times we
do use g_snprintf(). As there are no strong reasons to
prefer one over the other, prefer the one that use use
most of the time.
2021-08-26 14:59:53 +02:00
Thomas Haller
a99ac7ccd8 glib-aux: add nm_g_idle_add()
g_idle_add() is discouraged, and the checkpatch.pl script warns
about it.

Sometimes there is a legitimate use of it, when you want to always
schedule an idle action (without intent to cancel or track it). That
makes more sense for g_idle_add() than it does for g_timeout_add(),
because a timeout really should be tracked and cancelled if necessary.

Add a wrapper to rename the legitimate uses. This way, we can avoid the
checkpatch.pl warnings, and can grep for the remaining illegitimate uses.
2021-07-26 15:30:04 +02:00
Beniamino Galvani
1e3bbdfbbb contrib: add script to test IPv6 prefix delegation
Add a script to test IPv6 prefix delegation with NM, in different
modes.
2021-07-13 09:43:04 +02:00
Thomas Haller
5388542fc0 checkpatch: discourage use of API that uses numeric source IDs
The numeric source IDs exist from a time before 2000, when there
was only one "GMainContext" singleton instance. Nowadays, the source
ID is only relative to one GMainContext, and you'd have to track
that association yourself. Als, g_source_remove() requires an additional
hash lookup, when you could simply track the GSource instance from the
start.

This API should not be used anymore. Operate on GSouce instances
direclty and use API like

  nm_clear_g_source_inst()
  nm_g_idle_add_source()
  nm_g_idle_souce_new()
  nm_g_source_attach()
  g_source_attach
  g_source_destroy
  g_source_unref
  etc.

Note that if you don't care about to ever remove a source again, like
scheduling an idle action that should not be cancelled, then

  g_idle_add(callback, user_data);

is fine. It is only problematic to do something with those numeric IDs.
checkpatch.pl would also flag those uses, but these are just warnings
and in the few cases where such a warning is emitted wrongly, it's find
to ignore them.
2021-06-28 13:31:33 +02:00
Thomas Haller
26090bafc9 contrib: extend "test-create-many-device-setup.sh" script 2021-06-22 09:47:44 +02:00
Thomas Haller
be4b997e4f examples: add "examples/python/gi/nm-up-many.py"
It's an example for how to use libnm and asynchronous API.
But it's also a script I will use to test activating many
profiles in parallel.

Also add a test script that creates many veth interfaces and connection
profiles. So now you can do:

   sudo NUM_DEVS=100 contrib/scripts/test-create-many-device-setup.sh setup
   ./examples/python/gi/nm-up-many.py c-a{1..100}

and cleanup with

   nmcli connection down c-a{1..100}
   sudo contrib/scripts/test-create-many-device-setup.sh cleanup

Of course, be careful to do this on your production machine.
2021-06-11 22:48:41 +02:00
Thomas Haller
39d71ee356 contrib: update NM-log script to highlight "enslaving to master" messages 2021-06-11 10:54:15 +02:00
Thomas Haller
6439c243e7 systemd: move "src/core/systemd" to "src/libnm-systemd-core"
This follows the recently introduced naming scheme and directory layout.
"libnm-systemd-core" is an independent component, and as such should no
be inside "src/core/".

Move it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/875
2021-05-30 09:45:05 +02:00
Thomas Haller
6365d8c67a contrib/scripts: drop unnecessary line in "find-backports" script 2021-05-26 23:38:58 +02:00
Thomas Haller
fb2ea999ea clang-format: update "nm-code-format-container.sh" script to use Fedora 34 container 2021-05-04 13:56:27 +02:00
Thomas Haller
23a200d19e checkpatch: warn about uses of strcmp()/g_strcmp0()
Using strcmp()/g_strcmp0() for checking for string equality is hard
to read. We should prefer our streq variants -- unless, you really
mean cmp.
2021-04-26 09:53:11 +02:00
Thomas Haller
74fc279341 contrib: fix URL to nm-git-bundle in "nm-copr-build.sh" 2021-04-01 22:34:06 +02:00
Thomas Haller
172dace30d contrib/scripts: use "main" branch name in "checkpatch-feature-branch.sh" 2021-04-01 22:28:59 +02:00
Thomas Haller
f938ec6977 contrib: update nm-git-bundle to use "main" branch 2021-04-01 22:24:49 +02:00
Thomas Haller
f0612bd67b contrib/scripts: update find-backports script to use "main" branch name 2021-04-01 21:40:25 +02:00
Thomas Haller
e643703418 tests/client: run "test-client.py" also for meson 2021-03-15 17:10:56 +01:00
Thomas Haller
afd55358a4 contrib/scripts: fix "nm-copr-build.sh" script to use new nm-git-bundle 2021-03-03 11:00:06 +01:00