Mailinglist Archive: opensuse-packaging (284 mails)

< Previous Next >
Re: [opensuse-packaging] RPM how to change a directory to a link

Hello,

On Feb 3 13:10 Frederic Crozat wrote (excerpt):
Le jeudi 03 février 2011 à 13:06 +0100, Philipp Thomas a écrit :
* Johannes Meixner (jsmeix@xxxxxxx) [20110203 12:58]:

What is the officially blessed method to support such a change
in the software in the RPM package of such a software?

RPM doesn't support it and AFAIK there is no workaround.

there is one :

in the %pre of the new package, check if the offending
path is directory and if it is, rm -fr it..
Ugly but it works..

Ugly and it does not work in any case.

Assume in foo-1.rpm there is
/somewhere/foo/
/somewhere/foo/somefile

But in foo-2.rpm this was changed to
/somewhere/foo -> /elsewhere/bar/
/elsewhere/bar/
/elsewhere/bar/somefile

Now assume somehow "rm -r /somewhere/foo" happens before
the files in foo-2.rpm are installed (it does not matter
if the user root does it manually or via RPM preinstall
scriptlet in foo-2.rpm).

This makes things even worse because:

Now "rpm --upgrade foo" does not show erros but results
a broken installation because in the end
/elsewhere/bar/somefile is not installed.


Reasoning:

During "rpm --upgrade foo" RPM detects that /somewhere/foo/somefile
is an obsolete file (no longer in the files list of foo-2.rpm).

Then RPM installs the cpio archive in foo-2.rpm which
results those new stuff installed on the harddisk:
/somewhere/foo -> /elsewhere/bar/
/elsewhere/bar/
/elsewhere/bar/somefile

Finally RPM removes the obsolete files, in particular it removes
/somewhere/foo/somefile which exists because of the link
/somewhere/foo -> /elsewhere/bar/ so that RPM removes
the new installed /elsewhere/bar/somefile which results
a broken installation and "rpm --verify foo" shows the mess:
------------------------------------------------------------------
missing /elsewhere/bar/somefile
------------------------------------------------------------------


I found a workaround with sophisticated awkward hacks
in the RPM spec file plus a special RPM scriplet (the
basic idea is to get the stuff out of RPM's file list).

But such a workaround will cause more issues in the future.
In the worst case it will cause an endless sequence
of further workarounds for workarounds for workarounds...


In the end this means that currently it is not possible
to make a sound RPM package when a directory is replaced
by a symbolic link.

But from a software developer point of view it should be
perfectly o.k. to replace a directory by a link.

One may think about a rename and a compatibility link
why such a change might be done in a software.


Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex
< Previous Next >
Follow Ups