rpm -- cleaning up conflicting stray files in %pre ineffective?

Panu Matilainen pmatilai at laiskiainen.org
Tue Aug 19 11:01:27 UTC 2008


On Tue, 19 Aug 2008, Martin Langhoff wrote:

> Hi,
>
> I am dealing with cleaning up after a really misbehaved package that
> instead of installing files to their actual destination, it installed
> them in a /here.go.files/ tree and them symlinked them in %post . This
> means that the files are in place, but "undeclared" from rpm's POV.
>
> This symlinking only affects ~50 paths, so my strategy has been to
>
> - in %pre walk the list of 'bad links' paths, and remove those that are symlink
> - install the file with normal rpm means, declare it in spec, etc
>
> However, this does not seem to work. During upgrades I get 'warning:
> /path/foo created as /path/foo.rpmnew'. After the install is complete,
> /path/foo does not exist however, so we are left with only
> /path/foo.rpmnew.
>
> I suspect that at install/upgrade time rpm computes the conflicts
> _before_ %pre runs.
>
> Any hints?

%pretrans runs before the conflicts calculations. You just need to be very 
careful not to make assumptions about the installation environment: on 
initial install (chroot installs, anaconda...) the environment where 
%pretrans runs will be completely empty, not even shell is present there. 
The only thing that can reliably run on %pretrans is embedded Lua (ie 
%pretrans -p <lua>) and you can only use what the embedded Lua offers for 
path/file manipulation. You probably don't want to go this way, unless 
you're really desperate :)

 	- Panu -




More information about the fedora-devel-list mailing list