Commit graph

553 commits

Author SHA1 Message Date
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