Score:2

What is regarded as the "latest" version of a package by apt?

ru flag
oso

I am wondering what the behavior of apt is when publishing multiple major versions of the same package. For example, if I have a package called foo, with a latest version of 1.0.0, and I publish version 2.0.0, then publish version 1.1.0 afterwards, which will be regarded as the latest package when running sudo apt updateand sudo apt install foo: the last package published (in this case 1.1.0) or the package with the highest version number (in this case 2.0.0)?

Score:4
us flag

By default, apt downloads the package with highest version number (even if that was not the last published version).

However, if both packages are available in separate repositories, you can install the earlier version with sudo apt install foo=1.1.0.

Afterward, you can prevent that specific package from upgrading to version 2.0.0, sudo apt-mark hold foo.

(To revert this behavior, you will have to unhold the package).

Score:3
in flag

It's based on a several conditions that are evaluated in order:

  1. Package priority. Higher the priority, that specific package will be preferred, even if that means a "downgrade". If two packages are of the same priority, it will continue to
  2. Epoch. Is the number before a colon and it's usually meant to express a change in upstream versioning. If no epoch is specified, 0 is assumed.
  3. Upstream version. Is the bare version of the package, and is usually before the hyphen. It's evaluated as other version schemes that uses dots. Every value is evaluated positionally by groups divided by the dots, from left to right. The exact algorithm is described in the Debian Policy document.
  4. Debian's version. After the hyphen. Same as upstream version.

In other words, it will always try to install the higher version number, unless you include a different epoch or pin it using priorities. dpkg will ignore all this and only make sure that the dependencies are fulfilled.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.