How can I see all versions of a package that are available in the archive?

Is there a way I can see all the versions that are in the archives that I have configured in sources.list. I can see the last version of each archive withapt-get policy, but how can I see them all?

Is there any way that this can also include PPA and anything in sources.list.d?


Solution 1:

As far as I understand your requirements, the madison option for apt-cache does what you want:

madison /[ pkg(s) ]
apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information for the architecture for which APT has retrieved package lists (APT::Architecture).

On my computer:

$ apt-cache madison f-spot
    f-spot | 0.7.2-1~ppa~lucid0 | http://ppa.launchpad.net/f-spot/f-spot-ppa/ubuntu/ lucid/main Packages
    f-spot | 0.6.1.5-2ubuntu7 | http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
    f-spot | 0.6.1.5-2ubuntu6 | http://ro.archive.ubuntu.com/ubuntu/ lucid/main Packages
    f-spot | 0.6.1.5-2ubuntu6 | http://ro.archive.ubuntu.com/ubuntu/ lucid/main Sources
    f-spot | 0.6.1.5-2ubuntu7 | http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Sources

I hope this is what you need. It also includes the ppas.

Solution 2:

The command

apt list -a <package name>

is the equivalent of madison.

Solution 3:

The rmadison program from the devscripts package will remotely query the Ubuntu archive and give you the status of a package in all supported releases, not only those you have locally insatlled. This is slightly more than what you want, but should get the job done easily.

Example:

lfaraone@stone:~$ rmadison sudo
      sudo | 1.6.8p12-1ubuntu6 |        dapper | source, amd64, i386, powerpc
      sudo | 1.6.8p12-1ubuntu6.3 | dapper-security | source, amd64, i386, powerpc
      sudo | 1.6.8p12-1ubuntu6.3 | dapper-updates | source, amd64, i386, powerpc
      sudo | 1.6.9p10-1ubuntu3 |         hardy | source, amd64, i386
      sudo | 1.6.9p10-1ubuntu3.8 | hardy-security | source, amd64, i386
      sudo | 1.6.9p10-1ubuntu3.8 | hardy-updates | source, amd64, i386
      sudo | 1.6.9p17-1ubuntu3 |        jaunty | source, amd64, i386
      sudo | 1.6.9p17-1ubuntu3.3 | jaunty-security | source, amd64, i386
      sudo | 1.6.9p17-1ubuntu3.3 | jaunty-updates | source, amd64, i386
      sudo | 1.7.0-1ubuntu2 |        karmic | source, amd64, i386
      sudo | 1.7.0-1ubuntu2.4 | karmic-security | source, amd64, i386
      sudo | 1.7.0-1ubuntu2.4 | karmic-updates | source, amd64, i386
      sudo | 1.7.2p1-1ubuntu5 |         lucid | source, amd64, i386
      sudo | 1.7.2p1-1ubuntu5.1 | lucid-security | source, amd64, i386
      sudo | 1.7.2p1-1ubuntu5.1 | lucid-updates | source, amd64, i386
      sudo | 1.7.2p7-1ubuntu1 |      maverick | source, amd64, i386

before you can use rmadison you must install the devscripts package:

sudo apt-get install devscripts

Solution 4:

I don't know how (or why) you said apt-cache policy doesn't show all versions! I'm using this for several years now and It always showed all versions including the priority number.

Output of apt-cache policy nautilus

nautilus:
  Installed: 1:3.18.5-0ubuntu1~xenial1
  Candidate: 1:3.18.5-0ubuntu1~xenial1
  Version table:
 *** 1:3.18.5-0ubuntu1~xenial1 500
        500 file:/media/Linux/apt-repo/xenial1  Packages
        500 http://ppa.launchpad.net/budgie-remix/ppa/ubuntu xenial/main amd64 Packages
        500 http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     1:3.18.4.is.3.14.3-0ubuntu5 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     1:3.18.4.is.3.14.3-0ubuntu4 500
        500 file:/media/Linux/apt-repo/xenial1  Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
     1:3.14.2-0ubuntu13 500
        500 file:/media/Linux/apt-repo/wily  Packages

Output of apt-cache madison nautilus

  nautilus | 1:3.18.5-0ubuntu1~xenial1 | file:/media/Linux/apt-repo/xenial1  Packages
  nautilus | 1:3.18.5-0ubuntu1~xenial1 | http://ppa.launchpad.net/budgie-remix/ppa/ubuntu xenial/main amd64 Packages
  nautilus | 1:3.18.5-0ubuntu1~xenial1 | http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial/main amd64 Packages
  nautilus | 1:3.18.4.is.3.14.3-0ubuntu5 | http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
  nautilus | 1:3.18.4.is.3.14.3-0ubuntu4 | file:/media/Linux/apt-repo/xenial1  Packages
  nautilus | 1:3.18.4.is.3.14.3-0ubuntu4 | http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  nautilus | 1:3.14.2-0ubuntu13 | file:/media/Linux/apt-repo/wily  Packages

Only difference is that madison took some more time than policy and shorter version. But, policy is more useful to see which version get installed, which version is next candidate to be installed.

That's why I'd suggest always using apt-cache policy <package-name> instead.

Note about output: I have some local repository setup and both of the command shows those as well.

Note 2 Newer apt comes with policy integrated into them. So, you can use apt instead of apt-cache directly.