summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-03-18 20:38:49 +0100
committerLubomir Rintel <lkundrak@v3.sk>2018-05-14 16:05:12 +0200
commit320422e4cf47e6ea36023294fa926f8c8c99d127 (patch)
treefa98f095bf4b57592e141b1a984ad7b52104648a
parentbade13129bac52698d3add3658f39316e1a45f3f (diff)
downloadNetworkManager-320422e4cf47e6ea36023294fa926f8c8c99d127.tar.gz
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.
-rw-r--r--Makefile.am13
-rw-r--r--configure.ac7
-rw-r--r--contrib/fedora/rpm/NetworkManager.spec26
-rw-r--r--libnm-core/meson.build3
-rw-r--r--libnm-core/nm-vpn-editor-plugin.c2
-rw-r--r--libnm-glib/meson.build2
-rw-r--r--meson.build16
7 files changed, 39 insertions, 30 deletions
diff --git a/Makefile.am b/Makefile.am
index 68faf421e1..1d5c8bfa06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)
diff --git a/configure.ac b/configure.ac
index 8c0014316a..8adef88731 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
index c03b7c32ad..618e6178b0 100644
--- a/contrib/fedora/rpm/NetworkManager.spec
+++ b/contrib/fedora/rpm/NetworkManager.spec
@@ -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}
diff --git a/libnm-core/meson.build b/libnm-core/meson.build
index 135f363f35..9d49edaeb8 100644
--- a/libnm-core/meson.build
+++ b/libnm-core/meson.build
@@ -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
diff --git a/libnm-core/nm-vpn-editor-plugin.c b/libnm-core/nm-vpn-editor-plugin.c
index 32e2a4edf2..d690d9b06b 100644
--- a/libnm-core/nm-vpn-editor-plugin.c
+++ b/libnm-core/nm-vpn-editor-plugin.c
@@ -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;
}
}
diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build
index 3fc14d547d..9583362b61 100644
--- a/libnm-glib/meson.build
+++ b/libnm-glib/meson.build
@@ -287,7 +287,7 @@ pkg.generate(
variables: [
'exec_prefix=${prefix}',
'libgnome_serverdir=' + nm_libexecdir,
- 'plugindir=' + nm_plugindir,
+ 'plugindir=' + nm_vpndir,
'configdir=' + nm_pkgconfdir
]
)
diff --git a/meson.build b/meson.build
index 4564c5632a..ff87b31e7d 100644
--- a/meson.build
+++ b/meson.build
@@ -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'