On Mon, Nov 18, 2013 at 01:31:32PM -0800, Adam Williamson wrote:
On Mon, 2013-11-18 at 00:44 +0100, Mattias Ellert wrote:
> sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:
> > Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64
however fails with
> > Transaction check error:
> > file /usr/share/applications/xflr5.desktop from install of
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
> > package xflr5-6.09.05-4.fc21.x86_64
>
> You are replacing a directory with an ordinary file. The requires a
> %pretrans script. %pretrans scripts must be written in lua:
>
> %pretrans -p <lua>
> st = posix.stat("%{_datadir}/applications/%{name}.desktop")
> if st and st.type == "directory" then
> os.execute("rm -rf %{_datadir}/applications/%{name}.desktop")
> end
We had more or less this conversation a couple of months back in the
context of unbundling webapps. At the time it became clear we really
don't have any best practice for lua snippets for these cases (file ->
directory, directory -> file). I was hoping someone was gonna come up
with something, but no-one has. I've seen different snippets of vastly
different complexity suggested by different people...
I think that putting
work-arounds for this in multiple packages (where
multiple means more than one), is insane from a software engineering
point-of-view. If rpm has trouble with this case bacause it makes it
hard to implement a transaction, then there's no way that instead
individual packagers are going to implement it in package
scripts. There's just no way that all those snippets are all going to
work correctly, *and* it wastes a *lot* of maintainer time. This must
be fixed in rpm.
Zbyszek