[maemo-developers] Optification breaks package on upgrade from non-optified older version

From: Thomas Perl th.perl at gmail.com
Date: Fri Oct 16 16:38:14 EEST 2009
2009/10/16 Mikko Vartiainen <mvartiainen at gmail.com>:
> On Fri, Oct 16, 2009 at 2:05 PM, Andrew Flegg <andrew at bleb.org> wrote:
>> On Fri, Oct 16, 2009 at 11:49, Mikko Vartiainen <mvartiainen at gmail.com> wrote:
>>> This would certainly work. maemo-optify should have option which prevents
>>> it from creating directory links.
>> Why would/should it be an option? From the sounds of it, it shouldn't
>> create directory symlinks; why would a package ever want them given
>> the problems it can cause?
> Other way around then. Option to create directory symlinks. They are
> useful for large data directories with hundreds or maybe thousands of
> files. Currently maemo-optify doesn't create links for files which are
> smaller than 2KB, but there could be hundreds (or thousands) of small
> files. Of course it's possible to install to /opt without using
> maemo-optify but I find it very easy use.

(Is there a bug tracker for maemo-optify? Couldn't find it on bugs.m.o :/)

Being able (as a packager) to tell maemo-optify would be very helpful
when installing packages with lots of small data files (icon themes, ...).

That said, the current problem (and the one I ran into, apparently) is the
fact that existing directories in packages will not be replaced with symbolic
links when upgrading packages.

I don't really know much about dpkg internals, but maybe it would be
possible for maemo-optify to add a small script to postinst that will do
something like this (in pseudocode):

for each (symlinkname in the package) do
    if (symlinkname points to /opt) and (symlinkname is a directory) then
        if (symlinkname is an empty directory) then
            remove directory, recreate correct symlink
            create symlinks inside the directory

In the case where the directory is empty, this works as expected and
should leave the same structure as a non-upgrade installation (essentially
fixing the bug I was experiencing). In cases where there directory is
non-empty, it will at least re-create a working symlink structure, but the
on-disk structure will not match the package contents, which could possibly
lead to problems with future upgrades.

At least the small code above without the last "else" code path should be
sane to add to maemo-optify to fix the upgrade directory/symlink bug?

More information about the maemo-developers mailing list