Alternatives policy

Материал из Rosalab Wiki
Перейти к: навигация, поиск
This page explains how to manage coexisting different versions of a same software in ROSA Linux.

Policy

When

If any of the following statements are true, you have to introduce a parallel version instead of replacing current one:

  • this is an unstable version, and the stable one is already present in cooker
  • this version is not compatible with the old one, and you are not able to create migration scripts which automatically reconfigure the new version with the old settings


How

Naming

So as to allow different versions to coexist, the new one must use a different name. This should be the name of the package, with the major version appended directly. Exceptions:

  • If the package name ends with a number, an underscore must be intercaled between the name and the major version.
  • If another parallel version already exist, major and minor version must be used.

There should always be a default version, without suffix, so as to have urpmi foo install foo.


Requires

you must add the following requirements to the spec file:

Requires(post):     update-alternatives
Requires(postun):   update-alternatives


Installation

For %postun you need to test for the existence of the alternative in order to allow dropping the alternatively cleanly in the future:

# This is *correct*:
%postun
if [ ! -e %{_bindir}/emacs-nox ]; then
  update-alternatives --remove emacs %{_bindir}/emacs-nox
fi

# This is *wrong*:
%postun
if [ $1 -eq 0 ]; then
  update-alternatives --remove emacs %{_bindir}/emacs-nox
fi

Different scenarios:

  • no parallel installation: the new version must be tagged as conflicting with the existing one
  • parallel installation without alternative
  • parallel installation with alternative


Examples

Gimp

gimp and gimp2_2 are in the distro, gimp2_2 is the default.

This is WRONG, the default version of a package should be the simpler one, so that a urpmi gimp always install the default choosen version of a package.

The correct naming would be to have gimp (version 2.2) and gimp1.3.

MySQL

MySQL version 4.0 is in the distro, and you want to include the new development version MySQL-4.1.

The new package should be named MySQL41.

Postgresql

Postgresql 7.4.6 is in the distro, you want to keep it but you want to include, as default, the new postgresql 8.0.

You must rename the old postgresql to postgresql7 (or postgresql74) and use the name 'postgresql' for the new package.


Note:
This Policy is based on the Mandriva Alternatives Policy.