How do I reliably determine on Ubuntu when the latest version of a package was made available?

reinierpost asked:

How to create a command, on Ubuntu, to report when the latest version of a given package was released?

(I need to check this as part of proving that we install certain updates on certain servers within a given time.)

Right now, my script does the following:

  • issue apt-cache policy <packagename>
  • extract the repository URLs for the latest version
  • issue apt-cache show <packagename>
  • extract the URL path for the latest version
  • concatenate them
  • issue a HTTP HEAD request for the resulting URLs
  • report the Last-Modified header value

This assumes the local index is up to date (i.e. sudo apt-get update or equivalent has been run recently enough). That is fine with me.

Apart from that assumption, how reliable is this? Is there a better way?

My answer:


If you’re willing to scrape HTML, you can get the package release date for any package from launchpad.

Consider the recently released sudo package. For this example let’s say you are using Ubuntu 20.04 LTS (focal). You have the latest package, version 1.8.31-1ubuntu1.2. You can then fetch:

https://launchpad.net/ubuntu/+source/sudo/1.8.31-1ubuntu1.2/+publishinghistory

You will find its publishing dates in numerous places on this page. Pick whichever one you think you can get your script to parse most easily.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.