Package Management – Diff’ing Different Versions of the Same Debian Package

developmentmotupackage-management

Is there any way to get source diffs between a locally-installed package and its updated one?
This will be useful to check exactly which parts have been fixed, changed or added.

For example, say you have the linux-libc-dev package installed on your system and

sudo apt-get update && sudo apt-get upgrade

shows

The following packages will be upgraded:
  linux-libc-dev 

but you want to check, before upgrading it, the exact changes that have been made compared to your local version of the same package.

How can we do it?

Best Answer

Here's another solution I hacked together: whatchanged.

It takes the name of the binary package you're interested in as the only argument. To use a recent SRU as an example:

./whatchanged python_papyon

This is what it does:

  1. Check if there's an update candidate; exit if there's none
  2. If a candidate exists, create temporary directories and fetch the source packages for both the installed version and the candidate into them
  3. Compare the two with debdiff and output to stdout (you'll probably want to redirect for easier reading)
  4. Clean up the temporary directories.

It probably needs to better handle certain things that may go wrong during source retrieval, the flow control is probably a bit off, and there must be more elegant ways for version checking, but it worked fine in my limited testing so far. For now, consider it a quick hack that works, and improvements are most welcome. I'll push it to a bzr repository and/or create a Launchpad project if it's useful to a few people.

Edit: Rather than let it rot on pastebin, I've started a Launchpad project for it; you can get the latest trunk revision with bzr branch lp:whatchanged. Feel free to report bugs, branch it, rewrite it in Perl, etc.

Related Question