Commit graph

529 commits

Author SHA1 Message Date
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?branch=master
[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