When you have to change the name of your package (e.g. for complying with policies) or you make a new package that is meant to replace the old one (e.g. gcc4.2 -> gcc4.3), you’ll have to deal with the fact that the other packages that use your old package as a dependency will not be immediately updated, or maybe never will. So, to overcome this issue, there is a useful trick: transitional packages.
Transitional packages are essentially proxies – packages that pull the correct dependencies when installed and can be removed without problems as soon as the installation finishes. Some of these packages also have scripts to make/ease the transition when it is necessary. With this package you’ll be able to ship your new/updated package without worrying breaking all the others that depend on it (provided that the funcionality stays the same) and then inform the maintainers that their packages need to be upgraded to the new version of the dependency.
As an example, suppose you used to maintain a package named foo that is used by other package, baz. You have made a completely new package, bar, and intend to completely replace foo. So, for making the transitional package, you add these lines to the debian/control file of bar:
Source: bar
Section: unknown
Priority: extra
Maintainer: Bruno Araujo <bru...@baraujo.net>
Build-Depends: cdbs, debhelper (>= 5), [bar build dependencies]
Standards-Version: 3.7.2
Package: bar
Architecture: any
Provides: foo
Replaces: foo (<< 0.1-2)
Conflicts: foo (<< 0.1-2)
Depends: ${shlibs:Depends}, ${misc:Depends}, [bar dependencies]
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
Package: foo
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, bar
Description: Transitional package for bar
This is a transitional package for foo, and can be safely removed
after the installation is complete.
The bold lines are the modification needed for providing the transitional package. Two modification were made:
- In the Package: bar section, three new keywords were added: Provides, Replaces and Conflics. They will be explained shortly.
- The transitional package must have the same name of the package you intend to replace. Usually a short explanation about the nature of the package is written.
The three keywords added to the bar package section are used to proper inform dpkg of the transitional package and to decide which actions will be taken should the need arise.
- The Provides keyword informs dpkg that the package bar provides a “virtual package” named foo (more details about virtual packages can be found on the Debian Policy)
- The package bar should not be installed at the same time as the old package foo, so the Conflicts keyword indicates this.
- If a conflict arises, the Replaces keyword indicates which package must be chosen for solving the conflict.
Now, when you try to install the package baz, the transitional package foo will be installed with its dependency bar, which is the correct dependency that should be used. For more details about these keywords, see sections 7.4-7.6 of the Debian Policy. Note that, in this case, the only transition was pulling the correct dependency; in other cases, when some extra works needs to be done before or after installing the package, one of the ways to do this work is including the necessary scripts and putting calls to them inside <package>.preinst (pre-installation) and <package>.postinst (post-installation) inside debian directory.
Sry for writing off topic but what WordPress template do you use? It looks interesting!!
Hi,
You are missing a problem (for which I do not know any solution) about auto/manual package.
If a user install the (old) package foo “apt-get install foo” and then upgrade its system when the new packages (new foo and bar) are available “apt-get dist-upgrade”, due to dependencies, bar will be pulled be new foo.
But, if, reading the description of new foo, the user type “apt-get remove foo”, then the next “apt-get autoremove” will remove bar…
Indeed, old foo was a package installed manually. bar has been installed automatically by new foo. apt-get and aptitude does not know anything (yet) about transitional packages. So, when removing new foo, apt-get and aptitude propose to also remove its dependencies…
I thing that the solution will require some logic into apt-get/aptitude AND some information in the package itself (transitions are not always a simple as one package replaced by one package). But nothing is done for now.
cf. also http://wiki.debian.org/Renaming_a_Package