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

View File

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

View File

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

View File

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

View File

@@ -262,7 +262,7 @@ _nm_vpn_editor_plugin_load (const char *plugin_name,
if (do_file_checks) { if (do_file_checks) {
if ( !strchr (plugin_name, '/') if ( !strchr (plugin_name, '/')
&& !g_str_has_suffix (plugin_name, ".la")) { && !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; plugin_filename = plugin_filename_free;
} }
} }

View File

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

View File

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