Getting rid of update-alternative in cross toolchain packages

Steve Langasek steve.langasek at linaro.org
Tue Mar 15 16:09:55 UTC 2011


On Tue, Mar 15, 2011 at 01:00:04PM +0100, Marcin Juszkiewicz wrote:
> Some time ago I looked at cross toolchain packages to find how they
> handle installation of several versions at same time. It was done by
> using 'update-alternatives' tool and was broken. We fixed it during
> Ubuntu/Maverick cycle but "u-a" is still in use (just versions are used
> now to take care of priority so latest gcc is default one).

> But this is different then native gcc which is selected by gcc-defaults
> package - /usr/bin/gcc is symlink to /usr/bin/gcc-DEFAULTVERSION (where
> DEFAULTVERSION value depends on architecture and distribution). Ok, we
> have gcc-defaults-armel-cross in Ubuntu but it takes care only of
> depending on default versions of cross toolchain components.

> I filled a bug [1] about it and discussed it with Matthias Klose. The
> proper way would consists those steps:

> - new cross packages will use "u-a remove" to get rid of old alternative
>   stuff (in postinst and prerm)
> - new gcc-defaults-armel-cross package will provide
>   /usr/bin/arm-linux-gnueabi-APP symlinks
> - new gcc-defaults-armel-cross will also conflicts with older versions
>   of cross toolchain packages

From the bug report:

4. alter postinst/prerm of gcc-4.[45]-armel-cross to remove old u-a: TODO

This should be done in the preinst instead.  Rationale: update-alternatives
is part of dpkg, so doesn't require any Pre-Depends; and a dependency (such
as the gcc-arm-linux-gnueabi dependency on gcc-4.5-arm-linux-gnueabi) does
not prevent one package from being unpacked before the postinst of another
package it depends on has been run.  So if you do this in the postinst, you
get:

 - gcc-4.5-arm-linux-gnueabi unpacked (enforced by the Conflicts: from
   gcc-arm-linux-gnueabi)
 - gcc-arm-linux-gnueabi unpacked; overwrites /usr/bin/arm-linux-gnueabi-gcc
   symlink
 - gcc-4.5-arm-linux-gnueabi configured; u-a remove runs, removing the
   symlink
 - gcc-arm-linux-gnueabi configured - but the gcc symlink is now missing

Otherwise, this looks ok.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.linaro.org/pipermail/linaro-dev/attachments/20110315/0b460406/attachment.pgp>


More information about the linaro-dev mailing list