PackageDependencyManagement

Differences between revisions 1 and 19 (spanning 18 versions)
Revision 1 as of 2005-04-20 09:34:08
Size: 3908
Editor: 150
Comment: create
Revision 19 as of 2005-11-05 17:58:50
Size: 7241
Editor: 206_220_103_66-WIFI_HOTSPOTS
Comment: approver comments
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from UbuntuDevel/PackageDependencyManagement
Line 4: Line 5:
== Status == ##(see the SpecSpec for an explanation)
Line 6: Line 7:
  * Created: 20/04/05 by MarkShuttleworth[[BR]]
  * Priority: MediumPriority[[BR]]
  * People: NeedsLead, NeedsSecond[[BR]]
  * Contributors: MarkShuttleworth[[BR]]
  * Interested: [[BR]]
  * Status: BrainDump, UduBof, DistroSpecification[[BR]]
  * Branch: [[BR]]
  * Malone Bug: [[BR]]
  * Packages: [[BR]]
  * Depends: [[BR]]
 * '''Launchpad Entry''': https://launchpad.net/distros/ubuntu/+spec/dependency-removal
 * '''Created''': [[Date(2005-11-01T18:24:04Z)]] by MichaelVogt
 * '''Contributors''': MichaelVogt, DanielBurrows
 * '''Packages affected''': apt, aptitude
Line 24: Line 19:
Three primary improvements are envisaged: These primary improvements are envisaged:
Line 26: Line 21:
 1. The system needs to have some idea *why* a package was installed. Some
   
of the higher-level package management tools, such as Aptitude, already
   
do something similar to this. They track, for example, whether or not a
   
package was installed because of a specific request by the system
    admi
inistrator, or to satisfy the dependencies of a package that was
   
being installed. This allows them to offer to remove those dependency
   
packages when the chosen package is removed later.
 1. The system needs to have some idea '''why''' a package was installed. Some of the higher-level package management tools, such as `Aptitude`, already do something similar to this. They track, for example, whether or not a package was installed because of a specific request by the system administrator, or to satisfy the dependencies of a package that was being installed. This allows them to offer to remove those dependency packages when the chosen package is removed later.
Line 34: Line 23:
 1. Over time, it's inevitable that the Ubuntu team may choose to change
    the open source products preferred for specific functionality in an
   
Ubuntu system. For example, the Ubuntu developers might choose to
    migrate from
Postfix to Nullmailer, or from Esound to PolypAudio. For
   
new installations that presents no problem, someone installing the new
   
release will simply get the new apps. However, for someone upgrading, it
   
will be necessary to identify whether or not the user has modified any
   
configuration files for the relevant app, and if not, to migrate the
   
system to the new app.
 1. Over time, it is inevitable that the Ubuntu team may choose to change the open source products preferred for specific functionality in an Ubuntu system. For example, the Ubuntu developers might choose to migrate from `Postfix` to `Nullmailer`, or from `Esound` to `Polyp``Audio`. For new installations that presents no problem, someone installing the new release will simply get the new apps. However, for someone upgrading, it will be necessary to identify whether or not the user has modified any configuration files for the relevant app, and if not, to migrate the system to the new app.
Line 47: Line 28:
Traditionally, installing a package required installing its dependencies. Traditionally, installing a package requires installing its dependencies.
Line 50: Line 31:
never uninstalled. The end result is a plethora of unwanted and unneeded never uninstalled. The end result is a plethora of unwanted and un-needed
Line 63: Line 44:
 1. Jimmy installed Breezy, and has now updated to the next release. During
    the update, no matter which package management tool he uses, old
    dependencies will be removed and new ones installed. There should be no
    old libraries left on his system once the upgrade is complete.
 1. Annabel has installed openldap, and all of its dependencies were automatically installed on her system. Now she is going to remove it from this system using a different package manager. That package manager identifies packages that were installed purely in support of openldap, and offers to remove those too.
Line 68: Line 46:
 1. Annabel has installed openldap, and all of its dependencies were
    automatically installed on her system. Now she is going to remove it
    from this system using a different package manager. That package manager
    identifies packages that were installed purely in support of openldap,
    and offers to remove those too.
 1. Jimmy installed Breezy, and has now updated to the next release. During the update, no matter which package management tool he uses, old dependencies will be removed and new ones installed. There should be no old libraries left on his system once the upgrade is complete.
Line 74: Line 48:
 1. Jack is upgrading from Breezy to the next Ubuntu release. His system has
   
postfix installed, because that was the default mailserver in Breezy,
   
but he has never modified its configuration and so when he does the
   
update, postfix is removed and replaced with newmailer, the Ubuntu
   
team's chosen replacement for postfix in the new release.
 1. Jack is upgrading from Breezy to the next Ubuntu release. His system has postfix installed, because that was the default mail server in Breezy, but he has never modified its configuration and so when he does the update, postfix is removed and replaced with newmailer, the Ubuntu team's chosen replacement for postfix in the new release.
Line 80: Line 50:
== Design ==

For use case 1, we are going to mark each package `automatic` if it was installed only to satisfy a dependency. If a package is removed later, a `mark-and-sweep` algorithm is run that marks any package that is a direct or indirect dependency of a given root-set (essential+manually installed). Any package that is not marked is not required by a manually installed package and can be safely removed. Use case 2 will be converted because the installer will install packages based on their task information. The library dependencies will be pulled in automatically and marked auto. So on the next upgrade, any library that is no longer used on the system will be suggested to be removed automatically.

The use cases 3 is adressed by the upgrade tool discussed at https://wiki.ubuntu.com/AutomaticUpgrade. It will identify changes in meta-packages based on the information we provide and suggest the removal of the superseded packages.

Currently, all packages installed by the installer are installed via aptitude. That means that the auto-flag is set for a lot of the libraries but not for the installed applications. That means that, e.g., removing ubuntu-desktop will *not* result in the suggestion to automatically remove all of its dependencies.

'''MattZimmerman: regarding ubuntu-desktop, is this as intended? If the user installs kubuntu-desktop and decides that they want to remove ubuntu-desktop, should we not remove packages which were installed only to satisfy its dependencies? This could be achieved in a straightforward way by using the metapackages in the installer (the live CD build already uses the metapackages).'''
Line 84: Line 63:
For the use cases Number 1 the automark feature of aptitude needs to be ported to libapt. It should be easily accessible to all the frontends (apt-get.cc, synaptic, aptitude, python-apt).
Line 85: Line 66:

The current flags in aptitude will be converted automatically on the first run of aptitude.

'''MattZimmerman: what is involved in the conversion? Will it also be feasible for this data to be made available to Smart, for example?'''
Line 88: Line 73:
The `apt` package needs to be improved to provide support for the marking of automatic dependencies. This feature needs to be exported so that frontends like synaptic, python-apt can use it too.
Line 90: Line 77:
A new "apt autoremove" command will be added that removes unused automatically installed packages. Synaptic, python-apt, and aptitude must be updated to use this feature.

Applications are usually safe from being automatically removed because they are usually in the top of the dependency chain and will not be pulled in as a part of a dependency. Aptitude will work as before, synaptic will present packages that can be removed automatically but it will not mark them for removal automatically.

Line 91: Line 83:

A implementation is available in the michael.vogt@ubuntu.com--2005/apt--auto-mark--0 branch; it adds support for tracking automatic packages into the apt library and into apt-get. Close cooperation with Daniel Burrows (the aptitude author/maintainer) is taking place; he branched from the initial port and added the missing bits that he needed for aptitude. python-apt code is written as well, and a branch of aptitude exists which makes use of the new apt features and migrates its automatic markings to the global state file. All the code needs testing, and other frontends need to display and make use of this additional information.

Package Dependency Management

Introduction

This specification describes an enhancement to the information the system stores about packages that are installed locally. The goal is to improve the ability of systems to evolve over time to continue to reflect the current Ubuntu release.

These primary improvements are envisaged:

  1. The system needs to have some idea why a package was installed. Some of the higher-level package management tools, such as Aptitude, already do something similar to this. They track, for example, whether or not a package was installed because of a specific request by the system administrator, or to satisfy the dependencies of a package that was being installed. This allows them to offer to remove those dependency packages when the chosen package is removed later.

  2. Over time, it is inevitable that the Ubuntu team may choose to change the open source products preferred for specific functionality in an Ubuntu system. For example, the Ubuntu developers might choose to migrate from Postfix to Nullmailer, or from Esound to PolypAudio. For new installations that presents no problem, someone installing the new release will simply get the new apps. However, for someone upgrading, it will be necessary to identify whether or not the user has modified any configuration files for the relevant app, and if not, to migrate the system to the new app.

Rationale

Over time, a Linux system accumulates a substantial amount of cruft. Traditionally, installing a package requires installing its dependencies. Later, when that package is upgraded, new dependencies might be introduced and older ones dropped, but in most systems the old package dependencies are never uninstalled. The end result is a plethora of unwanted and un-needed libraries and supporting packages which take up disk space and potentially also slow down the day to day operation of the computer.

These improvements will make it easier to keep Ubuntu systems lean-and-mean over a series of releases, leaving only those packages which the Ubuntu team recommends, the packages explicitly selected by users, and the necessary dependencies required to support those packages.

Scope and Use Cases

The following use cases illustrate the ideas in this spec:

  1. Annabel has installed openldap, and all of its dependencies were automatically installed on her system. Now she is going to remove it from this system using a different package manager. That package manager identifies packages that were installed purely in support of openldap, and offers to remove those too.
  2. Jimmy installed Breezy, and has now updated to the next release. During the update, no matter which package management tool he uses, old dependencies will be removed and new ones installed. There should be no old libraries left on his system once the upgrade is complete.
  3. Jack is upgrading from Breezy to the next Ubuntu release. His system has postfix installed, because that was the default mail server in Breezy, but he has never modified its configuration and so when he does the update, postfix is removed and replaced with newmailer, the Ubuntu team's chosen replacement for postfix in the new release.

Design

For use case 1, we are going to mark each package automatic if it was installed only to satisfy a dependency. If a package is removed later, a mark-and-sweep algorithm is run that marks any package that is a direct or indirect dependency of a given root-set (essential+manually installed). Any package that is not marked is not required by a manually installed package and can be safely removed. Use case 2 will be converted because the installer will install packages based on their task information. The library dependencies will be pulled in automatically and marked auto. So on the next upgrade, any library that is no longer used on the system will be suggested to be removed automatically.

The use cases 3 is adressed by the upgrade tool discussed at https://wiki.ubuntu.com/AutomaticUpgrade. It will identify changes in meta-packages based on the information we provide and suggest the removal of the superseded packages.

Currently, all packages installed by the installer are installed via aptitude. That means that the auto-flag is set for a lot of the libraries but not for the installed applications. That means that, e.g., removing ubuntu-desktop will *not* result in the suggestion to automatically remove all of its dependencies.

MattZimmerman: regarding ubuntu-desktop, is this as intended? If the user installs kubuntu-desktop and decides that they want to remove ubuntu-desktop, should we not remove packages which were installed only to satisfy its dependencies? This could be achieved in a straightforward way by using the metapackages in the installer (the live CD build already uses the metapackages).

Implementation Plan

For the use cases Number 1 the automark feature of aptitude needs to be ported to libapt. It should be easily accessible to all the frontends (apt-get.cc, synaptic, aptitude, python-apt).

Data Preservation and Migration

The current flags in aptitude will be converted automatically on the first run of aptitude.

MattZimmerman: what is involved in the conversion? Will it also be feasible for this data to be made available to Smart, for example?

Packages Affected

The apt package needs to be improved to provide support for the marking of automatic dependencies. This feature needs to be exported so that frontends like synaptic, python-apt can use it too.

User Interface Requirements

A new "apt autoremove" command will be added that removes unused automatically installed packages. Synaptic, python-apt, and aptitude must be updated to use this feature.

Applications are usually safe from being automatically removed because they are usually in the top of the dependency chain and will not be pulled in as a part of a dependency. Aptitude will work as before, synaptic will present packages that can be removed automatically but it will not mark them for removal automatically.

Outstanding Issues

A implementation is available in the michael.vogt@ubuntu.com--2005/apt--auto-mark--0 branch; it adds support for tracking automatic packages into the apt library and into apt-get. Close cooperation with Daniel Burrows (the aptitude author/maintainer) is taking place; he branched from the initial port and added the missing bits that he needed for aptitude. python-apt code is written as well, and a branch of aptitude exists which makes use of the new apt features and migrates its automatic markings to the global state file. All the code needs testing, and other frontends need to display and make use of this additional information.

PackageDependencyManagement (last edited 2008-08-06 16:16:55 by localhost)