Fix crash when mandoc install

This commit is contained in:
li-long315 2023-06-30 16:54:55 +08:00 committed by li-long315
parent 266d2e839a
commit cb155ebbf5

View File

@ -2,7 +2,7 @@
Name: man-db
Version: 2.11.0
Release: 2
Release: 3
Summary: Online database for using man pages
License: GPLv2+ and GPLv3+
URL: http://www.nongnu.org/man-db/
@ -17,6 +17,10 @@ BuildRequires: gcc systemd gdbm-devel gettext groff less libpipeline-devel zli
BuildRequires: po4a perl-interpreter perl-version make chrpath
Requires: coreutils grep groff-base gzip less crontabs
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
Provides: man = %{version} man-pages-reader = %{version} bundled(gnulib) = 20140202
Obsoletes: man < 2.0
Provides: man-db-cron
@ -72,11 +76,42 @@ chrpath -d %{buildroot}%{_libdir}/%{name}/libmandb-%{version}.so
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "/usr/lib64/man-db" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf
# rename files for alternative usage
for f in man apropos whatis; do
mv %{buildroot}%{_bindir}/$f %{buildroot}%{_bindir}/$f.%{name}
touch %{buildroot}%{_bindir}/$f
mv %{buildroot}%{_mandir}/man1/$f.1 %{buildroot}%{_mandir}/man1/$f.%{name}.1
touch %{buildroot}%{_mandir}/man1/$f.1
done
%pre
for f in man apropos whatis; do
[ -L %{_bindir}/$f ] || %{__rm} -f %{_bindir}/$f >/dev/null 2>&1 || :
[ -L %{_mandir}/man1/$f.1.gz ] || %{__rm} -f %{_mandir}/man1/$f.1.gz >/dev/null 2>&1 || :
done
if [ -e /usr/lib/systemd/system/mandb.timer ]; then
if test -d /run/systemd; then
systemctl stop man-db.timer >/dev/null 2>&1 || :
systemctl -q disable man-db.timer >/dev/null 2>&1 || :
fi
fi
%preun
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove man %{_bindir}/man.%{name} >/dev/null 2>&1 || :
fi
%post
# set up the alternatives files
%{_sbindir}/update-alternatives --install %{_bindir}/man man %{_bindir}/man.%{name} 300 \
--slave %{_bindir}/apropos apropos %{_bindir}/apropos.%{name} \
--slave %{_bindir}/whatis whatis %{_bindir}/whatis.%{name} \
--slave %{_mandir}/man1/man.1.gz man.1.gz %{_mandir}/man1/man.%{name}.1.gz \
--slave %{_mandir}/man1/apropos.1.gz apropos.1.gz %{_mandir}/man1/apropos.%{name}.1.gz \
--slave %{_mandir}/man1/whatis.1.gz whatis.1.gz %{_mandir}/man1/whatis.%{name}.1.gz \
>/dev/null 2>&1 || :
# clear the old cache
%{__rm} -rf %{cache}/* || :
/sbin/ldconfig
@ -94,6 +129,11 @@ if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
fi
%postun
if [ $1 -ge 1 ]; then
if [ "$(readlink %{_sysconfdir}/alternatives/man)" == "%{_bindir}/man.%{name}" ]; then
%{_sbindir}/update-alternatives --set man %{_bindir}/man.%{name} >/dev/null 2>&1 || :
fi
fi
/sbin/ldconfig
%files -f %{name}.lang -f %{name}-gnulib.lang
@ -107,9 +147,6 @@ fi
%config(noreplace) /etc/ld.so.conf.d/*
%{_unitdir}/man-db-cache-update.service
%{_sbindir}/accessdb
%{_bindir}/man
%{_bindir}/whatis
%{_bindir}/apropos
%{_bindir}/manpath
%{_bindir}/lexgrog
%{_bindir}/catman
@ -124,6 +161,16 @@ fi
/usr/lib/systemd/system/man-db.service
/usr/lib/systemd/system/man-db.timer
%verify(not mtime) %dir %{cache}
%ghost %{_bindir}/man
%ghost %{_bindir}/apropos
%ghost %{_bindir}/whatis
%{_bindir}/man.%{name}
%{_bindir}/whatis.%{name}
%{_bindir}/apropos.%{name}
# documentation and translation
%ghost %{_mandir}/man1/man.1*
%ghost %{_mandir}/man1/apropos.1*
%ghost %{_mandir}/man1/whatis.1*
%lang(da) %{_datadir}/man/da/man*/*
%lang(de) %{_datadir}/man/de/man*/*
%lang(es) %{_datadir}/man/es/man*/*
@ -139,12 +186,12 @@ fi
%lang(sv) %{_datadir}/man/sv/man*/*
%lang(tr) %{_datadir}/man/tr/man*/*
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%{_mandir}/man1/apropos.1*
%{_mandir}/man1/man.%{name}.1*
%{_mandir}/man1/apropos.%{name}.1*
%{_mandir}/man1/whatis.%{name}.1*
%{_mandir}/man1/lexgrog.1*
%{_mandir}/man1/man.1*
%{_mandir}/man1/manconv.1*
%{_mandir}/man1/manpath.1*
%{_mandir}/man1/whatis.1*
%{_mandir}/man1/man-recode.1*
%{_mandir}/man5/manpath.5*
%{_mandir}/man8/accessdb.8*
@ -169,6 +216,9 @@ fi
%{_mandir}/ro/man8/mandb.8.gz
%changelog
* Fri Jun 30 2023 lilong <lilong@kylinos.cn> - 2.11.0-3
- Fix crash when mandoc install
* Sat Jun 17 2023 yanglongkang <yanglongkang@h-partners.com> - 2.11.0-2
- Fix crash when processing stray cats