Commit graph

701 commits

Author SHA1 Message Date
Thomas Haller 8686eb5927
contrib: fix syntax error in "configure-for-system.sh" 2022-09-08 15:29:10 +02:00
Thomas Haller a8b9aef08f
contrib: update bash history for "nm-in-container.sh" and motd 2022-09-07 09:09:32 +02:00
Thomas Haller 8ae132cc49
contrib: add "reset" command to "nm-in-container.sh"
It's between "stop" and "clean". It removes the container,
but keeps the container images. This is to fast restart without
rebuilding the container (image).
2022-09-01 16:33:39 +02:00
Thomas Haller 98c3ac1480
checkpatch.pl: discourage g_str_hash()/g_direct_hash() and g_direct_equal()
- instead of g_str_hash()/g_direct_hash(), use our own functions
  nm_str_hash()/nm_direct_hash(). Those use siphash24 with a random
  seed.

- don't pass g_direct_equal() to GHashTable. When omitting the equal
  function, it falls back to direct pointer comparison, which is likely
  faster. In any case, it's consistent to not use g_direct_hash()
  when using pointer equality.

- instead of g_int_hash()/g_int64_hash()/g_double_hash(), use
  our nm_pint_hash()/nm_pint64_hash()/nm_pdouble_hash(). The latter
  two don't exist yet.
  The reason is that we want to use siphash24.
  Yes, our name differs from glib's. Our naming seems to make sense
  to me however, because we also have nm_pstr_hash(), nm_pdirect_hash()
  and even nm_ppdirect_hash() for following the pointers. Naming is hard.

- instead of g_int_equal()/g_int64_equal()/g_double_equal() use
  our nm_pint_equal()/nm_pint64_equal()/nm_pdouble_equal(). The latter
  two don't exist yet. The reason is purely naming consistency since
  our hash variants follow the other name.
2022-08-31 10:59:22 +02:00
Thomas Haller 90b267afa7
contrib: add "--fast" flag to nm-core-format.sh to only check changed files
It's not the default, because a caller might not be aware that this flag
exists, and when calling the script without arguments, it should do
correct (albeit slow) thing.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1341
2022-08-24 12:06:34 +02:00
Thomas Haller f27b11dd3f
contrib: install Polish translation in "nm-in-container.sh"
It's needed for the unit tests to test translations too.
2022-08-23 15:42:42 +02:00
Thomas Haller 305f02a912
contrib: set short DHCP lifetime in "nm-env-prepare.sh" script 2022-08-10 15:34:43 +02:00
Thomas Haller 540112e36f
contrib: install tcpdump with "nm-in-container.sh"
It's useful for testing, which is what "nm-in-container.sh" is supposed
to provide. It's also only half a megabyte, so reasonably small to
install.
2022-08-10 15:26:41 +02:00
Thomas Haller f14bb2d7b6
contrib: set fixed MAC address in "nm-env-prepare.sh" script 2022-08-10 15:22:11 +02:00
Thomas Haller 0a26320c09
contrib: update bash history in nm-in-container.sh 2022-08-08 20:45:18 +02:00
Thomas Haller 341c46de84
contrib: improve motd for nm-in-container.sh script
Leave a hint about core-dumps.

Also, now we have `contrib/fedora/rpm/configure-for-system.sh` script,
which can configure the build in a way similar to what we get
when doing an RPM build.

That means, inside "contrib/scripts/nm-in-container.sh" we
can just type `make install`, and it will replace the pre-installed
NetworkManager.

The main advantage is that it becomes convenient to run NetworkManager
as a systemd service. Previously, the suggested was to to install
NetworkManager inside another prefix, and run it in the terminal.

Running NetworkManager as systemd service is also necessary for NM-ci,
which restarts the NetworkManager service, and you couldn't run a test,
if you just started NetworkManager in a terminal.

Previously, you had to build a complete RPM, which takes a lot of time.
2022-08-08 11:54:27 +02:00
Thomas Haller d966c2ac4c
contrib: install "qt-devel" in nm-in-container.sh script
Yes, it's a large dependency. But on your outer host you
probably configured NetworkManager with QT enabled (for the
example scripts). We want to compile the same work tree inside
the container. So install qt-devel.
2022-08-08 11:54:27 +02:00
Thomas Haller f2bd67b386
contrib/rpm: add "configure-for-system.sh" script to configure build
This will use the same option as when we do an RPM build.
The purpose is that you could type `make install` with such
a build, and it would replace the files that you'd get by installing
the NetworkManager RPMs.

Of course, you would not want to do that on your work station, but it
will be useful in a container, where we don't mind messing up the
installation.
2022-08-08 11:54:27 +02:00
Thomas Haller 4e4135842e
contrib/rpm: cleanup spec file to unify version comparisons
- always check fedora||rhel and not rhel||fedora.
- consistently use >= instead of >.
2022-08-08 11:54:27 +02:00
Thomas Haller 1e6e15cd80
contrib/rpm: prefer --with-$OPTION=yes|no over --with/--without and --enable/--disable
autotools accepts both --with-$OPTION/--without-$OPTION and
--with-$OPTION=yes|no. Consistently use the latter.

The advantage is that whether it's enabled becomes an argument, so in a
script you could do

  "--with-$OPTION=$VALUE"

Same for enable/disable option.
2022-08-08 11:54:27 +02:00
Lubomir Rintel 3ce3451040 Revert "contrib/rpm: enable -Werror on --with debug instead of --with test"
This reverts commit cac11c736d.
It went in accidentally.
2022-08-02 18:03:45 +02:00
Lubomir Rintel cac11c736d contrib/rpm: enable -Werror on --with debug instead of --with test
The test bcond is used to make test suite failure terminate the %check
phase. That should generally be done for distro builds.

What the distro builds shouldn't do is terminate the build on compiler
warnings, because they're fairly likely to appear on toolchain updates
without indicating actual bugs.

However, currently that's precisely what do we do now.

Let's use -Werror on debug builds instead. They are intentionally made
more prone to fail (e.g. trip more runtime assertions) because failures
can be more rapidly addressed and don't affect distro builds.
2022-08-02 15:06:13 +02:00
Thomas Haller 05825b0348
contrib: make nm-env-prepare.sh script executable 2022-07-29 17:26:58 +02:00
Thomas Haller 1c389445da
contrib: install /usr/bin/python for "nm-in-container.sh" 2022-07-29 17:23:20 +02:00
Thomas Haller 0f1cc3e954
contrib: show diff of git subtrees in "git-subtree-reimport.sh" script 2022-07-25 10:27:33 +02:00
Thomas Haller 8b20d2a856
contrib: add "git-subtree-reimport.sh" script 2022-07-19 08:53:47 +02:00
Lubomir Rintel 8d12cc8152 contrib/rpm: untangle setting of bcond_{test,debug} defaults
Resolve the defaults in build.sh instead of RPM macros. This looks less
terrible maintaining the same defaults as well as options to override it
upstream.

Moving it to the block that downstreams (Fedora, Red Hat) keep
customized makes it possible for them to also maintain customized
defaults here.

In particular, the downstreams should be able to enable bcond_test
at least for their production release (otherwise there's little point in
actually running tests at package build time).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1286
2022-07-10 20:49:05 +02:00
Thomas Haller b12281089c
gitlab-ci: fix unit tests on centos7 for python-pexpect dependency
Fixes: 9570224e86 ('tests/client: add a pexpect-based test runner')
2022-07-06 18:36:52 +02:00
Thomas Haller d8a4b3bec2
all: reformat with clang-format (clang-tools-extra-14.0.0-1.fc36) and update gitlab-ci to f36 2022-07-06 11:06:53 +02:00
Thomas Haller 30d89a121d
contrib: fix "nm-python-black-format.sh" script to ignore systemd,c-util,nettools files
Otherwise, the path "src/c-stdaux/src/docs/conf.py" matches for
formatting. But this file is imported via git-subtree, we don't
want to format it.

Filter out such paths.
2022-07-06 10:44:18 +02:00
Lubomir Rintel 47d14bced8
contrib/rpm: BR pexpect
Unit tests need this to run.

Fixes: 9570224e86 ('tests/client: add a pexpect-based test runner')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1285
2022-07-04 17:35:59 +02:00
Lubomir Rintel 12fe0ae312 contrib/packages: install pexpect
We'd like to use this for client unit testing.
2022-06-30 10:20:44 +02:00
Lubomir Rintel 9fdb6bea44 ci: drop Ubuntu 16.04
It's sad, old and unsupported. Also its gettext is old and smells of
elderberries.
2022-06-27 13:40:09 +02:00
Martin Blanchard 19a6affd3a build: stop relying on intltool for i18n
Recent gettext version can extract and merge back strings from and to
various file formats, no need for intltool anymore.

https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/133

https://github.com/NetworkManager/NetworkManager/pull/303
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/96

Clarification about the use of AM_GNU_GETTEXT_REQUIRE_VERSION:

In configure.ac, specify the minimum gettext version we require, rather
than the exact one. This fixes a situation where the autoconf macros
used for gettext will be the latest available on the system (for
example, 0.20); but the copied-in Makefile.in.in will be for the exact
version specified in configure.ac (in this case, 0.19).

In that situation, the gettext build rules will error out at `make` time
with the message:
   *** error: gettext infrastructure mismatch: using a Makefile.in.in
   from gettext version 0.19 but the autoconf macros are from gettext
   version 0.20

Avoid that by specifying a minimum version dependency rather than an
exact one. This should not cause problems as we haven’t committed any
generated or external gettext files into git, so each developer will end
up regenerating the build system for their system’s version of gettext,
as expected.

See the subsection of
https://www.gnu.org/software/gettext/manual/html_node/Version-Control-Issues.html
for more information.

Note that autoreconf currently doesn’t recognise
AM_GNU_GETTEXT_REQUIRE_VERSION, so we must continue also using
AM_GNU_GETTEXT_VERSION. autopoint will ignore the latter if the former
is present. See
https://lists.gnu.org/archive/html/autoconf-patches/2015-10/msg00000.html.

[lkundrak@v3.sk: Fixed the meson build, adjusted autogen.sh:
droped "|| exit 1", dropped call to aclocal,
dropped --copy from gtkdocize.]
2022-06-27 13:40:09 +02:00
Lubomir Rintel be341d3e10 contrib/debian: rework package install
Apt is run for each package separately and errors are ignored. This is
not great -- it's slow and ignores errors. Therefore we sometimes end
up without packages we need.

Let's tolerate errors only for packages that we are know can fail to
install safely.
2022-06-27 09:09:40 +02:00
Thomas Haller d15f5420c7
contrib: use less -f in NM-log to avoid prompt for non-text input 2022-06-10 08:24:58 +02:00
Thomas Haller c6228a5815
contrib: install iproute-tc in "nm-in-container.sh" 2022-06-09 21:11:08 +02:00
Thomas Haller 058af5fd07
contrib: enable DHCPv6 in "m-in-container.sh"'s "nm-env-prepare.sh" 2022-06-09 12:08:18 +02:00
Thomas Haller b93750d4c5
contrib: set git-blame options in "nm-setup-git.sh" 2022-06-08 21:27:57 +02:00
Thomas Haller 12ea3bb425
contrib: don't use :Z for bind mounts in "nm-in-container.sh"
I am not sure why I added this. I think it's not necessary or
useful. Drop it.
2022-06-03 15:03:13 +02:00
Thomas Haller 65992349d0
contrib: install black/clang-format in nm-in-container.sh
It's just convenient to have some tools around, not only
for testing, but also for (some limited) development.

In particular, because we bind-mount .vimrc inside the container, and
if I use vim, black/clang-format is just one key binding away.
2022-05-31 18:32:33 +02:00
Thomas Haller a6b8f050a0
contrib: add "journal" command to "nm-in-container.sh" for showing logs 2022-05-31 18:32:33 +02:00
Thomas Haller a55d2a5035
contrib: improve bashrc for nm-in-container.sh 2022-05-31 18:13:29 +02:00
Thomas Haller 3a478b3ec1
contrib: add script "nm-setup-git.sh" for setting up NetworkManager git repository
You can of course just clone NetworkManager repository and start hacking
as you like. However, there are a few things like git-notest which are
interesting to setup.

Add a script to do this.

The script is supposed to be idempotent and do nothing, unless
necessary. By default it also only prints what it would do.
2022-05-31 18:04:03 +02:00
Ana Cabral 41b5831331 rpm: make the ifcfg informational message available from RHEL 9 2022-05-30 10:11:00 +02:00
Ana Cabral 96d7362613 rpm: include a warning message for network configuration on /etc/sysconfig/network-scripts directory
NetworkManager now does not support network configuration through
ifcfg files by default anymore, it is provided in a separated
package:
https://fedoramagazine.org/converting-networkmanager-from-ifcfg-to-keyfiles/

This commits include a file in rpm packages located in ifcfg scripts
directory, /etc/sysconfig/network-scripts/, to inform the user of
the new location of network configuration files.

https://bugzilla.redhat.com/show_bug.cgi?id=2074020
2022-05-27 14:04:20 +00:00
Ana Cabral 0415d904cb rpm: move ifcfg scripts directory to the NetworkManager package
NetworkManager does not support by default legacy ifcfg configuration
files anymore, this support is now provided in a separate package
(https://fedoramagazine.org/converting-networkmanager-from-ifcfg-to-keyfiles/).

ifcfg directory (/etc/sysconfig/network-scripts/) should always be present,
regardless of NetworkManager support for network scripts. This change makes the
directory always present, not only when the recently splitted ifcfg subpackage
is installed, and also make it persistent after the package removal.

Fixes: 50a6627fd7 ('rpm: split ifcfg-rh settings plugin into a separate package')
2022-05-27 14:04:20 +00:00
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