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

From: Marius Gedminas marius at pov.lt
Date: Fri Oct 16 19:08:01 EEST 2009
On Fri, Oct 16, 2009 at 03:06:43PM +0100, Andrew Flegg wrote:
> On Fri, Oct 16, 2009 at 14:58, Marius Vollmer <marius.vollmer at nokia.com> wrote:
> > ext Thomas Perl <th.perl at gmail.com> writes:
> >
> >> 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
> >>         else
> >>             create symlinks inside the directory
> >>         endif
> >>     endif
> >> endfor
> 
> So, the problem with this is removing content underneath that dir
> installed by something else.
> 
> > What about a slight variation:
> >
> > for each (symlinkname in the package) do
> >    if (symlinkname should point to /opt) and (symlinkname is a directory) then
> >        cp -a symlinkname/* to /opt/maemo/symlinkname/

I hope no package ships with dotfiles in directories other packages want
to optify.

> >        rm -rf symlinkname
> >        ln -s /opt/maemo/symlinkname symlinkname
> >    endif
> > endfor
> >
> > This would migrate the existing files and would establish a symlink
> > structure that matches what is in the package.
> 
> So, let's imagine:
> 
>     mygame_0.0.1        has /usr/share/mygame/
>     mygame-extras_0.0.1 has /usr/share/mygame/extras.xml
> 
>     mygame_0.0.2        has /usr/share/mygame -> /opt/maemo/usr/share/mygame/
> 
> When mygame v0.0.2 is installed, what will happen when
> mygame-extras_0.0.1 is uninstalled? Is dpkg clever enough to follow
> the /usr/share/mygame symlink and delete
> /opt/maemo/usr/share/mygame/extras.xml?

/opt is a symlink to /home/opt.

Packages that contain files in /opt/maemo/... can be installed and
uninstalled successfully.

I think this might just work, but what a hack!

> > (What a hack.)
> 
> Yeah, but not entirely unelegant ;-)

I'd also like to bring up error handling: if /opt is almost full and you
cannot migrate existing files, it would be bad to leave things in a
broken state.

Marius Gedminas
-- 
Java has a huge standard library, and Python's standard library is either even
larger or much smaller, depending upon whether you are talking about
functionality, or lines of code. ;-)
        -- Simon Brunning
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.maemo.org/pipermail/maemo-developers/attachments/20091016/23ab8570/attachment.pgp 
More information about the maemo-developers mailing list