From 8efc0319ce654056e6eff37c6e46002fb60558b3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 5 Aug 2022 10:31:44 +0200 Subject: [PATCH 1/6] build/meson: force overwriting files in "meson-post-install.sh" Repeated `ninja -C build install` should succeed. But they did not: Running custom install script '/data/src/NetworkManager/tools/meson-post-install.sh /usr/share /usr/bin /etc/NetworkManager /usr/lib/NetworkManager /var/lib/NetworkManager /usr/share/man /etc 1 1 1 1' --- stdout --- --- stderr --- ln: failed to create symbolic link '/usr/lib/NetworkManager/dispatcher.d/90-nm-cloud-setup.sh': File exists --- tools/meson-post-install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh index 88e30ccfc1..45f3e37c6b 100755 --- a/tools/meson-post-install.sh +++ b/tools/meson-post-install.sh @@ -16,7 +16,7 @@ install_systemdunitdir="${11}" if [ -x "${DESTDIR}${nm_bindir}/nmtui" ]; then for alias in nmtui-connect nmtui-edit nmtui-hostname; do - ln -sf nmtui "${DESTDIR}${nm_bindir}/$alias" + ln -sfn nmtui "${DESTDIR}${nm_bindir}/$alias" done fi @@ -43,11 +43,11 @@ chmod 0700 "${DESTDIR}${nm_pkgstatedir}" if [ "$enable_docs" = 1 ]; then for alias in nmtui-connect nmtui-edit nmtui-hostname; do - ln -f "${DESTDIR}${nm_mandir}/man1/nmtui.1" "${DESTDIR}${nm_mandir}/man1/${alias}.1" + ln -fn "${DESTDIR}${nm_mandir}/man1/nmtui.1" "${DESTDIR}${nm_mandir}/man1/${alias}.1" done - ln -f "${DESTDIR}${nm_mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${nm_mandir}/man5/nm-system-settings.conf.5" - ln -f "${DESTDIR}${nm_mandir}/man5/nm-settings-nmcli.5" "${DESTDIR}${nm_mandir}/man5/nm-settings.5" + ln -fn "${DESTDIR}${nm_mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${nm_mandir}/man5/nm-system-settings.conf.5" + ln -fn "${DESTDIR}${nm_mandir}/man5/nm-settings-nmcli.5" "${DESTDIR}${nm_mandir}/man5/nm-settings.5" fi if [ "$enable_ifcfg_rh" = 1 ]; then @@ -55,6 +55,6 @@ if [ "$enable_ifcfg_rh" = 1 ]; then fi if [ "$enable_nm_cloud_setup" = 1 -a "$install_systemdunitdir" = 1 ]; then - ln -s 'no-wait.d/90-nm-cloud-setup.sh' "${DESTDIR}${nm_pkglibdir}/dispatcher.d/90-nm-cloud-setup.sh" + ln -sfn 'no-wait.d/90-nm-cloud-setup.sh' "${DESTDIR}${nm_pkglibdir}/dispatcher.d/90-nm-cloud-setup.sh" fi From 1e6e15cd8097cc55011ff6af759c15bbb11d8e36 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Aug 2022 14:50:20 +0200 Subject: [PATCH 2/6] 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. --- contrib/fedora/rpm/NetworkManager.spec | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 5063a16b99..29f7362841 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -741,8 +741,8 @@ gtkdocize autoreconf --install --force %configure \ --with-runstatedir=%{_rundir} \ - --disable-silent-rules \ - --disable-static \ + --enable-silent-rules=no \ + --enable-static=no \ --with-nft=/usr/sbin/nft \ --with-iptables=/usr/sbin/iptables \ --with-dhclient=yes \ @@ -757,26 +757,26 @@ autoreconf --install --force %if %{with sanitizer} --with-address-sanitizer=exec \ %if 0%{?fedora} || 0%{?rhel} >= 8 - --enable-undefined-sanitizer \ + --enable-undefined-sanitizer=yes \ %else - --disable-undefined-sanitizer \ + --enable-undefined-sanitizer=no \ %endif %else --with-address-sanitizer=no \ - --disable-undefined-sanitizer \ + --enable-undefined-sanitizer=no \ %endif %if %{with debug} - --enable-more-logging \ + --enable-more-logging=yes \ --with-more-asserts=10000 \ %else - --disable-more-logging \ - --without-more-asserts \ + --enable-more-logging=no \ + --with-more-asserts=0 \ %endif - --enable-ld-gc \ + --enable-ld-gc=yes \ %if %{with lto} - --enable-lto \ + --enable-lto=yes \ %else - --disable-lto \ + --enable-lto=no \ %endif --with-libaudit=yes-disabled-by-default \ %if 0%{?with_modem_manager_1} @@ -815,11 +815,11 @@ autoreconf --install --force --with-nm-cloud-setup=no \ %endif --enable-vala=yes \ - --enable-introspection \ + --enable-introspection=yes \ %if %{with regen_docs} - --enable-gtk-doc \ + --enable-gtk-doc=yes \ %else - --disable-gtk-doc \ + --enable-gtk-doc=no \ %endif %if %{with team} --enable-teamdctl=yes \ @@ -834,11 +834,11 @@ autoreconf --install --force --with-selinux=yes \ --enable-polkit=yes \ --enable-modify-system=yes \ - --enable-concheck \ + --enable-concheck=yes \ %if 0%{?fedora} - --with-libpsl \ + --with-libpsl=yes \ %else - --without-libpsl \ + --with-libpsl=no \ %endif --with-ebpf=%{ebpf_enabled} \ --with-session-tracking=systemd \ @@ -859,9 +859,9 @@ autoreconf --install --force --enable-ppp=yes \ %endif %if %{with firewalld_zone} - --enable-firewalld-zone \ + --enable-firewalld-zone=yes \ %else - --disable-firewalld-zone \ + --enable-firewalld-zone=no \ %endif --with-dist-version=%{version}-%{release} \ %if %{?config_plugins_default_ifcfg_rh} From 4e4135842e8267a5a15012041073f89b315c8802 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Aug 2022 16:17:43 +0200 Subject: [PATCH 3/6] contrib/rpm: cleanup spec file to unify version comparisons - always check fedora||rhel and not rhel||fedora. - consistently use >= instead of >. --- contrib/fedora/rpm/NetworkManager.spec | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 29f7362841..a279b128be 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -80,12 +80,12 @@ %else %bcond_with connectivity_fedora %endif -%if 0%{?rhel} && 0%{?rhel} > 7 +%if 0%{?rhel} && 0%{?rhel} >= 8 %bcond_without connectivity_redhat %else %bcond_with connectivity_redhat %endif -%if 0%{?fedora} > 28 || 0%{?rhel} > 7 +%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8 %bcond_without crypto_gnutls %else %bcond_with crypto_gnutls @@ -95,7 +95,7 @@ %else %bcond_without iwd %endif -%if 0%{?fedora} > 31 || 0%{?rhel} > 7 +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8 %bcond_without firewalld_zone %else %bcond_with firewalld_zone @@ -103,7 +103,7 @@ ############################################################################### -%if 0%{?fedora} || 0%{?rhel} > 7 +%if 0%{?fedora} || 0%{?rhel} >= 8 %global dbus_version 1.9.18 %global dbus_sys_dir %{_datadir}/dbus-1/system.d %else @@ -125,15 +125,15 @@ %global with_modem_manager_1 0 %endif -%if 0%{?fedora} >= 31 || 0%{?rhel} > 7 +%if 0%{?fedora} >= 31 || 0%{?rhel} >= 8 %global dhcp_default internal %else %global dhcp_default dhclient %endif -%if 0%{?fedora} || 0%{?rhel} > 7 +%if 0%{?fedora} || 0%{?rhel} >= 8 %global logging_backend_default journal -%if 0%{?fedora} || 0%{?rhel} > 8 +%if 0%{?fedora} || 0%{?rhel} >= 9 %global dns_rc_manager_default auto %else %global dns_rc_manager_default symlink @@ -143,19 +143,19 @@ %global dns_rc_manager_default file %endif -%if 0%{?rhel} > 8 || 0%{?fedora} > 32 +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 %global config_plugins_default_ifcfg_rh 0 %else %global config_plugins_default_ifcfg_rh 1 %endif -%if 0%{?rhel} > 9 || 0%{?fedora} > 35 +%if 0%{?fedora} >= 36 || 0%{?rhel} >= 10 %global split_ifcfg_rh 1 %else %global split_ifcfg_rh 0 %endif -%if 0%{?rhel} > 8 || 0%{?fedora} > 35 +%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9 %global ifcfg_warning 1 %else %global ifcfg_warning 0 @@ -200,7 +200,7 @@ Source7: readme-ifcfg-rh.txt #Patch1: 0001-some.patch Requires(post): systemd -%if 0%{?fedora} || 0%{?rhel} > 7 +%if 0%{?fedora} || 0%{?rhel} >= 8 Requires(post): systemd-udev %endif Requires(post): /usr/sbin/update-alternatives @@ -288,7 +288,7 @@ BuildRequires: mobile-broadband-provider-info-devel BuildRequires: newt-devel %endif BuildRequires: /usr/bin/dbus-launch -%if 0%{?fedora} > 27 || 0%{?rhel} > 7 +%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 BuildRequires: python3 BuildRequires: python3-gobject-base BuildRequires: python3-dbus @@ -312,7 +312,7 @@ BuildRequires: libubsan BuildRequires: firewalld-filesystem %endif BuildRequires: iproute -%if 0%{?fedora} || 0%{?rhel} > 7 +%if 0%{?fedora} || 0%{?rhel} >= 8 BuildRequires: iproute-tc %endif @@ -401,7 +401,7 @@ Requires: wireless-regdb Requires: crda %endif -%if %{with iwd} && (0%{?fedora} > 24 || 0%{?rhel} > 7) +%if %{with iwd} && (0%{?fedora} >= 25 || 0%{?rhel} >= 8) Requires: (wpa_supplicant >= %{wpa_supplicant_version} or iwd) Suggests: wpa_supplicant %else From f2bd67b386b6e6f55ee9ca66fb19b5c3ff2b446a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Aug 2022 13:49:26 +0200 Subject: [PATCH 4/6] 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. --- contrib/fedora/rpm/configure-for-system.sh | 509 +++++++++++++++++++++ 1 file changed, 509 insertions(+) create mode 100755 contrib/fedora/rpm/configure-for-system.sh diff --git a/contrib/fedora/rpm/configure-for-system.sh b/contrib/fedora/rpm/configure-for-system.sh new file mode 100755 index 0000000000..bae35e227c --- /dev/null +++ b/contrib/fedora/rpm/configure-for-system.sh @@ -0,0 +1,509 @@ +#!/bin/bash + +# Run configure/meson for NetworkManager in a way similar to how an RPM build does it. +# The effect is, that if you do `make install`, that it will overwrite the files that +# you'd usually get by installing the NetworkManager RPM. Also, it means you can afterwards +# systemctl restart NetworkManager. + +die() { + printf "%s\n" "$*" + exit 1 +} + +BASE_DIR="$(cd "$(dirname "$BASH_SOURCE")"; git rev-parse --show-toplevel)" + +cd "$BASE_DIR" || die "Cannot cd to base directory" + +vars() { + sed -e '1,/[P]VARS/!d' "$BASH_SOURCE" | sed -n 's/^'"$1"'_\([^=]*\)=.*/\1/p' +} + +vars_with_vals() { + echo "Variables:" + for v in $(vars P); do + printf " %s=%q\n" "$v" "$(eval "echo \"\$P_$v\"")" + done + echo "Directories:" + for v in $(vars D); do + printf " %s=%q\n" "$v" "$(eval "echo \"\$D_$v\"")" + done +} + +usage() { + echo "$ $0 [-m|--meson] [-a|--autotools] [-s|--show]" + echo "" + echo "Configure NetworkManager in a way that is similar to when building" + echo "RPMs of NetworkManager for Fedora/RHEL. The effect is that \`make install\`" + echo "will overwrite the files in /usr that you installed via the package management" + echo "systemd. Also, subsequent \`systemctl restart NetworkManager\` works." + echo "You don't want to do this on your real system, because it messes up your" + echo "installation" + echo + + vars_with_vals +} + +get_version() { + local major minor micro + local F="./configure.ac" + + vars="$(sed -n 's/^m4_define(\[nm_\(major\|minor\|micro\)_version\], *\[\([0-9]\+\)\]) *$/local \1='\''\2'\''/p' "$F" 2>/dev/null)" + eval "$vars" + + [[ -n "$major" && -n "$minor" && "$micro" ]] || return 1 + echo "$major.$minor.$micro" +} + +bool() { + case "$1" in + 1|y|Y|yes|Yes|YES|true|True|TRUE) + return 0 + ;; + 0|n|N|no|No|NO|false|False|FALSE) + return 1 + ;; + *) + local re='^[0-9]+$' + [[ $1 =~ $re ]] && test "$1" -gt 0 && return 0 + [ "$#" -le "1" ] && return 1 + shift + bool "$@" + return $? + ;; + esac +} + +bool_true() { + if bool "$@"; then + echo true + else + echo false + fi +} + +bool_not_true() { + if bool "$@"; then + echo false + else + echo true + fi +} + +bool_enable() { + if bool "$@"; then + echo enable + else + echo disable + fi +} + +bool_not_enable() { + if bool "$@"; then + echo disable + else + echo enable + fi +} + +bool_yes() { + if bool "$@"; then + echo yes + else + echo no + fi +} + +bool_not_yes() { + if bool "$@"; then + echo no + else + echo yes + fi +} + +args_enable() { + local cond="$1" + local a + shift + if bool "$cond" ; then + for a; do + printf "%q\n" "$a" + done + fi +} + +show_cmd() { + local a + local sep= + + for a; do + printf '%s%q' "$sep" "$a" + sep=' ' + done + printf '\n' +} + +SHOW_CMD= + +P_DEBUG="${DEBUG-1}" + +P_BUILD_TYPE="${BUILD_TYPE-}" +P_CFLAGS="${CFLAGS-}" +P_CC="${CC-$((! command -v gcc && command -v clang) &>/dev/null && echo clang || echo gcc)}" + +P_RHEL="${RHEL-}" +P_FEDORA="${FEDORA-}" + +P_CONFIG_PLUGINS_DEFAULT_IFCFG_RH="${CONFIG_PLUGINS_DEFAULT_IFCFG_RH-}" +P_CRYPTO="${CRYPTO-}" +P_DBUS_SYS_DIR="${DBUS_SYS_DIR-}" +P_DHCP_DEFAULT="${DHCP_DEFAULT-}" +P_DNS_RC_MANAGER_DEFAULT="${DNS_RC_MANAGER_DEFAULT-}" +P_EBPF_ENABLED="${EBPF_ENABLED-no}" +P_FIREWALLD_ZONE="${FIREWALLD_ZONE-}" +P_IWD="${IWD-}" +P_LOGGING_BACKEND_DEFAULT="${LOGGING_BACKEND_DEFAULT-}" +P_LTO="${LTO-0}" +P_MODEM_MANAGER_1="${MODEM_MANAGER_1-}" +P_TEST="${TEST-1}" +P_SILENT_RULES="${SILENT_RULES-1}" + +P_VERSION="${VERSION:-$(get_version)}" +P_RELEASE="${RELEASE:-$(git rev-list HEAD | wc -l).test}" + +P_REGEN_DOCS="${REGEN_DOCS-1}" +P_SANITIZER="${SANITIZER-0}" + +P_WIFI="${WIFI-1}" +P_WWAN="${WWAN-1}" +P_TEAM="${TEAM-1}" +P_BLUETOOTH="${BLUETOOTH-1}" +P_NMTUI="${NMTUI-1}" +P_NM_CLOUD_SETUP="${NM_CLOUD_SETUP-1}" +P_OVS="${OVS-1}" +P_PPP="${PPP-1}" + +P_PPP_VERSION="${PPP_VERSION-}" + +D_PREFIX="$(rpm --eval "%{_prefix}")" +D_BINDIR="$(rpm --eval "%{_bindir}")" +D_SBINDIR="$(rpm --eval "%{_sbindir}")" +D_LIBDIR="$(rpm --eval "%{_libdir}")" +D_LIBEXECDIR="$(rpm --eval "%{_libexecdir}")" +D_INCLUDEDIR="$(rpm --eval "%{_includedir}")" +D_DATADIR="$(rpm --eval "%{_datadir}")" +D_RUNDIR="$(rpm --eval "%{_rundir}")" +D_MANDIR="$(rpm --eval "%{_mandir}")" +D_INFODIR="$(rpm --eval "%{_infodir}")" +D_SYSCONFDIR="$(rpm --eval "%{_sysconfdir}")" +D_LOCALSTATEDIR="$(rpm --eval "%{_localstatedir}")" +D_SHAREDSTATEDIR="$(rpm --eval "%{_sharedstatedir}")" + +#PVARS + +if [ -z "$P_FEDORA" -a -z "$P_RHEL" ] ; then + x="$(grep -q "ID=fedora" /etc/os-release && sed -n 's/VERSION_ID=//p' /etc/os-release)" + if test "$x" -gt 0 ; then + P_FEDORA="$x" + P_RHEL=0 + else + x="$(grep -q "ID=fedora" /etc/os-release && sed -n 's/VERSION_ID=//p' /etc/os-release)" + if test "$x" -gt 0 ; then + P_FEDORA=0 + P_RHEL="$x" + fi + fi +fi +test -z "$P_FEDORA" && P_FEDORA=0 +test -z "$P_RHEL" && P_RHEL=0 + +test "$P_FEDORA" -gt 0 -o "$P_RHEL" -gt 0 || die "FEDORA/RHEL variables unset" + +if [ -z "$P_PPP_VERSION" ] ; then + P_PPP_VERSION="$(sed -n 's/^#define\s*VERSION\s*"\([^\s]*\)"$/\1/p' "$D_INCLUDEDIR/pppd/patchlevel.h" 2>/dev/null | grep . || echo bad)" +fi + +if [ -z "$P_CRYPTO" ] ; then + if [ "$P_FEDORA" -ge 29 -o "$P_RHEL" -ge 8 ] ; then + P_CRYPTO=gnutls + else + P_CRYPTO=nss + fi +fi + +if [ -z "$P_CONFIG_PLUGINS_DEFAULT_IFCFG_RH" ] ; then + if [ "$P_FEDORA" -ge 33 -o "$P_RHEL" -ge 9 ] ; then + P_CONFIG_PLUGINS_DEFAULT_IFCFG_RH=0 + else + P_CONFIG_PLUGINS_DEFAULT_IFCFG_RH=1 + fi +fi + + +if [ -z "$P_DBUS_SYS_DIR" ] ; then + if [ "$P_FEDORA" -ge 1 -o "$P_RHEL" -ge 8 ] ; then + P_DBUS_SYS_DIR="$D_DATADIR/dbus-1/system.d" + else + P_DBUS_SYS_DIR="$D_SYSCONFDIR/dbus-1/system.d" + fi +fi + +if [ -z "$P_DNS_RC_MANAGER_DEFAULT" ] ; then + if [ "$P_FEDORA" -ge 1 -o "$P_RHEL" -ge 9 ] ; then + P_DNS_RC_MANAGER_DEFAULT=auto + elif [ "$P_FEDORA" -ge 1 -o "$P_RHEL" -ge 8 ] ; then + P_DNS_RC_MANAGER_DEFAULT=symlink + else + P_DNS_RC_MANAGER_DEFAULT=file + fi +fi + +if [ -z "$P_LOGGING_BACKEND_DEFAULT" ] ; then + if [ "$P_FEDORA" -ge 1 -o "$P_RHEL" -ge 8 ] ; then + P_LOGGING_BACKEND_DEFAULT=journal + else + P_LOGGING_BACKEND_DEFAULT=syslog + fi +fi + +if [ -z "$P_DHCP_DEFAULT" ] ; then + if [ "$P_FEDORA" -ge 31 -o "$P_RHEL" -ge 8 ] ; then + P_DHCP_DEFAULT=internal + else + P_DHCP_DEFAULT=dhclient + fi +fi + +if [ -z "$P_FIREWALLD_ZONE" ] ; then + if [ "$P_FEDORA" -ge 32 -o "$P_RHEL" -ge 8 ] ; then + P_FIREWALLD_ZONE=1 + else + P_FIREWALLD_ZONE=0 + fi +fi + +if [ -z "$P_IWD" ] ; then + if [ "$P_RHEL" -ge 1 ] ; then + P_IWD=0 + else + P_IWD=1 + fi +fi + +if [ -z "$P_MODEM_MANAGER_1" ] ; then + if bool "$P_BLUETOOTH" || bool "$P_WWAN" ; then + P_MODEM_MANAGER_1=1 + else + P_MODEM_MANAGER_1=0 + fi +fi + +if bool "$P_DEBUG" ; then + P_CFLAGS="-g -Og -fexceptions${P_CFLAGS:+ }$P_CFLAGS" +else + P_CFLAGS="-g -O2 -fexceptions${P_CFLAGS:+ }$P_CFLAGS" +fi + +if [ -z "$P_BUILD_TYPE" ] ; then + if [ -d ./build -a ! -f ./configure] ; then + P_BUILD_TYPE=meson + elif [ ! -d ./build -a -f ./configure] ; then + P_BUILD_TYPE=autotools + else + P_BUILD_TYPE=autotools + fi +fi + +while [[ $# -gt 0 ]] ; do + A="$1" + shift + case "$A" in + --meson|-m) + P_BUILD_TYPE=meson + ;; + --autotools|-a) + P_BUILD_TYPE=autotools + ;; + -s|--show) + SHOW_CMD=show_cmd + ;; + -h|help|-help|--help) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done + +vars_with_vals + +if [ "$P_BUILD_TYPE" == meson ] ; then + MESON_RECONFIGURE= + if test -d "./build/" ; then + MESON_RECONFIGURE="--reconfigure" + fi + + $SHOW_CMD \ + env \ + CC="$P_CC" \ + CFLAGS="$P_CFLAGS" \ + meson \ + --buildtype=plain \ + --prefix="$D_PREFIX" \ + --libdir="$D_LIBDIR" \ + --libexecdir="$D_LIBEXECDIR" \ + --bindir="$D_BINDIR" \ + --sbindir="$D_SBINDIR" \ + --includedir="$D_INCLUDEDIR" \ + --datadir="$D_DATADIR" \ + --mandir="$D_MANDIR" \ + --infodir="$D_INFODIR" \ + --localedir="$D_DATADIR"/locale \ + --sysconfdir="$D_SYSCONFDIR" \ + --localstatedir="$D_LOCALSTATEDIR" \ + --sharedstatedir="$D_SHAREDSTATEDIR" \ + --wrap-mode=nodownload \ + --auto-features=enabled \ + \ + build \ + \ + $MESON_RECONFIGURE \ + \ + -Db_ndebug=false \ + --warnlevel 2 \ + $(args_enable "$P_TEST" --werror) \ + -Dnft=/usr/sbin/nft \ + -Diptables=/usr/sbin/iptables \ + -Ddhcpcanon=no \ + -Ddhcpcd=no \ + -Dconfig_dhcp_default="$P_DHCP_DEFAULT" \ + "-Dcrypto=$P_CRYPTO" \ + $(args_enable "$P_DEBUG" -Dmore_logging=true -Dmore_asserts=10000) \ + $(args_enable "$(bool_not_true "$P_DEBUG")" -Dmore_logging=false -Dmore_asserts=0) \ + -Dld_gc=true \ + -Db_lto="$(bool_true "$P_LTO")" \ + -Dlibaudit=yes-disabled-by-default \ + -Dmodem_manager="$(bool_true "$P_MODEM_MANAGER_1")" \ + $(args_enable "$P_WIFI" -Dwifi=true -Dwext="$(bool_true "$P_FEDORA")") \ + $(args_enable "$(bool_not_true "$P_WIFI")" -Dwifi=false) \ + -Diwd="$(bool_true "$P_IWD")" \ + -Dbluez5_dun="$(bool_true "$P_BLUETOOTH")" \ + -Dnmtui="$(bool_true "$P_NMTUI")" \ + -Dnm_cloud_setup="$(bool_true "$P_NM_CLOUD_SETUP")" \ + -Dvapi=true \ + -Dintrospection=true \ + -Ddocs="$(bool_true "$P_REGEN_DOCS")" \ + -Dteamdctl="$(bool_true "$P_TEAM")" \ + -Dovs="$(bool_true "$P_OVS")" \ + -Dselinux=true \ + -Dpolkit=true \ + -Dconfig_auth_polkit_default=true \ + -Dmodify_system=true \ + -Dconcheck=true \ + -Dlibpsl="$(bool_true "$P_FEDORA")" \ + -Debpf="$(bool_true "$P_EBPF_ENABLED")" \ + -Dsession_tracking=systemd \ + -Dsuspend_resume=systemd \ + -Dsystem_ca_path=/etc/pki/tls/cert.pem \ + -Ddbus_conf_dir="$P_DBUS_SYS_DIR" \ + -Dtests=yes \ + -Dvalgrind=no \ + -Difcfg_rh=true \ + -Difupdown=false \ + $(args_enable "$P_PPP" -Dpppd_plugin_dir="$D_LIBDIR/pppd/$P_PPP_VERSION" -Dppp=true) \ + -Dfirewalld_zone="$(bool_true "$P_FIREWALLD_ZONE}")" \ + -Ddist_version="$P_VERSION-$P_RELEASE" \ + $(args_enable "$P_CONFIG_PLUGINS_DEFAULT_IFCFG_RH" -Dconfig_plugins_default=ifcfg-rh) \ + -Dresolvconf=no \ + -Dnetconfig=no \ + -Dconfig_dns_rc_manager_default="$P_DNS_RC_MANAGER_DEFAULT" \ + -Dconfig_logging_backend_default="$P_LOGGING_BACKEND_DEFAULT" \ + ; + +else + if ! test -x ./configure ; then + if [ -z "$SHOW_CMD" ]; then + NOCONFIGURE=yes ./autogen.sh + fi + fi + $SHOW_CMD \ + ./configure \ + --build=x86_64-redhat-linux-gnu \ + --host=x86_64-redhat-linux-gnu \ + --program-prefix= \ + --prefix="$D_PREFIX" \ + --exec-prefix=/usr \ + --bindir="$D_BINDIR" \ + --sbindir="$D_SBINDIR" \ + --sysconfdir="$D_SYSCONFDIR" \ + --datadir="$D_DATADIR" \ + --includedir="$D_INCLUDEDIR" \ + --libdir="$D_LIBDIR" \ + --libexecdir="$D_LIBEXECDIR" \ + --localstatedir="$D_LOCALSTATEDIR" \ + --sharedstatedir="$D_SHAREDSTATEDIR" \ + --mandir="$D_MANDIR" \ + --infodir="$D_INFODIR" \ + \ + CC="$P_CC" \ + CFLAGS="$P_CFLAGS" \ + \ + --enable-dependency-tracking=yes \ + \ + --with-runstatedir="$D_RUNDIR" \ + --enable-silent-rules="$(bool_yes "$P_SILENT_RULES")" \ + --enable-static=no \ + --with-nft=/usr/sbin/nft \ + --with-iptables=/usr/sbin/iptables \ + --with-dhclient=yes \ + --with-dhcpcd=no \ + --with-dhcpcanon=no \ + --with-config-dhcp-default="$P_DHCP_DEFAULT" \ + --with-crypto="$P_CRYPTO" \ + $(args_enable "$P_SANITIZER" --with-address-sanitizer=exec "$( (bool "$P_FEDORA" || test "$P_RHEL" -ge 8) && echo --enable-undefined-sanitizer=yes || echo --enable-undefined-sanitizer=no)" ) \ + $(args_enable "$(bool_not_true "$P_SANITIZER")" --with-address-sanitizer=no --enable-undefined-sanitizer=no) \ + $(args_enable "$P_DEBUG" --enable-more-logging=yes --with-more-asserts=10000) \ + $(args_enable "$(bool_not_true "$P_DEBUG")" --enable-more-logging=no --with-more-asserts=0) \ + --enable-ld-gc=yes \ + "--$(bool_enable "$P_LTO")-lto" \ + --with-libaudit=yes-disabled-by-default \ + --with-modem-manager-1="$(bool_yes "$P_MODEM_MANAGER_1")" \ + $(args_enable "$P_WIFI" --enable-wifi=yes --with-wext="$(bool_yes "$P_FEDORA")") \ + $(args_enable "$(bool_not_true "$P_WIFI")" --enable-wifi=no) \ + --with-iwd="$(bool_yes "$P_IWD")" \ + --enable-bluez5-dun="$(bool_yes "$P_BLUETOOTH")" \ + --with-nmtui="$(bool_yes "$P_NMTUI")" \ + --with-nm-cloud-setup="$(bool_yes "$P_NM_CLOUD_SETUP")" \ + --enable-vala=yes \ + --enable-introspection=yes \ + --enable-gtk-doc="$(bool_yes "$P_REGEN_DOCS")" \ + --enable-teamdctl="$(bool_yes "$P_TEAM")" \ + --enable-ovs="$(bool_yes "$P_OVS")" \ + --with-selinux=yes \ + --enable-polkit=yes \ + --enable-modify-system=yes \ + --enable-concheck=yes \ + --with-libpsl="$(bool_yes "$P_FEDORA")" \ + --with-ebpf="$(bool_yes "$P_EBPF_ENABLED")" \ + --with-session-tracking=systemd \ + --with-suspend-resume=systemd \ + --with-system-ca-path=/etc/pki/tls/cert.pem \ + --with-dbus-sys-dir="$P_DBUS_SYS_DIR" \ + --with-tests=yes \ + --enable-more-warnings="$(bool "$P_TEST" && echo error || echo yes)" \ + --with-valgrind=no \ + --enable-ifcfg-rh=yes \ + --enable-ifupdown=no \ + $(args_enable "$P_PPP" --with-pppd-plugin-dir="$D_LIBDIR/pppd/$P_PPP_VERSION" --enable-ppp=yes) \ + --enable-firewalld-zone="$(bool_yes "$P_FIREWALLD_ZONE")" \ + --with-dist-version="$P_VERSION-$P_RELEASE" \ + $(args_enable "$P_CONFIG_PLUGINS_DEFAULT_IFCFG_RH" --with-config-plugins-default=ifcfg-rh) \ + --with-resolvconf=no \ + --with-netconfig=no \ + --with-config-dns-rc-manager-default="$P_DNS_RC_MANAGER_DEFAULT" \ + --with-config-logging-backend-default="$P_LOGGING_BACKEND_DEFAULT" \ + ; +fi From d966c2ac4c2aa2147104b7b5b5fc1e56f1268383 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Aug 2022 17:35:39 +0200 Subject: [PATCH 5/6] 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. --- contrib/scripts/nm-in-container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/scripts/nm-in-container.sh b/contrib/scripts/nm-in-container.sh index 444feb55f2..72b3f1130a 100755 --- a/contrib/scripts/nm-in-container.sh +++ b/contrib/scripts/nm-in-container.sh @@ -326,6 +326,7 @@ RUN dnf install -y \\ python3-pip \\ python3-pyte \\ python3-pyyaml \\ + qt-devel \\ radvd \\ readline-devel \\ rp-pppoe \\ From 341c46de84b18226f95b07bbd4c35ba56b42dd40 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Aug 2022 17:38:34 +0200 Subject: [PATCH 6/6] 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. --- contrib/scripts/nm-in-container.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/contrib/scripts/nm-in-container.sh b/contrib/scripts/nm-in-container.sh index 72b3f1130a..c8f5ad62e2 100755 --- a/contrib/scripts/nm-in-container.sh +++ b/contrib/scripts/nm-in-container.sh @@ -113,7 +113,19 @@ create_dockerfile() { find NetworkManager bind mounted at $BASEDIR_NM run \`nm-env-prepare.sh setup --idx 1\` to setup test interfaces -Configure NetworkManager with +Coredumps: coredumps are not namespaced, so by default they will +be sent to coredumpctl of the outer host, which has no idea where +to get the debugging symbols from. A possible workaround is setting + + $ echo '/tmp/core.%e.%p' | sudo tee /proc/sys/kernel/core_pattern + +so that core dumps get written to file. Afterwards, restore with + + echo '|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h' | sudo tee /proc/sys/kernel/core_pattern + +from /usr/lib/sysctl.d/50-coredump.conf. + +For example, configure NetworkManager with \$ ./configure \\ --enable-address-sanitizer=no \\ --enable-compile-warnings=yes \\ @@ -164,6 +176,10 @@ Configure NetworkManager with "\${NM_CONFIGURE_OTPS[@]}" Test with: \$ systemctl stop NetworkManager; /opt/test/sbin/NetworkManager --debug 2>&1 | tee -a /tmp/nm-log.txt + +Alternatively, configure with \`contrib/fedora/rpm/configure-for-system.sh\`, +subsequent \`make && make install\` will overwrite your system's NetworkManager, +and you can test it with \`systemctl daemon-reload ; systemctl restart NetworkManager\`. EOF cat <