SHA256
3
0
forked from pool/dpkg
dpkg/update-alternatives.spec
Tomáš Chvátal 5cf1016a45 Accepting request 544381 from home:dimstar:Factory
- Migrate u-a data from /var/lib/rpm instead of relying on dbpath:
  no u-a version ever installed files explicitly into dbpath, but
  always hard specified /var/lib/rpm. The fact that RPM moved its
  database is irrelevant to update-alternatives. In case RPM moved
  it's database, our files are still accessible via the
  /var/lib/rpm symlink being put in place.
- Drop the arbitrary depenency on a specific rpm version: the idea
  was to ensure to have an rpm with the new dbpath location in
  place. For one, the dependency does not work as intended, and
  2nd, as the migration now happens explicitly from the old u-a
  admindir without relying on dbpath, is no longer needed.

OBS-URL: https://build.opensuse.org/request/show/544381
OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=55
2017-11-22 11:15:53 +00:00

106 lines
3.6 KiB
RPMSpec

#
# spec file for package update-alternatives
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: update-alternatives
Version: 1.18.23
Release: 0
Summary: Maintain symbolic links determining default commands
License: GPL-2.0+
Group: System/Management
URL: http://ftp.de.debian.org/debian/pool/main/d/dpkg/
Source0: http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_%{version}.tar.xz
Source3: sensible-editor
Patch0: update-alternatives-suse.patch
# PATCH-FIX-SUSE: update if two alternatives have same priority bnc#969171
Patch7: 0001-In-case-of-equal-priority-rather-update.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
Requires(post): coreutils
Requires(post): update-alternatives
Provides: alternatives = %{version}
%description
update-alternatives creates, removes, maintains and displays
information about the symbolic links comprising the alternatives
system. It is possible for several programs fulfilling the same or
similar functions to be installed on a single system at the same time.
For example, many systems have several text editors installed at once.
This gives choice to the users of a system, allowing each to use a
different editor, if desired, but makes it difficult for a program to
make a good choice of editor to invoke if the user has not specified a
particular preference.
%prep
%setup -q -n dpkg-%{version}
%patch0 -p1
%patch7 -p1
%build
autoreconf -fvi
%configure \
--disable-silent-rules \
--with-admindir=%{_localstatedir}/lib
make -C lib/compat %{?_smp_mflags}
make -C utils/ %{?_smp_mflags}
make -C man/ %{?_smp_mflags}
%install
install -d -m 0755 %{buildroot}/%{_sbindir}/
install -d -m 0755 %{buildroot}/%{_mandir}/man1/
install -d -m 0755 %{buildroot}/%{_sysconfdir}/alternatives
install -d -m 0755 %{buildroot}%{_localstatedir}/lib/alternatives
install -d -m 0755 %{buildroot}/%{_localstatedir}/log
install -pm 0755 utils/%{name} %{buildroot}/%{_sbindir}
ln -s %{name} %{buildroot}/%{_sbindir}/alternatives
install -pm 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/
%post
# Migrate to new location
if [ -d var/lib/rpm/alternatives ]; then
echo "migrating update alternatives database to new location"
# We proceed even if no alternatives directory exists, such situation
# occurs in buildroot environment (we can't buildrequire package
# itself).
mv -f var/lib/rpm/alternatives/* /var/lib/alternatives/ || :
rmdir var/lib/rpm/alternatives ||:
fi
touch %{_localstatedir}/log/alternatives.log
# Fix broken alternatives list bnc#969171
cd %{_sysconfdir}/alternatives/
for i in $(ls .) ; do
# continue on errors
update-alternatives --auto $i 2>/dev/null || :
done
%files
%doc COPYING
%dir %{_sysconfdir}/alternatives
%dir %{_localstatedir}/lib/alternatives
%{_sbindir}/alternatives
%{_sbindir}/update-alternatives
%{_mandir}/man1/update-alternatives.1%{ext_man}
%ghost %{_localstatedir}/log/alternatives.log
%changelog