Commit Graph

809 Commits

Author SHA1 Message Date
Thomas Haller
a859cee560
contrib: fix /etc/motd for "nm-in-container.sh" 2022-05-16 16:32:21 +02:00
Thomas Haller
0ca6aaab32
contrib: don't use "Z" specifier for mounting base directory in "nm-in-container.sh"
It seems unnecessary, and can cause failure.
2022-05-16 16:32:21 +02:00
Thomas Haller
56e1f0d290
contrib: ignore error installing behave_html_formatter in container
Yes, this is currently broken. *sigh*. Ignore any failure.
2022-05-16 16:32:08 +02:00
Thomas Haller
e766ca4e7c
contrib: improve nm-in-container.d scripts
Get `ip netns exec` to work. Now we can start stuff in their
own namespace, which is much cleaner.
2022-04-28 19:33:14 +02:00
Thomas Haller
a1ff31db3b
contrib: install nmstate+nispor in "nm-in-container.sh" 2022-04-19 11:15:08 +02:00
Thomas Haller
4d53df2911
contrib/makerepo.sh: fix name for local cache of git repository
The $URL might already contain a ".git" suffix. Then $FULLNAME would
end up having two ".git" extensions. Fix that.
2022-04-15 11:24:19 +02:00
Thomas Haller
135bc5dd1f
contrib/makerepo.sh: don't use unauthenticated github URL
It doesn't work anymore:

  $ git clone git://github.com/thom311/libnl.git
  Cloning into 'libnl'...
  fatal: remote error:
    The unauthenticated git protocol on port 9418 is no longer supported.
  Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
2022-04-15 11:11:17 +02:00
Thomas Haller
6bada7fb9e
contrib/rpm: reorder variable in spec file and set rpm_version
On recent Fedora and RHEL we no longer have differing "rpm_version"
and "real_version". So usually "rpm_version" is just the same as
"real_version".

Update the template spec file to reflect that. For the "build_clean.sh"
script, we anyway always set them both to "__VERSION__".
2022-04-14 12:47:07 +02:00
Thomas Haller
7003b5eb70
contrib: don't abort on first error during ftpadmin install
With "rc1" mode, we install more than one tarballs (the one for 1.37.90
and 1.39.0). If we reach this point, we already pushed the git tags.
There is no way back.

Ignore errors at first and try to release all tarballs. Only signal the error
at the end.
2022-04-06 19:17:58 +02:00
Thomas Haller
e9340c792c
contrib: fail "find-backports" script if we have no "refs/notes/bugs" notes
"find-backports" script parses the commit messages to figure out which
patches to backport. We use "refs/notes/bugs" notes to extend the
meta data after the commit was merged. If you don't setup the
notes, the output is likely incomplete or wrong.

Yes, this is annoying. It requires you to setup the notes as described
in "CONTRIBUTING.md". Also because the "release.sh" script runs "find-backports",
so that means you cannot do releases without setting up the notes
(unless you manually disable running "find-backports"). But you really shouldn't
make a release based on incomplete information.
2022-04-06 13:23:37 +02:00
Thomas Haller
a4da2eb5e5
contrib: improve detection of fedpkg repository in "makerepo.sh" 2022-04-06 09:46:14 +02:00
Thomas Haller
f3be419719
contrib: better autotect python files to format for "nm-python-black-format.sh" script 2022-04-05 09:45:20 +02:00
Thomas Haller
4e28bd5a94
find-backports: support "Ignore-Fixes:" tag to ignore "Fixes:" commit
"Ignore-Backport:" is already in use. For the find-backports script it
has the same meaning as a "cherry picked from" line, that means, we
assume that the referenced patch was backported already and the fix
applied.

This is of course useful to make the script shut up about backports that
we don't want to do. However, it requires us to tag the old branch
with this, so that the script thinks that the patch is already there.

Imaging we have a wrong commit on "next" branch with a Fixes line. We
don't want to backport it, so we would have to tag the "old" branch with
"Ignore-Backport:". That is cumbersome.

Instead, now also support that if a commit contains a "Fixes:" line any
an "Ignore-Fixes:" for the same fixed commit, then this let's the
"Fixes:" line be ignored.
2022-04-05 09:18:22 +02:00
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
1c76c11b42
doc: rename "README" to "README.md"
By having a ".md" extension, gitlab renders a nice page instead of
showing as plain text.

Currently our README is pretty bad. Partly, because it doesn't get
shown nicely.

Rename. The file effectively was already markdown. The old file is
gone.

For this we also need to change the automake flavor to "foreign"
(See [1]).

[1] https://autotools.info/automake/options.html#automake.options.flavors
2022-03-21 17:19:47 +01:00
Thomas Haller
85ceffceb9
contrib/rpm: don't package TODO file
Our TODO file is not well maintained. Don't package it.
2022-03-21 17:19:47 +01:00
Thomas Haller
c19b5d76c2
contrib: install "policykit-1" package on Debian
This is needed to get "/usr/share/gettext/its/polkit.its",
otherwise msgfmt will fail on Debian:

  /usr/bin/msgfmt: cannot locate ITS rules for data/org.freedesktop.NetworkManager.policy.in
2022-03-16 00:58:28 +01: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
Beniamino Galvani
b580741ef4 rpm: fix autotools build options for default plugins
Fixes: bb832641eb ('rpm: remove build-time default for plugins on newer distros')
2022-03-09 10:14:04 +01:00
Beniamino Galvani
50a6627fd7 rpm: split ifcfg-rh settings plugin into a separate package
Split the ifcfg-rh settings plugin into a separate package, so that it
will not be in new installations.

https://bugzilla.redhat.com/show_bug.cgi?id=2045875
2022-03-06 09:12:07 +01:00
Beniamino Galvani
bb832641eb rpm: remove build-time default for plugins on newer distros
On newer distros, remove the build-time default for settings
plugins. All plugins found in the plugin directory will be used.
2022-03-06 09:12:06 +01:00
Thomas Haller
df94cb2116
man: add NetworkManager-wait-online.service.8 manual
NetworkManager-wait-online is a constant source of confusion,
as it seems to delay the boot (when it's often just the messenger
or either a network problem, a NetworkManager misconfiguration
or a misconfiguration of other systemd services).

Try to clear that up with a manual page.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1130
2022-03-02 16:09:16 +01:00
Thomas Haller
5a5d9573e1
contrib: colorize releasing slave in NM-log 2022-02-23 17:07:16 +01:00
Lubomir Rintel
1cb4910841 rpm: drop %systemd_dir
There's a standard %_unitdir macro for this purpose, shipped with
systemd-rpm-macros.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1098
2022-02-22 16:38:54 +01:00
Lubomir Rintel
a7011be3d8 rpm: drop %sysctldir
It's not used anywhere.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1098
2022-02-22 16:38:54 +01:00
Thomas Haller
c87fbc9f6d
contrib/rpm: fix meson build to drop removed "json_validation" option
Recent meson versions treat unknown options as error and break now the
build. Good from them. This was an oversight.

Fixes: bbb1f5df2f ('libnm: always build libnm with JSON validation')
2022-02-21 19:49:29 +01:00
Thomas Haller
16a45d07ed
priv-helper: fix D-Bus patch to not contain forbidden character '-'
"-" is not allowed as D-Bus path and interface name, and discouraged as
bus name. This cause nm-priv-helper to crash, because GDBus asserts the
the object path is valid.

Replace the '-' with '_'. This way, it's consistent with
"nm_dispatcher".

Fixes: d68ab6b8f0 ('nm-sudo: rename to nm-priv-helper')
2022-02-09 18:47:14 +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
c6223c5a41
contrib/rpm: fix spec file for CentOS7/RHEL7 for "Suggests:"
Seems "Suggests:" is not supported.
2022-01-25 16:12:24 +01:00
Thomas Haller
3f0ec85634
contrib/rpm: split ifup/ifdown compat scripts to new package NetworkManager-initscripts-updown
Previously (on RHEL<=8 and Fedora<=35), NetworkManager package contains
the compat scripts nm-ifup/nm-ifdown.

If initscripts package (not network-scripts!) is installed, then a RPM
trigger links them as alternatives for the ifup/ifdown commands.

One problem is that `dnf provides /usr/sbin/ifup` lists the
NetworkManager package. Which is technically true, but on RHEL9 where
initscripts is not installed by default, `dnf install NetworkManager`
does not actually create those scripts.

Solve that by moving those scripts to a new subpackage
NetworkManager-initscripts-updown. The %post script now always creates the
alternatives links, regardless whether initscripts package is installed.

Note that on RHEL8, NetworkManager package not only Obsoletes: but also
Suggests: the new package.

The name "initscripts-updown" is chosen because in the future we might
have additonal initscripts/ifcfg related subpackages to contain the
ifcfg-rh plugin (NetworkManager-initscripts-ifcfg) or ifcfg-rh migration
tools (NetworkManager-initscripts-tools).

https://bugzilla.redhat.com/show_bug.cgi?id=2022418

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1061
2022-01-24 17:40:17 +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
Beniamino Galvani
d68ab6b8f0 nm-sudo: rename to nm-priv-helper
The name "nm-sudo" reminds of the "sudo" tool, and this is a bit
confusing because it's not related. Rename the service to
"nm-priv-helper", which stands for "NM privileged helper".

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/938
2022-01-11 21:46:55 +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
James Hilliard
edc37b3adf
build: allow configuring default for wifi.backend setting
Distributions may want to change the default wifi.backend, if for
example they are building without wpa_supplicant support.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/869

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1040
2022-01-04 06:41:37 +01:00
Thomas Haller
081510ed94 gitlab-ci: use Fedora 35 as default build target 2021-11-29 09:31:09 +00:00
Thomas Haller
58287cbcc0 core: rework IP configuration in NetworkManager using layer 3 configuration
Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3
manager for the IP configuration of an interface. Use NML3ConfigData as
pieces of configuration that the various components collect and
configure. NMDevice is managing most of the IP configuration at a higher
level, that is, it starts DHCP and other IP methods. Rework the state
handling there.

This is a huge rework of how NetworkManager daemon handles IP
configuration. Some fallout is to be expected.

It appears the patch deletes many lines of code. That is not accurate, because
you also have to count the files `src/core/nm-l3*`, which were unused previously.

Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
2021-11-18 16:21:29 +01:00
Ana Cabral
8b697c2e36 spec: Update for backwards compatibility 2021-11-15 09:44:06 +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
Ana Cabral
76fb08b1bd spec file: Update NetworkManager post scriptlet
There is a mix of new /usr/lib/systemd/libsystemd-shared-239.so
(systemd-libs rpm) and old /usr/bin/udevadm (systemd-udev rpm) on
the system at the point NetworkManager's post scriptlet is run,
what causes warning messages when updating NetworkManager's version.
This commit fixes this.

https://bugzilla.redhat.com/show_bug.cgi?id=2012123
2021-11-02 12:47:33 +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
414d2c1d4b
contrib,gitlab-ci: fix "contrib/fedora/REQUIRED_PACKAGES" to install "vala"
Fixes: 53562b1915 ('contrib: remove "vala-tools" from "contrib/fedora/REQUIRED_PACKAGES"')
2021-08-30 16:45:24 +02:00
Thomas Haller
53562b1915
contrib: remove "vala-tools" from "contrib/fedora/REQUIRED_PACKAGES"
Since Fedora 25, vala-tools was merged with "vala" package. And on
rawhide (f36) it's gone completely and leads to a failure of the script.

Drop it.
2021-08-30 11:39:01 +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
c8d80f332d
contrib/makerepo: fix detection of centpkg for git+ssh:// remotes 2021-08-20 11:43:33 +02:00
Thomas Haller
41937748d8
contrib: add "makerepo.sh" script
"makerepo.sh" script is a helper script for handling dist-git
repositories. It was so far part of "automation" branch. It seems
useful enough to officially add it to "main" branch.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/944
2021-08-02 09:56:44 +02:00
Thomas Haller
f137b32d31
sudo: introduce nm-sudo D-Bus service
NetworkManager runs as root and has lots of capabilities.
We want to reduce the attach surface by dropping capabilities,
but there is a genuine need to do certain things.

For example, we currently require dac_override capability, to open
the unix socket of ovsdb. Most users wouldn't use OVS, so we should
find a way to not require that dac_override capability. The solution
is to have a separate, D-Bus activate service (nm-sudo), which
has the capability to open and provide the file descriptor.

For authentication, we only rely on D-Bus. We watch the name owner
of NetworkManager, and only accept requests from that service. We trust
D-Bus to get it right a request from that name owner is really coming
from NetworkManager. If we couldn't trust that, how could PolicyKit
or any authentication via D-Bus work? For testing, the user can set
NM_SUDO_NO_AUTH_FOR_TESTING=1.

https://bugzilla.redhat.com/show_bug.cgi?id=1921826
2021-07-26 15:31:46 +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
62141eb938
contrib/release: print better URL for gitlab-ci pipelines 2021-06-30 17:32:39 +02:00
Thomas Haller
e06261471c
release: fix release script for relative paths 2021-06-30 16:27:01 +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
Beniamino Galvani
6ac21ba916 core: add infrastructure for spawning a helper process 2021-06-11 21:43:12 +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
e831a67cbc
contrib/rpm: configure defaults for iptables/nftables when generating distribution tarball 2021-06-08 17:40:17 +02:00
Thomas Haller
ff922f89f4
contrib/rpm: update comments in default NetworkManager.conf
Changing "NetworkManager.conf" is problematic, because the package management
system will detect if the user modified the file and leave .rpmnew files (or
similar).

Still, we only recently modified the file already to mention Libera.Chat.
So now is the time for more rewording.
2021-06-01 09:35:07 +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
7e581a0303
Revert "contrib: no longer install libuuid as build dependency"
Ups, we actually still require libuuid. Actually, we only need to
to build the example script `examples/C/glib/add-connection-gdbus.c`.
The proper solution would be to make this an optional dependency.

So far this was not yet done. Also, libuuid is really an ubiquitous
dependency on Linux, so it's not really a problem to have this build
dependency, even if it's just to build the examples.

This reverts commit c0a3947ff9.
2021-05-26 22:16:35 +02:00
Thomas Haller
c0a3947ff9
contrib: no longer install libuuid as build dependency
We no longer need it. Only for build.sh script we require `uuidgen`
from util-linux package.
2021-05-26 19:25:41 +02:00
Thomas Haller
95085acec3
update references from "freenode" to "Libera.Chat" 2021-05-25 11:09:37 +02:00
Thomas Haller
847d6b31d4
contrib/rpm: remove "Obsoletes: NetworkManager-{atm,bt}"
These subpackages existed before commit 886366d0fd ('contrib/rpm:
update spec file after renaming NM plugins') (2014, before 0.9.9.95).

rpm warns about unversioned obsoletes like:

  It's not recommended to have unversioned Obsoletes: Obsoletes: NetworkManager-atm
  It's not recommended to have unversioned Obsoletes: Obsoletes: NetworkManager-bt

These packages are so long gone by now, let's just drop the Obsoletes.
2021-05-21 09:58:16 +02:00
Thomas Haller
871faa3ba7
contrib/rpm: remove "Obsoletes: dhcdbd"
"dhcdbd" is gone since 2007. Drop it. Also, rpm doesn't really like
unversioned obsoletes and warns:

    It's not recommended to have unversioned Obsoletes: Obsoletes: dhcdbd
2021-05-21 09:34:47 +02:00
Thomas Haller
f215c9a7fa
contrib/rpm: don't have build dependency for iptables
We really only require "iptables" as build dependency to autodetect the
path where iptables is installed. On Fedora/RHEL, this is always /usr/sbin,
so we can just as well hard code this.

Alternatively, if the autodetection is really necessary, we would also require
a build dependency on /usr/sbin/nft. That seems a waste.
2021-05-21 09:34:46 +02:00
Thomas Haller
199807b2ec
contrib/rpm: add rhel-8 specific libndp dependeny 2021-05-21 09:34:46 +02:00
Thomas Haller
af40a14556
contrib/rpm: %ghost "/etc/NetworkManager/VPN"
"/etc/NetworkManager/VPN" was historically the place for .name files for
VPN plugins. In the meantime, those should be under "/usr/lib/NetworkManager/VPN".

Still, NetworkManager honors (and possibly watches) the directory in
/etc. Mark the directory as %ghost.

The exact effect of this is not clear to me. It seems however right to
do, and works for my testing.
2021-05-12 13:36:19 +02:00
Thomas Haller
40c78fe699
contrib/rpm: obsolete "config-routing-rules" package with fixed version
Since commit a447942fc0 ('contrib/rpm: rename package
"NetworkManager-config-routing-rules" to
"NetworkManager-dispatcher-routing-rules"'), the config-routing-rules
subpackage is gone.

This way to specify the version number with a variable parameter, causes
repeated messages in rpmdiff:

    INFO  NetworkManager-dispatcher-routing-rules  changed from Obsoletes: NetworkManager-config-routing-rules < 1:1.32.0-0.2.el8 to Obsoletes: NetworkManager-config-routing-rules < 1:1.32.0-0.3.el8 on noarch

Avoid this by hard coding the obsoleted version.
2021-05-12 13:35:37 +02:00
Thomas Haller
9e3b7b2e99
contrib/rpm: let NetworkManager-libnm package conflict with exact NetworkManager-glib version
This "Conflicts" is since commit b85b8ed6fa ('contrib/rpm: let
NetworkManager-libnm and NetworkManager-glib of differing version
conflict'). This was probably fine back then, but NetworkManager-glib is
long gone.

Also, not hard coding the version number leads to rpmdiff messages like:

  NEEDS INSPECTION  NetworkManager-libnm  changed from Conflicts: NetworkManager-glib < 1:1.32.0-0.2.el8 to Conflicts: NetworkManager-glib < 1:1.32.0-0.3.el8 on all architectures

As NetworkManager-glib is long gone, hard code the version with which
we conflict.
2021-05-12 13:35:28 +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
94ba38962f
contrib: install clang-format via REQUIRED_PACKAGES
On Fedora 33, we get it automatically because "clang" package
has an indirect (weak) dependency for clang-tools-extra. On
Fedora 34, that is no loger the case.

We need to explicitly install it.
2021-05-04 13:56:19 +02:00
Beniamino Galvani
aaed69e5d7 contrib/rpm: install D-Bus service files to /usr in RHEL8
When supported by the D-Bus daemon, it's better to have service files
in /usr rather than in /etc. Change the path for RHEL 8.

See also commit ef8c292881 ('contrib/rpm: install D-Bus service
files to /usr if we can').
2021-04-30 17:00:50 +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
edd9521fef
contrib/rpm: fix reference to main branch in NetworkManager.spec 2021-04-01 22:29:00 +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
1db34e4fb1
contrib/release: update release.sh script to use "main" branch name 2021-04-01 21:38:17 +02:00
Thomas Haller
9c0c0ac966
man: split NetworkManager-dispatcher(8) manual page out of NetworkManager(8)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/784
2021-03-16 17:01:53 +01:00
Thomas Haller
fb66bb2bcb
CONTRIBUTING: rename file to have .md extension
We should write our CONTRIBUTING files in markdown syntax, because
it's nice to read a plain text and gets nicely rendered.

However, if the file doesn't have a ".md" extension, gitlab's
web interface shows it as plain text file.

Rename the file.

This possibly breaks links like [1], but referring to a branch name
(and not a commit ID or a tag) is anyway fragile. Hence, I don't try
to fix that by adding a symlink or similar, because I think that just
makes it more confusing.

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/master/CONTRIBUTING
2021-03-16 14:00:01 +01: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
Thomas Haller
3906cc9cf4
build: move c-util/nettools library from "shared/" to "src/" 2021-02-24 12:48:28 +01:00
Thomas Haller
a8c34b9dcf
build: move "shared/nm-std-aux" to "src/libnm-std-aux" 2021-02-24 12:48:24 +01:00
Thomas Haller
39225258d6
build: move "shared/systemd" to "src/libnm-systemd-shared" 2021-02-24 12:48:16 +01:00
Thomas Haller
04290879b7
release: fix pattern in release.sh script for checking branch name 2021-02-18 17:53:15 +01:00
Thomas Haller
8c04f72e36 contrib/rpm: update URL for NetworkManager in RPM package
The previous URL http://www.gnome.org/projects/NetworkManager/
now redirects to https://wiki.gnome.org/Apps, which isn't very
useful.

Instead, link to our NetworkManager page. The page is still sparsely
populated, but we should improve that.
2021-02-16 11:29:24 +01:00
Thomas Haller
e23bafe5d5
contrib/rpm: revert building "--with test" for RHEL 9
"--with test" does two things:

(1) it enables "-Werror" compiler option. We always enable all
    compiler warnings we care about, but this option makes all
    warnings fatal.
    Compiler warnings depend on compiler version and build options.
    It's hard to build without any compiler warnings, in particular
    for *future* compiler versions which we don't know yet. It
    is desirable that a SRPM from yesterday can also be build
    tomorrow.

(2) it fails build if any unit tests fail. We always run all
    unit tests, but "--with test" makes it fatal. Again, we
    have many unit tests that interact with the system (that is,
    make system calls, like creating IP addresses or write files).
    It is surprisingly hard to get them pass 100% on all the systems
    we care. For example, on copr a test setup randomly fails during

         ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
         nm_utils_ifname_cpy(ifr.ifr_name, TEST_IFNAME);
         r = ioctl(fd, TUNSETIFF, &ifr);

    It's not clear why, nor is it at all clear that there is a bug
    in NetworkManager. Making tests fatal basically means that a build
    on copr infrastructure fails with a probability from a few percent.
    Enough to be seriously annoying.

Note that on copr we actually build "--with test", because we want to catch these
issues. Likewise for our CI builds we explicitly specify "--with test".

In general, we build with various build configurations (compiler warnings)
and run unit tests on a source package many times. Starting on the
developer machine (`make check`), gitlab-ci, copr builds,
NetworkManager-ci. If you build an SRPM with such sources, a failure
of the unit tests is much more likely a glitch than an actual issue.

This is about changing the default if you build a Fedora/RHEL package.
That is with the Fedora/RHEL packages that are build in koji/brew.

Well, at least usually. In practice, we don't build frequently on non
x64_86 archs, so what I said there is less true. But the package build
is not there to replace CI/testing. The package build is there to get
a (mostly) working binary.

Note that RHEL packages anyway go through rpmdiff too, and rpmdiff
parses the build log and complain if `make check` fails.

This reverts commit e68e5c0a4c.
2021-02-12 13:35:24 +01:00
Thomas Haller
d5bf957387
contrib/release: fix release script after moving src directory 2021-02-08 10:26:03 +01:00
Thomas Haller
ac1a9e03e4
all: move "src/" directory to "src/core/"
Currently "src/" mostly contains the source code of the daemon.
I say mostly, because that is not true, there are also the device,
settings, wwan, ppp plugins, the initrd generator, the pppd and dhcp
helper, and probably more.

Also we have source code under libnm-core/, libnm/, clients/, and
shared/ directories. That is all confusing.

We should have one "src" directory, that contains subdirectories. Those
subdirectories should contain individual parts (libraries or
applications), that possibly have dependencies on other subdirectories.
There should be a flat hierarchy of directories under src/, which
contains individual modules.

As the name "src/" is already taken, that prevents any sensible
restructuring of the code.

As a first step, move "src/" to "src/core/". This gives space to
reorganize the code better by moving individual components into "src/".

For inspiration, look at systemd's "src/" directory.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/743
2021-02-04 09:45:55 +01:00
Thomas Haller
1ccbae6e4e
contrib/rpm: add "enabled=true" key to "20-connectivity-{fedora,redhat}.conf"
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/649
2021-02-02 14:02:31 +01:00
Thomas Haller
7869aacf61
gitlab-ci: skip valgrind on Debian/sid with glib2.0 (2.66.4-2)
See-also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1902#note_1018573
2021-01-28 14:50:32 +01:00
Thomas Haller
eafa96c06a
contrib/spec: let NetworkManager-wifi depend on wireless-regdb/crda
Based-on-patch-by: Peter Robinson <pbrobinson@gmail.com>

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/7
2021-01-18 12:22:07 +01:00
Thomas Haller
a326c30110
contrib/rpm: fix packaging "/usr/share/man/man8/nm-cloud-setup.8.gz" in "NetworkManager"
nm-cloud-setup is provided by sub-package "NetworkManager-cloud-setup",
which also has the manual page. The main package "NetworkManager" should
not also contain the manual page.
2021-01-15 17:51:20 +01:00
Tom Stellard
d19a13e4b1
contrib/rpm: use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/4

8f93680134
2021-01-15 17:25:19 +01:00
Jonathan Lebon
a1d9a79228
contrib/rpm: don't trigger udev if socket doesn't exist
On rpm-ostree systems, we don't want scriptlets to affect the running
system because a major part of the value is "background updates".
Scriptlets are run in a containerized environment where e.g. udev is not
available.

Add a check for the udev socket before triggering it to handle this.
This also helps the container use case.

This doesn't break rpm-ostree strictly, because it uses `|| :`, but it
still spams error messages during the compose. I kept the `|| :` to be
safe, but it's likely fine to remove them now.

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1352154
See-also: https://src.fedoraproject.org/rpms/udisks2/pull-request/3
See-also: https://github.com/coreos/fedora-coreos-tracker/issues/703

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/6
2021-01-14 22:46:35 +01:00
Thomas Haller
9ba8c32dac
contrib/rpm: add "BuildRequires: make" to SPEC file
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-14 22:17:34 +01:00
Thomas Haller
8e735a51b8
contrib: handle no files in "nm-code-format.sh"
Calling `clang-format` with no files means to read
stdin, it thus hangs:

   $ ./contrib/scripts/nm-code-format.sh .git

Also, the following does not work:

   $ ./contrib/scripts/nm-code-format.sh src/platform/

hangs. Seems there is a bug in `git ls-files` to not list all files:

   podman run -ti alpine:latest \
      sh -c '
         apk add git &&
         git clone https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git &&
         cd NetworkManager &&
         git checkout -B tmp cd754680a6 &&
         echo ">>>>>>BAD1: $PWD" &&
         git ls-files -- src/platform/ ":(exclude)shared/n-acd"
         echo ">>>>>>GOOD1: $PWD" &&
         git ls-files -- src/platform/ ":(exclude)shared/c-list"
         echo ">>>>>>GOOD2: $PWD" &&
         git ls-files -- src/platform ":(exclude)shared/n-acd"
         echo ">>>>>>GOOD3: $PWD" &&
         git ls-files -- src/vpn/ ":(exclude)shared/n-acd"
      '

Fixes: 9bef4ece92 ('contrib: improve nm-code-format.sh script')
2021-01-13 16:49:09 +01:00
Thomas Haller
9bef4ece92
contrib: improve nm-code-format.sh script
- accept directory names in the command line. In that case,
  still honor the excluded files. That is a major improvement
  for me, because I usually only want to reformat a directory
  that I know has changed and it is fast to only process some
  directories.

- pass all files at once to clang-format. For me that gives
  a significant speed improvement (about 3 times faster), although
  clang-format is only single threaded. Possibly clang-format could
  even be faster by checking files in parallel.
  In case of a style error, the script still falls back to
  iterate over all files to find the first bad file and print
  the full diff. But that is considered an unusual case.

- make it correctly work from calling it from a subdirectory.
  In that case, we only check files inside that directory --
  but still correctly honor the excluded files.
2021-01-13 12:57:48 +01:00
Thomas Haller
d26fa1cd52
contrib: fix "contrib/scripts/nm-copr-build.sh" script 2021-01-12 14:53:00 +01:00
Thomas Haller
1277e4c882
contrib: add "contrib/scripts/nm-copr-build.sh" script
This will be the script used by our copr repositories ([1]) for building
the SRPM of NetworkManger from git.

[1] https://copr.fedorainfracloud.org/coprs/networkmanager/
2021-01-12 14:28:23 +01:00
Thomas Haller
55e4b0ea9c
contrib: add "contrib/scripts/nm-copr-build-nm-git-bundle.sh" script 2021-01-12 13:16:17 +01:00
Thomas Haller
344fd187cd
checkpatch: update check for SPDX license identifier tag 2021-01-05 09:46:24 +01:00
Thomas Haller
977ea352a0
all: update deprecated SPDX license identifiers
These SPDX license identifiers are deprecated ([1]). Update them.

[1] https://spdx.org/licenses/

  sed \
     -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \
     -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \
     -i \
     $(git grep -l SPDX-License-Identifier -- \
         ':(exclude)shared/c-*/' \
         ':(exclude)shared/n-*/' \
         ':(exclude)shared/systemd/src' \
         ':(exclude)src/systemd/src')
2021-01-05 09:46:21 +01:00
Thomas Haller
d1f8e843d5
shared: don't clang-format "shared/nm-std-aux/unaligned.h"
"shared/nm-std-aux/unaligned.h" is taken from systemd and frequently
re-imported via the "systemd" branch.

It is not our code, and should not be formatted with our clang-format.
2021-01-05 09:37:02 +01:00
Thomas Haller
826f208319
gitlab-ci: skip valgrind tests on Alpine Linux
We don't have debug symbols, so valgrind suppressions don't work.
Skip those checks.
2020-12-23 10:48:27 +01:00
Thomas Haller
81e0837678
gitlab-ci: install missing packages on Alpine Linux
The "contrib/alpine/REQUIRED_PACKAGES" script is also
used by gitlab-ci to setup the test container. These
packages are required for unit tests.
2020-12-23 10:48:26 +01:00
Thomas Haller
a1002bd93a
gitlab-ci: enable test build on alpine linux
Alpine is especially interesting because it uses musl as libc.

The build does not yet succeed. There are several issues that
need to be fixed.

However, it will be simpler to fix things, if we have tests
in place -- even if at the moment they are known to be broken.

See-also: https://git.alpinelinux.org/aports/tree/community/networkmanager?h=master
2020-12-11 18:14:10 +01:00
Thomas Haller
a4f1fa0893
man: add man 8 nm-cloud-setup
https://bugzilla.redhat.com/show_bug.cgi?id=1867997
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ ## 600
2020-12-11 17:36:38 +01:00
Thomas Haller
d07cd5dbf2
all: avoid GNU "which" from shell scripts
"which" is a separate package and may not be installed.
Also, shell has a built-in command for the same purpose.
Use that.
2020-12-11 16:42:23 +01:00
Thomas Haller
ae5ea7fa62
contrib/release: check NEWS file before release 2020-12-06 16:03:34 +01:00
Thomas Haller
c9898dc9ae
contrib/rpm: update default for main.plugins setting in NetworkManager.conf
With Fedora 33+ and RHEL 9+, the default plugins are
"plugins=keyfile,ifcfg-rh", instead of "plugins=ifcfg-rh,keyfile".

Update our "NetworkManager.conf" file to reflect that.
2020-12-06 11:23:46 +01:00
Thomas Haller
a3f2cee0e6
contrib/rpm: support default options for debug,test in generated spec file
"build_clean.sh" (and "build.sh") scripts can both create a source
tarball (via `make dist`/`make distcheck`), an SRPM (and a spec file),
or build RPMs from the SRPM.

Note that the generated spec file has various options, like

    %bcond_without nmtui
    %bcond_without debug
    %bcond_without test

When building an RPM from the SRPM, you can specify the "--with" or
"--without" option for rpmbuild. This is also what the "-w" / "-W" options
for "build_clean.sh" do.

However, the SRPM still has the intrinsic defaults, and if you later
build an RPM from it, you would have to pass "--with" / "--without"
to rpmbuild.

Often that is not conveniently possible, for example, when you build the
SRPM in koji.

Extend the scripts so that also the defaults for "-w debug" and "-w
test" can be specified when generating the SRPM. You can do that with
the new options "--default-for-{debug,test}" to "build_clean.sh".

Alternatively, it suffices to specify the previously supported
"-w" / "-W" options. That way, we will pass those options to rpmbuild,
but also set them as defaults in the generate spec file. The new
options "--default-for-{debug,test}" are only needed if you want
the default in the spec file to be different then what you use
when creating the SRPM.
2020-12-03 17:38:06 +01:00
Thomas Haller
3bf367594a
contrib/rpm: add "--no-auto-with-test" option for "build_clean.sh" script
By default, "build_clean.sh" script likes to automatically add "-w test"
-- unless the user specified "-w test" or "-W test" on the command line.

That is mostly fine. However, the spec file has an internal default for the
"test" option. So if you want to use the default that gets determined
by the spec file, then we should suppress that automatism.
2020-12-03 17:34:01 +01:00
Thomas Haller
a8ead4a4c3
contrib/rpm: drop no longer supported "--enable-json-validation" from configure
Fixes: bbb1f5df2f ('libnm: always build libnm with JSON validation')
2020-12-03 17:31:30 +01:00
Thomas Haller
e68e5c0a4c
contrib/rpm: on rhel-9 let a test failure or compiler warning fail the build
We always run the unit tests during package build and also enable all compiler
warnings. However, by default we used to ignore failures. That is, because
rebuilding a package on another, future distro led to frequent, annoying build
failures. Especially compiler warnings appear easily when using a
different compiler version.

The default mostly matters here when you want to build the package in
brew/koji, where you don't have a possibility to explicitly select the
build option.

Note that rpmdiff detects failures in the build log, and thus we usually
would not miss failures for builds we add to errata. Also, all our CI
tests build packages with a manner where they would not allow a failure
of the unit tests. So, we run these unit tests frequently and in a
manner where we notice a failure.

For rhel-9 builds, change the default here and let test failures and
compiler warnings be fatal to the build.
2020-11-26 18:31:46 +01:00
Thomas Haller
87749642e2
scripts: allow marking commits with "Ignore-Backport:" in "find-backports" script
"find-backports" searches commit messages of upstream branches for
"Fixes:" comments. Those will then be highlighted to be backported,
if the script determines that to be necessary.

"find-backports" also honors the "cherry picked from" comments, to detect when
a patch was already backported. That is thus a way to suppress reporting a
commit to be backported.

Add another way to flag commits so they don't need backporting. Via
"Ignore-Backport:" tag.

As "find-backports" also honors "refs/notes/bugs" notes, this can be used
like:

    git notes \
      --ref refs/notes/bugs \
      append \
      -m "Ignore-Backport: e""29f00fa0c69 ('NEWS: fix entry that is targeted for 1.30 instead of 1.28')" \
      2''3364aa8f3bd6b11e2ac9e30117eaabfe1f3a9f2
2020-11-24 12:30:06 +01:00
Thomas Haller
869ff96ad1
contrib/checkpatch: fix shallow repository for checkpatch script
The checkpatch test tests the patches on the merg-request, as they
branch off from master (or one of the stable branches).

It thus need the full git history, but the git repository might be a
shallow clone. Fix it.
2020-11-10 18:23:36 +01:00
Thomas Haller
45cb0ef403
contrib/checkpatch: use random name for git remote and clean up afterwards 2020-11-10 17:14:07 +01:00
Thomas Haller
d6cbbbcad3
contrib: install "udev" package with "debian/REQUIRED_PACKAGES"
"debian/REQUIRED_PACKAGES" is used by gitlab-ci to prepare the image. We require
"udev" package, if only to install "/usr/share/pkgconfig/udev.pc" to get the
udev directory.

Otherwise build fails with:

    Run-time dependency udev found: NO (tried pkgconfig)
    meson.build:371:2: ERROR: Dependency "udev" not found, tried pkgconfig
2020-11-10 13:51:29 +01:00
Thomas Haller
a51d17cffa
contrib: install "python{3,}-setuptools" package with "debian/REQUIRED_PACKAGES"
Odd, sometimes gitlab CI fails to use pip3 install, because setuptools
module is not installed. But only sometimes...

Explicitly install it.
2020-11-10 13:51:29 +01:00
Thomas Haller
9c3cfebe14
contrib: fix failure for "fedora/REQUIRED_PACKAGES" on CentOS 8 for "black"
Fixes: 86d3022ef5 ('contrib: add xargs/black/clang packages to fedora/REQUIRED_PACKAGES')
2020-11-09 15:48:29 +01:00
Thomas Haller
86d3022ef5
contrib: add xargs/black/clang packages to fedora/REQUIRED_PACKAGES
These packages are also used during CI tests (in the checkpatch
stage). They are also used for formatting C/python code, and thus
useful for developing.

Install them as part of REQUIRED_PACKAGES script.
2020-11-09 10:51:26 +01:00
Thomas Haller
affff881e2
contrib/release: check whether access to master.gnome.org works before publishing release 2020-11-02 18:51:45 +01:00
Thomas Haller
6677480a2d
checkpatch: ignore warning about g_assert*() also for files like "shared/nm-utils/nm-test-utils.h" 2020-10-22 09:29:28 +02:00
Thomas Haller
53bd66b540
contrib/release: fix parsing version in "release.sh" script 2020-10-19 20:50:35 +02:00
Thomas Haller
d7f6fb8378
contrib/release: improve help text for "release.sh" script 2020-10-19 20:43:52 +02:00
Thomas Haller
fdeb960087
contrib/release: use "find-backport" scripts from release.sh 2020-10-19 20:35:51 +02:00
Thomas Haller
57cfa5daf9
contrib: add "find-backports" script
This script was previously on the "automation" branch. Add it to
"master".
2020-10-19 20:34:06 +02:00
Thomas Haller
96a3d664cb
contrib/checkpatch: complain about patch format with "Reverts:" tag 2020-10-09 15:55:48 +02:00
Thomas Haller
f9517c7fbb
build/release: before release check that all gitlab-ci tests ran successfully 2020-10-06 15:47:29 +02:00
Thomas Haller
53a56a5106
build/travis: remove travis integration
We already build a large variety of configurations in gitlab-ci,
we don't need yet another configuration to run tests on travis-ci.
Also, because the travis-ci setup is outdated and we don't look
at it. Let's focus on gitlab-ci instead.
2020-10-05 23:18:12 +02:00
Thomas Haller
5e83bac5aa
contrib/release: restore original branch in dry-run mode
In dry-run mode, reset the branch to the state where it was before.

Also, in real mode delete the temporary "release-branch" branch on
success.
2020-10-05 19:35:04 +02:00
Thomas Haller
36b761fcaa
contrib: add "nm-code-format-container.sh" to reformat working directory in container
We use clang-format to format our code, and the exact format depends on
the clang version. Currently we use clang-11, as packaged in Fedora 33.

Add a script that runs a Fedora 33 container with podman and reformats
the current working directory.

Usage:

  ./contrib/scripts/nm-code-format-container.sh
2020-09-29 13:37:58 +02:00
Thomas Haller
8435deecfa
contrib: let "nm-code-format.sh" handle files under ./{shared,src}/systemd/
Only the files under ./{shared,src}/systemd/src are copied from systemd.
The other files should be reformatted too.
2020-09-28 20:01:23 +02:00
Thomas Haller
419be5d0e7
checkpatch.pl: adjust checking for indentation/tabs
Our new format gets enforced by clang-format, and we now only use
four space indentation, instead of tabs.

Adjust the checkpatch script to account for that.

Also, now there are probably no cases left where we want to see any
tabs in our sources. Complain about any tabs we find.
2020-09-28 15:08:41 +02:00
Thomas Haller
bad4065d67
contrib/release: implement "rc1" release mode 2020-09-23 08:58:47 +02:00
Thomas Haller
991999489a
contrib/build: reword howto for "release.sh" script 2020-09-14 16:11:54 +02:00
Antonio Cardace
eebed47257
contrib: add git-hook to verify code-style
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-02 19:20:40 +02:00
Antonio Cardace
5119d00374
scripts: better error message for nm-code-format.sh
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-02 19:20:36 +02:00
Antonio Cardace
715392a45e
scripts: add script to format codebase using clang-format
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-02 17:31:42 +02:00
Thomas Haller
6b63b68a41
contrib: accept missing .sig file for older releases in "release.sh"
On older branches, the build script does not create a GPG signature of
the release tarball. Let the release script be graceful against that.
2020-08-31 13:20:24 +02:00
Thomas Haller
12e8557476
gitlab-ci: fix workarounds for Ubuntu 16.04 in tests
The detection for Ubuntu 16.04 was broken. By now /etc/os-release
contains

    VERSION="16.04.7 LTS (Xenial Xerus)"
2020-08-28 14:24:32 +02:00
Thomas Haller
c1f9a0fff1
dns: add new "rc-manager=auto" mode
Add a new `main.rc-manager=auto` setting, that favours to use
systemd-resolved (and not touch "/etc/resolv.conf" but configure
it via D-Bus), or falls back to `resolvconf`/`netconfig` binaries
if they are installed and enabled at compile time.
As final fallback use "symlink", like before.

Note that on Fedora there is no "openresolv" package ([1]). Instead, "systemd"
package provides "/usr/sbin/resolvconf" as a wrapper for systemd-resolved's
"resolvectl". On such a system the fallback to resolvconf is always
wrong, because NetworkManager should either talk to systemd-resolved
directly or not but never call "/usr/sbin/resolvconf". So, the special handling
for resolvconf and netconfig is only done if NetworkManager was build with these
applications explicitly enabled.

Note that SUSE builds NetworkManager with

    --with-netconfig=yes
    --with-config-dns-rc-manager-default=netconfig

and the new option won't be used there either. But of course, netconfig
already does all the right things on SUSE.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=668153

Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-08-24 21:13:21 +02:00
Thomas Haller
2c12786e3d
contrib/rpm: enable LTO by default on RHEL-9 and newer 2020-08-18 23:00:20 +02:00
Thomas Haller
839ba57c7f
contrib/rpm: enable LTO by default on Fedora 33
With Fedora 33, LTO will be enabled by default via CFLAGS in
redhat-rpm-config ([1]).

That basically sets "CFLAGS=-flto -ffat-lto-objects".

Note that we have our own configure/meson option to enable LTO.
With "--with-lto" we set CFLAGS="-flto -flto-partition=none". This
is necessary due ([2], [3]).

So, disable Fedora's automatism, but turn on the suitable configure
option to get working LTO.

[1] 5baaf4a99c
[2] e6cf4213a7 ('build: fix building with LTO')
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
2020-08-17 15:20:08 +02:00
Thomas Haller
67cc4544f7
scripts: use "/bin/cat" in NM-log
Ubuntu 16.04 doesn't have merged /usr directories and cat is in
/bin/cat.
2020-08-17 10:58:19 +02:00
Thomas Haller
6c6a00eae5
contrib: use new "find-backports" script in "release.sh" 2020-08-05 00:24:40 +02:00
Thomas Haller
3e475e5cd1
contrib/rpm: prefer keyfile settings plugin from Fedora 33 and newer
This change is for Fedora 33 and newer. For now, also enable it for RHEL
9 and newer, but it must still be decided whether that will be done
there as well.

https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00002.html
https://fedoraproject.org/wiki/Changes/NetworkManager_keyfile_instead_of_ifcfg_rh
https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://pagure.io/fesco/issue/2432

https://bugzilla.redhat.com/show_bug.cgi?id=1857391
2020-07-16 12:28:03 +02:00
Thomas Haller
aa4cb0e5eb
contrib: improve code comments to release.sh scripts 2020-07-13 23:54:34 +02:00
Thomas Haller
5542275672
contrib: add "major-post" step for release.sh script 2020-07-13 23:28:05 +02:00
Thomas Haller
c3b04c4fd9
contrib: support "major" release in release.sh script 2020-07-13 18:05:32 +02:00
Thomas Haller
ae626ade0f
contrib: consistency check meson.build in release script 2020-06-30 13:57:15 +02:00
Thomas Haller
66651d5660
contrib: improve release script with howto comments and help option 2020-06-30 13:36:42 +02:00
Thomas Haller
53bb23b403
build: for signing use key from git's user.signingkey 2020-06-29 09:08:04 +02:00
Thomas Haller
0748bd989d
release: cleanup temporary release-branch and avoid prompt for ftpadmin install 2020-06-28 19:16:20 +02:00
Thomas Haller
99f834842a
release: fix "rc" release build and add option to suppress check for local branches 2020-06-28 19:02:07 +02:00
Thomas Haller
7f93fd8e7b
release: fix RC_VERSION for release script
The release candidate -rc1 has version "1.y.90", -rc2 has "1.y.91", and so
on. Fix the script.
2020-06-28 18:35:03 +02:00
Thomas Haller
8e9e6fd024
release: fix release script for "rc" 2020-06-28 18:06:17 +02:00
Thomas Haller
ccac506a8a
build: print deleted references in release.sh script 2020-06-04 13:17:57 +02:00
Thomas Haller
61b9201898
build: print commands in color for release.sh script 2020-06-04 12:31:39 +02:00
Thomas Haller
207fd8dfb1
build: implement release mode "rc" in release.sh script
Still not implemented are the first release candidate (rc1)
and the major release.
2020-06-04 11:54:31 +02:00
Thomas Haller
bbb95c979e
build: optionally sign source tarball in build.sh script
This defaults to $DO_RELEASE. In that case, the script will also GPG sign
the source tarball.

The purpose is that when we do a release we want to ensure that the
published tarball is really the one that we generated. In that case,
the SHA sum would suffice, however that requires you to manually note
it down and compare the result. With the gpg signature, that
verification can be better automated.
2020-06-04 11:33:00 +02:00
Thomas Haller
0ac05a3faa
build: add "release.sh" script
Currently only "minor" and "devel" releases are implement. It's also not yet
tested with --no-dry-run, because that would actually create a release.

Test it when using it the next time.
2020-06-04 10:51:12 +02:00
Thomas Haller
b4fb2a4f94
contrib/rpm: remove trailing whitespaces from spec file 2020-05-29 17:06:59 +02:00
Beniamino Galvani
53aa5bd207 platform: add tc tests 2020-05-28 17:25:31 +02:00
Beniamino Galvani
016a82e6dd contrib/rpm: enable the firewalld zone in F32 and RHEL8 2020-05-15 19:06:24 +02:00
Thomas Haller
8d2f6dfe38
contrib/rpm: no longer mention that libnm is "new API"
libnm was introduced in version 1.0, December 2014. It's
no longer new, and libnm-glib is forgotten.
2020-05-14 17:21:12 +02:00
Thomas Haller
350681e7f1
contrib/rpm: enable undefined-sanitizer libubsan on RHEL-8 2020-05-14 12:19:34 +02:00
Thomas Haller
b846f9aba3
gitlab-ci: optionally install libasan,libubsan via REQUIRED_PACKAGES script 2020-05-14 12:03:24 +02:00
Thomas Haller
1473f00d74
gitlab-ci: accept failure in REQUIRED_PACKAGES script for non-existing qt-devel
On CentOS 8, many devel packages are not available. Even after

  # dnf config-manager --set-enabled PowerTools

certain devel packages are missing. Some of these (libndp-devel,
mobile-broadband-provider-info-devel, teamd-devel) we build in copr
([1]), but libpsl-devel and qt-devel are still missing.

Only install them optionally and allow failure for them not being
present.

[1] https://copr.fedorainfracloud.org/coprs/nmstate/nm-build-deps/repo/epel-8/nmstate-nm-build-deps-epel-8.repo
2020-05-14 12:03:24 +02:00
Thomas Haller
3f6f7b06c6
contrib/rpm: log MD5/SHA sums of release tarball during build_clean.sh
When doing a release, we should care about the checksum of the tarball.
Log all of them... also, because fedpkg uses sha512, ftpadmin@gnome uses
sha256, etc.
2020-05-08 14:54:37 +02:00
Thomas Haller
ed94ab6e23 contrib/rpm: fix spec file using bare words
error: bare words are no longer supported, please use "...":  no != "yes"
  error:                                                        ^
  error: /builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20200418-170120.dp5cp5/SPECS/NetworkManager.spec:596: bad %if condition:  no != "yes"
2020-04-18 19:10:46 +02:00
Thomas Haller
be78a12012 contrib/rpm: fix spec file using bare words
error: bare words are no longer supported, please use "...":  no != yes
  error: /builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20200418-163008.VM582H/SPECS/NetworkManager.spec:596: bad %if condition:  no != yes
2020-04-18 18:33:55 +02:00
Thomas Haller
68b38a09d1 contrib/rpm: avoid bare words in spec file
error: bare words are no longer supported, please use "...":  "x" != x
   error:                                                               ^
   error: /root/nm-build/NetworkManager/contrib/fedora/rpm/NetworkManager.20200402-030113.Hk7EGs/SPECS/NetworkManager.spec:32: bad %if condition:  "x" != x
   ERROR: rpmbuild FAILED
2020-04-02 09:36:37 +02:00