Thanks gil! Unfortunately this:
%pretrans javadoc -p <lua>
dir = "%{_javadocdir}/%{name}"
dummy = posix.readlink(dir) and os.remove(dir)
doesn't work (the old Javadoc directory is not removed).
This on its own:
%pre javadoc
[ $1 -gt 1 ] && [ -L %{_javadocdir}/%{name} ] && \
rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || :
doesn't work because rpm still sees a conflict between the old %{name}
symlink and the new %{name} directory.
Using both together doesn't work either, because the %pretrans
scriptlet removes the %{name} symlink, so the %pre scriptlet then
doesn't find it (so the readlink would fail anyway).
See this message I just posted to the devel list:
https://lists.fedoraproject.org/pipermail/devel/2013-December/193266.html
This:
%pretrans
[ -L %{_javadocdir}/%{name} ] && \
rm -rfv $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || :
kind of works (tested with a bare-bones 'test' package, *not*
findbugs-javadoc), although rpm emits a warning because the old
%{name}-%{version} directory doesn't exist when it comes to erase it.
(It doesn't warn about the files inside the old directory, though -
because it doesn't try to erase them in the first place.)
Regards,
Rich
--
Richard Fearn
richardfearn(a)gmail.com