Use alternatives for soelim and roff.7

This commit is contained in:
Nikola Forró 2020-02-27 16:18:10 +01:00
parent 7c39ab17ec
commit 15ab40e41d

View File

@ -3,7 +3,7 @@
Summary: A document formatting system
Name: groff
Version: 1.22.3
Release: 21%{?dist}
Release: 22%{?dist}
License: GPLv3+ and GFDL and BSD and MIT
URL: http://www.gnu.org/software/groff/
Source: ftp://ftp.gnu.org/gnu/groff/groff-%{version}.tar.gz
@ -19,8 +19,14 @@ Patch3: 0004-don-t-use-usr-bin-env-in-shebang.patch
Patch4: 0005-Add-missing-rule-for-gropdf.patch
Requires: coreutils, groff-base = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
BuildRequires: gcc, gcc-c++
BuildRequires: git, netpbm-progs, perl-generators, psutils, ghostscript
Provides: nroff-i18n = %{version}-%{release}
Provides: bundled(gnulib)
@ -109,6 +115,14 @@ make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
# rename files for alternative usage
mv %{buildroot}%{_bindir}/soelim %{buildroot}%{_bindir}/soelim.%{name}
touch %{buildroot}%{_bindir}/soelim
mv %{buildroot}%{_mandir}/man1/soelim.1 %{buildroot}%{_mandir}/man1/soelim.%{name}.1
touch %{buildroot}%{_mandir}/man1/soelim.1
mv %{buildroot}%{_mandir}/man7/roff.7 %{buildroot}%{_mandir}/man7/roff.%{name}.7
touch %{buildroot}%{_mandir}/man7/roff.7
# some binaries need alias with 'g' or 'z' prefix
for file in g{nroff,troff,tbl,pic,eqn,neqn,refer,lookbib,indxbib,soelim} zsoelim; do
ln -s ${file#?} %{buildroot}%{_bindir}/${file}
@ -142,6 +156,41 @@ popd
# /bin/sed moved to /usr/bin/sed in Fedora
sed --in-place 's|#! /bin/sed -f|#! /usr/bin/sed -f|' %{buildroot}%{_datadir}/groff/%{version}/font/devps/generate/symbol.sed
%post
# set up the alternatives files
%{_sbindir}/update-alternatives --install %{_mandir}/man7/roff.7.gz roff.7.gz %{_mandir}/man7/roff.%{name}.7.gz 300 \
>/dev/null 2>&1 || :
%preun
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove roff.7.gz %{_mandir}/man7/roff.%{name}.7.gz >/dev/null 2>&1 || :
fi
%postun
if [ $1 -ge 1 ]; then
if [ "$(readlink %{_sysconfdir}/alternatives/roff.7.gz)" == "%{_mandir}/man7/roff.%{name}.7.gz" ]; then
%{_sbindir}/update-alternatives --set roff.7.gz %{_mandir}/man7/roff.%{name}.7.gz >/dev/null 2>&1 || :
fi
fi
%post base
# set up the alternatives files
%{_sbindir}/update-alternatives --install %{_bindir}/soelim soelim %{_bindir}/soelim.%{name} 300 \
--slave %{_mandir}/man1/soelim.1.gz soelim.1.gz %{_mandir}/man1/soelim.%{name}.1.gz \
>/dev/null 2>&1 || :
%preun base
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove soelim %{_bindir}/soelim.%{name} >/dev/null 2>&1 || :
fi
%postun base
if [ $1 -ge 1 ]; then
if [ "$(readlink %{_sysconfdir}/alternatives/soelim)" == "%{_bindir}/soelim.%{name}" ]; then
%{_sbindir}/update-alternatives --set soelim %{_bindir}/soelim.%{name} >/dev/null 2>&1 || :
fi
fi
%files
# data
%{_datadir}/%{name}/%{version}/font/devdvi/
@ -222,6 +271,7 @@ sed --in-place 's|#! /bin/sed -f|#! /usr/bin/sed -f|' %{buildroot}%{_datadir}/gr
%{_mandir}/man1/gindxbib.*
# groff processor documentation
%{_mandir}/man5/*
%ghost %{_mandir}/man7/roff.7*
%{_mandir}/man7/*
%{_infodir}/groff.info*
@ -306,7 +356,8 @@ sed --in-place 's|#! /bin/sed -f|#! /usr/bin/sed -f|' %{buildroot}%{_datadir}/gr
%{_bindir}/post-grohtml
%{_bindir}/pre-grohtml
%{_bindir}/preconv
%{_bindir}/soelim
%ghost %{_bindir}/soelim
%{_bindir}/soelim.%{name}
%{_bindir}/tbl
%{_bindir}/troff
%{_mandir}/man1/eqn.*
@ -317,7 +368,8 @@ sed --in-place 's|#! /bin/sed -f|#! /usr/bin/sed -f|' %{buildroot}%{_datadir}/gr
%{_mandir}/man1/nroff.*
%{_mandir}/man1/pic.*
%{_mandir}/man1/preconv.*
%{_mandir}/man1/soelim.*
%ghost %{_mandir}/man1/soelim.1*
%{_mandir}/man1/soelim.%{name}.*
%{_mandir}/man1/tbl.*
%{_mandir}/man1/troff.*
# compatibility symlinks
@ -410,6 +462,9 @@ sed --in-place 's|#! /bin/sed -f|#! /usr/bin/sed -f|' %{buildroot}%{_datadir}/gr
%doc %{_pkgdocdir}/pdf/
%changelog
* Wed Feb 26 2020 Nikola Forró <nforro@redhat.com> - 1.22.3-22
- Use alternatives for soelim and roff.7
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.22.3-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild