From fa5a433922fa317a9ed2227a9f7c05d15f78228b Mon Sep 17 00:00:00 2001 From: lilong Date: Mon, 22 Apr 2024 14:54:17 +0800 Subject: [PATCH 1/2] test --- mandoc.spec | 75 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/mandoc.spec b/mandoc.spec index a182ce5..76cbde0 100644 --- a/mandoc.spec +++ b/mandoc.spec @@ -17,6 +17,9 @@ BuildRequires: zlib-devel BuildRequires: perl-interpreter BuildRequires: perl(IPC::Open3) +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +Requires(preun): %{_sbindir}/update-alternatives # The shared library package has been removed per discussion with the # upstream maintainer. If using the library, the static library is @@ -24,11 +27,6 @@ BuildRequires: perl(IPC::Open3) Provides: libmandoc = %{version}-%{release} Obsoletes: libmandoc <= 1.14.5-10 -Conflicts: groff -Conflicts: groff-full -Conflicts: makewhat -Conflicts: man - %description mandoc is a suite of tools compiling mdoc, the roff macro language of choice for BSD manual pages, and man, the predominant historical language for UNIX @@ -87,26 +85,75 @@ export CC=clang # Ensure headers do not have the execute bit set chmod -x %{buildroot}%{_includedir}/*.h +# rename files for alternative usage +for f in man apropos whatis soelim; do + # Rename binary executables + mv %{buildroot}%{_bindir}/$f %{buildroot}%{_bindir}/$f.%{name} + + # Rename corresponding man pages + mv %{buildroot}%{_mandir}/man1/$f.1 %{buildroot}%{_mandir}/man1/$f.%{name}.1 +done %check env LD_LIBRARY_PATH="$PWD" %make_build regress +%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 \ + --slave %{_mandir}/man1/soelim.1.gz soelim.1.gz %{_mandir}/man1/soelim.%{name}.1.gz \ + >/dev/null 2>&1 || : %files %license LICENSE %{_bindir}/demandoc %{_bindir}/mandoc -%{_bindir}/apropos -%{_bindir}/man -%{_bindir}/soelim -%{_bindir}/whatis + +%ghost %{_bindir}/apropos +%{_bindir}/apropos.%{name} + +%ghost %{_bindir}/man +%{_bindir}/man.%{name} + +%ghost %{_bindir}/soelim +%{_bindir}/soelim.%{name} + +%ghost %{_bindir}/whatis +%{_bindir}/whatis.%{name} + %{_sbindir}/makewhatis %{_mandir}/man1/demandoc.1.gz %{_mandir}/man1/mandoc.1.gz -%{_mandir}/man1/apropos.1.gz -%{_mandir}/man1/man.1.gz -%{_mandir}/man1/soelim.1.gz -%{_mandir}/man1/whatis.1.gz + +%ghost %{_mandir}/man1/soelim.1* +%{_mandir}/man1/soelim.%{name}.* + +%{_mandir}/man1/man.%{name}.1* +%{_mandir}/man1/apropos.%{name}.1* +%{_mandir}/man1/whatis.%{name}.1* + %{_mandir}/man5/mandoc.conf.5.gz %{_mandir}/man5/mandoc.db.5.gz %{_mandir}/man7/eqn.7.gz @@ -136,7 +183,7 @@ env LD_LIBRARY_PATH="$PWD" %make_build regress %{_mandir}/man3/tbl.3* %changelog -* Fri Mar 29 2024 lilong - 1.14.6-4 +* Mon Apr 15 2024 lilong - 1.14.6-4 - Fix crash when mandoc install * Mon Oct 9 2023 laokz - 1.14.6-3 -- Gitee From 6ce0d2db3b0fc7c938ba6af5b63472694b29faa2 Mon Sep 17 00:00:00 2001 From: lilong Date: Wed, 24 Apr 2024 17:09:48 +0800 Subject: [PATCH 2/2] Fix low-level dependency compilation failure --- mandoc.spec | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mandoc.spec b/mandoc.spec index 76cbde0..baacc1e 100644 --- a/mandoc.spec +++ b/mandoc.spec @@ -1,6 +1,6 @@ Name: mandoc Version: 1.14.6 -Release: 4 +Release: 5 Summary: A suite of tools for compiling mdoc and man License: ISC @@ -130,30 +130,25 @@ fi %license LICENSE %{_bindir}/demandoc %{_bindir}/mandoc - %ghost %{_bindir}/apropos %{_bindir}/apropos.%{name} - %ghost %{_bindir}/man %{_bindir}/man.%{name} - %ghost %{_bindir}/soelim %{_bindir}/soelim.%{name} - %ghost %{_bindir}/whatis %{_bindir}/whatis.%{name} - %{_sbindir}/makewhatis %{_mandir}/man1/demandoc.1.gz %{_mandir}/man1/mandoc.1.gz - %ghost %{_mandir}/man1/soelim.1* %{_mandir}/man1/soelim.%{name}.* - +%ghost %{_mandir}/man1/man.1* +%ghost %{_mandir}/man1/apropos.1* +%ghost %{_mandir}/man1/whatis.1* %{_mandir}/man1/man.%{name}.1* %{_mandir}/man1/apropos.%{name}.1* %{_mandir}/man1/whatis.%{name}.1* - %{_mandir}/man5/mandoc.conf.5.gz %{_mandir}/man5/mandoc.db.5.gz %{_mandir}/man7/eqn.7.gz @@ -183,6 +178,9 @@ fi %{_mandir}/man3/tbl.3* %changelog +* Mon Apr 22 2024 lilong - 1.14.6-5 +- Fix low-level dependency compilation failure + * Mon Apr 15 2024 lilong - 1.14.6-4 - Fix crash when mandoc install -- Gitee