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
Getting rid of symlinks was accepted during Emdebian sprint so such change will be done in gcc-4.[3456] source packages. gcc-defaults for other cross architectures then armel will need to be done for Emdebian.
What do you think about such plan?
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.
On 15.03.2011 17:09, Steve Langasek wrote:
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:
- 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.
+1. just make sure that your additions to the maintainer scripts are only made for the cross builds, not for the native builds.
thanks, Matthias