build: qualify plugin dir name with a version string

This makes package updates more robust, avoiding in-place replaces of
the plugins.

Previously, if an upgrade transaction was terminated, NetworkManager
library could end up being of a different version than the plugins.
If the user was unfortunate enough to connect using a connection that
required a plugin (say, Wi-Fi), he would be left without a network
connection making it somewhat inconvenient to recover from the botched
upgrade.

This makes the whole situation a little bit less sad.

The VPN plugins are kept where they always have been -- the path is not
qualified with a version number.
This commit is contained in:
Lubomir Rintel 2018-03-18 20:38:49 +01:00
parent bade13129b
commit 320422e4cf
7 changed files with 39 additions and 30 deletions

View file

@ -20,7 +20,7 @@ sbin_PROGRAMS =
bin_PROGRAMS =
libexec_PROGRAMS =
lib_LTLIBRARIES =
pkglib_LTLIBRARIES =
plugin_LTLIBRARIES =
core_plugins =
service_DATA =
man_MANS =
@ -73,6 +73,8 @@ examplesdir = $(docdir)/examples
rundir=$(runstatedir)/NetworkManager
statedir=$(localstatedir)/lib/NetworkManager
plugindir=$(pkglibdir)/$(NM_DIST_VERSION)
dbusactivationdir = $(datadir)/dbus-1/system-services
servicedir = $(datadir)/dbus-1/system-services
@ -578,7 +580,8 @@ libnm_core_libnm_core_la_CPPFLAGS = \
-DLOCALEDIR=\"$(datadir)/locale\" \
-DNMCONFDIR=\"$(nmconfdir)\" \
-DNMLIBDIR=\"$(nmlibdir)\" \
-DNMPLUGINDIR=\"$(pkglibdir)\" \
-DNMVPNDIR=\"$(pkglibdir)\" \
-DNMPLUGINDIR=\"$(plugindir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
$(NULL)
@ -1190,7 +1193,7 @@ src_cppflags = \
\
-DNMCONFDIR=\"$(nmconfdir)\" \
-DNMLOCALEDIR=\"$(datadir)/locale\" \
-DNMPLUGINDIR=\"$(pkglibdir)\" \
-DNMPLUGINDIR=\"$(plugindir)\" \
-DNMRUNDIR=\"$(nmrundir)\" \
-DNMSTATEDIR=\"$(nmstatedir)\" \
-DNMLIBDIR=\"$(nmlibdir)\" \
@ -4745,7 +4748,7 @@ check_PROGRAMS += $(check_programs) $(check_programs_norun)
check_LTLIBRARIES += $(check_ltlibraries)
endif
pkglib_LTLIBRARIES += $(core_plugins)
plugin_LTLIBRARIES += $(core_plugins)
TESTS += $(check_programs)
@ -4845,7 +4848,7 @@ install-data-hook: $(install_data_hook)
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/conf.d
$(mkinstalldirs) -m 0755 $(DESTDIR)$(nmlibdir)/VPN
$(mkinstalldirs) -m 0700 $(DESTDIR)$(nmstatedir)
$(mkinstalldirs) -m 0755 $(DESTDIR)$(pkglibdir)
$(mkinstalldirs) -m 0755 $(DESTDIR)$(plugindir)
uninstall-hook: $(uninstall_hook)

View file

@ -183,10 +183,9 @@ dnl
AC_ARG_WITH(dist-version,
AS_HELP_STRING([--with-dist-version=<NM-distribution-version>],
[Define the NM''s distribution version string]),
ac_distver=$withval, ac_distver="")
if ! test x"$ac_distver" = x""; then
AC_DEFINE_UNQUOTED(NM_DIST_VERSION, "$ac_distver", [Define the distribution version string])
fi
ac_distver=$withval, ac_distver=$NM_VERSION)
AC_DEFINE_UNQUOTED(NM_DIST_VERSION, "$ac_distver", [Define the distribution version string])
AC_SUBST(NM_DIST_VERSION, "$ac_distver")
AC_ARG_ENABLE(wifi, AS_HELP_STRING([--enable-wifi], [enable Wi-Fi support]))
if test "${enable_wifi}" != "no"; then

View file

@ -28,6 +28,7 @@
%global systemd_dir %{_prefix}/lib/systemd/system
%global nmlibdir %{_prefix}/lib/%{name}
%global nmplugindir %{_libdir}/%{name}/%{version}-%{release}
%global _hardened_build 1
@ -534,7 +535,7 @@ ln -s ../10-ifcfg-rh-routes.sh %{buildroot}%{_sysconfdir}/%{name}/dispatcher.d/n
rm -f %{buildroot}%{_libdir}/*.la
rm -f %{buildroot}%{_libdir}/pppd/%{ppp_version}/*.la
rm -f %{buildroot}%{_libdir}/NetworkManager/*.la
rm -f %{buildroot}%{nmplugindir}/*.la
# Ensure the documentation timestamps are constant to avoid multilib conflicts
find %{buildroot}%{_datadir}/gtk-doc -exec touch --reference configure.ac '{}' \+
@ -610,8 +611,9 @@ fi
%{_libexecdir}/nm-dhcp-helper
%{_libexecdir}/nm-dispatcher
%{_libexecdir}/nm-iface-helper
%dir %{_libdir}/NetworkManager
%{_libdir}/NetworkManager/libnm-settings-plugin*.so
%dir %{_libdir}/%{name}
%dir %{nmplugindir}
%{nmplugindir}/libnm-settings-plugin*.so
%if %{with nmtui}
%exclude %{_mandir}/man1/nmtui*
%endif
@ -641,35 +643,35 @@ fi
%if %{with adsl}
%files adsl
%{_libdir}/%{name}/libnm-device-plugin-adsl.so
%{nmplugindir}/libnm-device-plugin-adsl.so
%else
%exclude %{_libdir}/%{name}/libnm-device-plugin-adsl.so
%exclude %{nmplugindir}/libnm-device-plugin-adsl.so
%endif
%if %{with bluetooth}
%files bluetooth
%{_libdir}/%{name}/libnm-device-plugin-bluetooth.so
%{nmplugindir}/libnm-device-plugin-bluetooth.so
%endif
%if %{with team}
%files team
%{_libdir}/%{name}/libnm-device-plugin-team.so
%{nmplugindir}/libnm-device-plugin-team.so
%endif
%if %{with wifi}
%files wifi
%{_libdir}/%{name}/libnm-device-plugin-wifi.so
%{nmplugindir}/libnm-device-plugin-wifi.so
%endif
%if %{with wwan}
%files wwan
%{_libdir}/%{name}/libnm-device-plugin-wwan.so
%{_libdir}/%{name}/libnm-wwan.so
%{nmplugindir}/libnm-device-plugin-wwan.so
%{nmplugindir}/libnm-wwan.so
%endif
%if %{with ovs}
%files ovs
%{_libdir}/%{name}/libnm-device-plugin-ovs.so
%{nmplugindir}/libnm-device-plugin-ovs.so
%{systemd_dir}/NetworkManager.service.d/NetworkManager-ovs.conf
%{_mandir}/man7/nm-openvswitch.7*
%endif
@ -677,7 +679,7 @@ fi
%if %{with ppp}
%files ppp
%{_libdir}/pppd/%{ppp_version}/nm-pppd-plugin.so
%{_libdir}/%{name}/libnm-ppp-plugin.so
%{nmplugindir}/libnm-ppp-plugin.so
%endif
%if %{with libnm_glib}

View file

@ -141,7 +141,8 @@ cflags = [
'-DLOCALEDIR="@0@"'.format(nm_localedir),
'-DNMCONFDIR="@0@"'.format(nm_pkgconfdir),
'-DNMLIBDIR="@0@"'.format(nm_pkglibdir),
'-DNMPLUGINDIR="@0@"'.format(nm_plugindir)
'-DNMPLUGINDIR="@0@"'.format(nm_plugindir),
'-DNMVPNDIR="@0@"'.format(nm_vpndir)
]
if enable_json_validation

View file

@ -262,7 +262,7 @@ _nm_vpn_editor_plugin_load (const char *plugin_name,
if (do_file_checks) {
if ( !strchr (plugin_name, '/')
&& !g_str_has_suffix (plugin_name, ".la")) {
plugin_filename_free = g_module_build_path (NMPLUGINDIR, plugin_name);
plugin_filename_free = g_module_build_path (NMVPNDIR, plugin_name);
plugin_filename = plugin_filename_free;
}
}

View file

@ -287,7 +287,7 @@ pkg.generate(
variables: [
'exec_prefix=${prefix}',
'libgnome_serverdir=' + nm_libexecdir,
'plugindir=' + nm_plugindir,
'plugindir=' + nm_vpndir,
'configdir=' + nm_pkgconfdir
]
)

View file

@ -25,6 +25,12 @@ nm_id_prefix = 'NM'
nm_gir_version = '1.0'
# Distribution version string
dist_version = get_option('dist_version')
if dist_version == ''
dist_version = nm_version
endif
nm_prefix = get_option('prefix')
nm_bindir = join_paths(nm_prefix, get_option('bindir'))
nm_datadir = join_paths(nm_prefix, get_option('datadir'))
@ -45,7 +51,8 @@ nm_pkgincludedir = join_paths(nm_includedir, nm_name)
nm_pkglibdir = join_paths(nm_prefix, 'lib', nm_name)
nm_pkgrundir = join_paths(nm_runstatedir, nm_name)
nm_pkgstatedir = join_paths(nm_localstatedir, nm_name)
nm_plugindir = join_paths(nm_libdir, nm_name)
nm_vpndir = join_paths(nm_libdir, nm_name)
nm_plugindir = join_paths(nm_libdir, nm_name, dist_version)
libnm_name = 'libnm'
@ -259,11 +266,7 @@ if config_plugins_default == ''
endif
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_PLUGINS', config_plugins_default)
# Distribution version string
dist_version = get_option('dist_version')
if dist_version != ''
config_h.set_quoted('NM_DIST_VERSION', dist_version)
endif
config_h.set_quoted('NM_DIST_VERSION', dist_version)
enable_wifi = get_option('wifi')
config_h.set10('WITH_WIFI', enable_wifi)
@ -885,6 +888,7 @@ output += ' nmlibdir: ' + nm_pkglibdir + '\n'
output += ' nmdatadir: ' + nm_pkgdatadir + '\n'
output += ' nmstatedir: ' + nm_pkgstatedir + '\n'
output += ' nmrundir: ' + nm_pkgrundir + '\n'
output += ' nmvpndir: ' + nm_vpndir + '\n'
output += ' nmplugindir: ' + nm_plugindir + '\n'
output += '\nPlatform:\n'
output += ' session tracking: ' + ','.join(session_trackers) + '\n'