Accepting request 919476 from home:schubi2

Use libalternatives instead of update-alternatives.

OBS-URL: https://build.opensuse.org/request/show/919476
OBS-URL: https://build.opensuse.org/package/show/Base:System/dbus-1?expand=0&rev=304
This commit is contained in:
Simon Lees 2021-09-16 09:31:14 +00:00 committed by Git OBS Bridge
parent 7bd2317d01
commit cdb990ae1f
4 changed files with 85 additions and 1 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 4 10:04:12 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jul 16 21:28:10 UTC 2020 - Matthias Eliasson <elimat@opensuse.org> Thu Jul 16 21:28:10 UTC 2020 - Matthias Eliasson <elimat@opensuse.org>

View File

@ -16,6 +16,12 @@
# #
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%define _name dbus %define _name dbus
%define _libname libdbus-1-3 %define _libname libdbus-1-3
%if 0%{?suse_version} <= 1320 %if 0%{?suse_version} <= 1320
@ -45,8 +51,13 @@ BuildRequires: libtool
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: pkgconfig(libsystemd) >= 209 BuildRequires: pkgconfig(libsystemd) >= 209
BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(x11)
%if %{with libalternatives}
Requires: alts
Requires(pre): update-alternatives
%else
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(preun):update-alternatives Requires(preun):update-alternatives
%endif
Supplements: (dbus-1 and libX11-6) Supplements: (dbus-1 and libX11-6)
Provides: dbus-launch Provides: dbus-launch
%if %{with selinux} %if %{with selinux}
@ -94,9 +105,27 @@ tdir=$(mktemp -d)
make DESTDIR=$tdir install make DESTDIR=$tdir install
mkdir -p %{buildroot}/%{_bindir} mkdir -p %{buildroot}/%{_bindir}
mv $tdir/%{_bindir}/dbus-launch %{buildroot}/%{_bindir}/dbus-launch.x11 mv $tdir/%{_bindir}/dbus-launch %{buildroot}/%{_bindir}/dbus-launch.x11
%if ! %{with libalternatives}
# create symlinks for update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/dbus-launch %{buildroot}%{_bindir}/dbus-launch ln -s -f %{_sysconfdir}/alternatives/dbus-launch %{buildroot}%{_bindir}/dbus-launch
%else
# create entries for libalternatives
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/dbus-launch
mkdir -p %{buildroot}%{_datadir}/libalternatives/dbus-launch
cat > %{buildroot}%{_datadir}/libalternatives/dbus-launch/20.conf <<EOF
binary=%{_bindir}/dbus-launch.x11
group=dbus-launch
EOF
%endif
%if %{with libalternatives}
%pre
# removing old update-alternatives entries
if [ "$1" > 0 ] ; then
%{_sbindir}/update-alternatives --remove dbus-launch %{_bindir}/dbus-launch.x11
fi
%else
%post %post
%{_sbindir}/update-alternatives --install %{_bindir}/dbus-launch dbus-launch %{_bindir}/dbus-launch.x11 20 %{_sbindir}/update-alternatives --install %{_bindir}/dbus-launch dbus-launch %{_bindir}/dbus-launch.x11 20
@ -104,9 +133,16 @@ ln -s -f %{_sysconfdir}/alternatives/dbus-launch %{buildroot}%{_bindir}/dbus-lau
if [ "$1" = 0 ] ; then if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove dbus-launch %{_bindir}/dbus-launch.x11 %{_sbindir}/update-alternatives --remove dbus-launch %{_bindir}/dbus-launch.x11
fi fi
%endif
%files %files
%if ! %{with libalternatives}
%ghost %{_sysconfdir}/alternatives/dbus-launch %ghost %{_sysconfdir}/alternatives/dbus-launch
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/dbus-launch
%{_datadir}/libalternatives/dbus-launch/20.conf
%endif
%{_bindir}/dbus-launch %{_bindir}/dbus-launch
%{_bindir}/dbus-launch.x11 %{_bindir}/dbus-launch.x11

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 4 10:03:46 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Apr 7 22:35:58 UTC 2021 - Dirk Müller <dmueller@suse.com> Wed Apr 7 22:35:58 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@ -16,6 +16,12 @@
# #
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%define with_systemd 1 %define with_systemd 1
%define _name dbus %define _name dbus
%define _libname libdbus-1-3 %define _libname libdbus-1-3
@ -48,10 +54,15 @@ BuildRequires: sysuser-tools
BuildRequires: xmlto BuildRequires: xmlto
BuildRequires: pkgconfig(libsystemd) >= 209 BuildRequires: pkgconfig(libsystemd) >= 209
Requires(post): %{_libname} = %{version} Requires(post): %{_libname} = %{version}
Requires(post): update-alternatives
Requires(post): diffutils Requires(post): diffutils
Requires(pre): permissions Requires(pre): permissions
%if %{with libalternatives}
Requires: alts
Requires(pre): update-alternatives
%else
Requires(post): update-alternatives
Requires(preun):update-alternatives Requires(preun):update-alternatives
%endif
Provides: dbus-launch Provides: dbus-launch
%sysusers_requires %sysusers_requires
%if %{with selinux} %if %{with selinux}
@ -161,8 +172,19 @@ ln -sf /%{_bindir}/dbus-update-activation-environment %{buildroot}/bin/dbus-upda
ln -sf /%{_bindir}/dbus-uuidgen %{buildroot}/bin/dbus-uuidgen ln -sf /%{_bindir}/dbus-uuidgen %{buildroot}/bin/dbus-uuidgen
%endif %endif
%if ! %{with libalternatives}
# create symlinks for update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/dbus-launch %{buildroot}%{_bindir}/dbus-launch ln -s -f %{_sysconfdir}/alternatives/dbus-launch %{buildroot}%{_bindir}/dbus-launch
%else
# create entries for libalternatives
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/dbus-launch
mkdir -p %{buildroot}%{_datadir}/libalternatives/dbus-launch
cat > %{buildroot}%{_datadir}/libalternatives/dbus-launch/10.conf <<EOF
binary=%{_bindir}/dbus-launch.nox11
group=dbus-launch
EOF
%endif
find %{buildroot} -type f -name "*.la" -delete -print find %{buildroot} -type f -name "*.la" -delete -print
@ -176,6 +198,12 @@ rm -Rf %{buildroot}%{_datadir}/doc/dbus
%pre -f messagebus.pre %pre -f messagebus.pre
%service_add_pre dbus.service dbus.socket %service_add_pre dbus.service dbus.socket
%if %{with libalternatives}
# removing old update-alternatives entries
if [ "$1" > 0 ] ; then
%{_sbindir}/update-alternatives --remove dbus-launch %{_bindir}/dbus-launch.nox11
fi
%endif
%post %post
if [ -e %{_localstatedir}/lib/dbus/machine-id -a -e %{_sysconfdir}/machine-id ]; then if [ -e %{_localstatedir}/lib/dbus/machine-id -a -e %{_sysconfdir}/machine-id ]; then
@ -191,14 +219,18 @@ fi
/sbin/ldconfig /sbin/ldconfig
%set_permissions %{_libexecdir}/dbus-1/dbus-daemon-launch-helper %set_permissions %{_libexecdir}/dbus-1/dbus-daemon-launch-helper
%if ! %{with libalternatives}
%{_sbindir}/update-alternatives --install %{_bindir}/dbus-launch dbus-launch %{_bindir}/dbus-launch.nox11 10 %{_sbindir}/update-alternatives --install %{_bindir}/dbus-launch dbus-launch %{_bindir}/dbus-launch.nox11 10
%endif
%service_add_post dbus.service dbus.socket %service_add_post dbus.service dbus.socket
%tmpfiles_create %{_prefix}/lib/tmpfiles.d/dbus.conf %tmpfiles_create %{_prefix}/lib/tmpfiles.d/dbus.conf
%preun %preun
%if ! %{with libalternatives}
if [ "$1" = 0 ] ; then if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove dbus-launch %{_bindir}/dbus-launch.nox11 %{_sbindir}/update-alternatives --remove dbus-launch %{_bindir}/dbus-launch.nox11
fi fi
%endif
%service_del_preun dbus.service dbus.socket %service_del_preun dbus.service dbus.socket
%postun %postun
@ -259,7 +291,13 @@ fi
%{_userunitdir}/dbus.socket %{_userunitdir}/dbus.socket
%dir %{_userunitdir}/sockets.target.wants %dir %{_userunitdir}/sockets.target.wants
%{_userunitdir}/sockets.target.wants/dbus.socket %{_userunitdir}/sockets.target.wants/dbus.socket
%if ! %{with libalternatives}
%ghost %{_sysconfdir}/alternatives/dbus-launch %ghost %{_sysconfdir}/alternatives/dbus-launch
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/dbus-launch
%{_datadir}/libalternatives/dbus-launch/10.conf
%endif
%{_bindir}/dbus-launch.nox11 %{_bindir}/dbus-launch.nox11
%{_bindir}/dbus-launch %{_bindir}/dbus-launch