Accepting request 762248 from home:lnussel:branches:Documentation
- update-alternatives --remove must be in %postun - own mandoc.db - add file triggers to update mandoc.db OBS-URL: https://build.opensuse.org/request/show/762248 OBS-URL: https://build.opensuse.org/package/show/Documentation/mandoc?expand=0&rev=3
This commit is contained in:
parent
a5c88651a8
commit
ab6d848091
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 9 10:13:07 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
|
||||
|
||||
- update-alternatives --remove must be in %postun
|
||||
- own mandoc.db
|
||||
- add file triggers to update mandoc.db
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 16 14:43:39 CET 2019 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
69
mandoc.spec
69
mandoc.spec
@ -82,6 +82,9 @@ for man in eqn man mdoc roff tbl ; do
|
||||
ln -s -f %{_sysconfdir}/alternatives/$man.7 "$from"
|
||||
done
|
||||
|
||||
# ghost
|
||||
: > %{buildroot}%{_mandir}/mandoc.db
|
||||
|
||||
%post
|
||||
update-alternatives --install \
|
||||
%{_bindir}/man man %{_bindir}/man.mandoc 1000 \
|
||||
@ -97,13 +100,68 @@ update-alternatives --install \
|
||||
--slave %{_mandir}/man7/mdoc.7%{?ext_man} mdoc.7%{?ext_man} %{_mandir}/man7/mdoc-mandoc.7%{?ext_man} \
|
||||
--slave %{_mandir}/man7/roff.7%{?ext_man} roff.7%{?ext_man} %{_mandir}/man7/roff-mandoc.7%{?ext_man} \
|
||||
--slave %{_mandir}/man7/tbl.7%{?ext_man} tbl.7%{?ext_man} %{_mandir}/man7/tbl-mandoc.7%{?ext_man}
|
||||
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
update-alternatives --remove man %{_bindir}/man.mandoc
|
||||
if [ -x %{_sbindir}/makewhatis ]; then
|
||||
%{_sbindir}/makewhatis
|
||||
fi
|
||||
|
||||
%postun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
update-alternatives --remove man %{_bindir}/man.mandoc
|
||||
fi
|
||||
|
||||
%filetriggerin -p <lua> -- %{_mandir}
|
||||
-- TODO: replace with rpm.execute after rpm 4.15
|
||||
function execute(path, ...)
|
||||
local pid = posix.fork()
|
||||
if pid == 0 then
|
||||
posix.exec(path, ...)
|
||||
io.write(path, ": exec failed: ", posix.errno(), "\n")
|
||||
os.exit(1)
|
||||
end
|
||||
if not pid then
|
||||
error(path .. ": fork failed: " .. posix.errno() .. "\n")
|
||||
end
|
||||
posix.wait(pid)
|
||||
end
|
||||
--
|
||||
-- makewhatis may not exist if update-alternatives did not create it
|
||||
-- yet. Also, no point registering individual files if we can call
|
||||
-- makewhatis in %%post to catch all
|
||||
if posix.access("%{_sbindir}/makewhatis") and posix.access("%{_mandir}/mandoc.db") then
|
||||
file = rpm.next_file()
|
||||
while file do
|
||||
if string.match(file, "%{_mandir}/man[^/]+/[^/]+%{?ext_man}$") then
|
||||
execute("%{_sbindir}/makewhatis", "-d", "%{_mandir}", file)
|
||||
end
|
||||
file = rpm.next_file()
|
||||
end
|
||||
end
|
||||
|
||||
%filetriggerun -p <lua> -- %{_mandir}
|
||||
-- TODO: replace with rpm.execute after rpm 4.15
|
||||
function execute(path, ...)
|
||||
local pid = posix.fork()
|
||||
if pid == 0 then
|
||||
posix.exec(path, ...)
|
||||
io.write(path, ": exec failed: ", posix.errno(), "\n")
|
||||
os.exit(1)
|
||||
end
|
||||
if not pid then
|
||||
error(path .. ": fork failed: " .. posix.errno() .. "\n")
|
||||
end
|
||||
posix.wait(pid)
|
||||
end
|
||||
--
|
||||
if posix.access("%{_sbindir}/makewhatis") and posix.access("%{_mandir}/mandoc.db") then
|
||||
file = rpm.next_file()
|
||||
while file do
|
||||
if string.match(file, "%{_mandir}/man[^/]+/[^/]+%{?ext_man}$") then
|
||||
execute("%{_sbindir}/makewhatis", "-u", "%{_mandir}", file)
|
||||
end
|
||||
file = rpm.next_file()
|
||||
end
|
||||
end
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc NEWS TODO
|
||||
@ -117,6 +175,7 @@ fi
|
||||
%{_mandir}/man5/*.5%{?ext_man}
|
||||
%{_mandir}/man7/*.7%{?ext_man}
|
||||
%{_mandir}/man8/*.8%{?ext_man}
|
||||
%ghost %{_mandir}/mandoc.db
|
||||
%ghost %{_sysconfdir}/alternatives/man
|
||||
%ghost %{_sysconfdir}/alternatives/apropos
|
||||
%ghost %{_sysconfdir}/alternatives/soelim
|
||||
|
Loading…
x
Reference in New Issue
Block a user