11

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?

Gödel
  • 1,811

5 Answers5

7

Afaik the only way to do this is to get the source and make the diff's your self. You can get the actual source used for compiling the packages with apt-get. fx:

apt-get source gwibber=2.30.2-0ubuntu3 gwibber=2.30.0.1-0ubuntu1
diff -rupN gwibber-2.30.0.1/ gwibber-2.30.2/

This will print out all differences between all files in a standard patch format.

5

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.

mgunes
  • 9,910
2

Here's one (probably not optimal) UDD way of doing it:

Pull -updates branch for your release (assuming Lucid) that (assumption follows) should contain the latest SRU:

bzr branch lp:ubuntu/lucid-updates/package_name

Get the changes introduced by the latest revision, which (assumption follows) should correspond to the latest SRU:

bzr diff -c`bzr revno`
mgunes
  • 9,910
0

If you want to see file differences in the package archives, extract their md5sums files, sort and diff those, and then you can narrow the list of actual files to compare dramatically.

-1

May not be the "exact" changes, but apt-listchanges lists the changelog entries for the changes that have been made since the installed version.

It works by adding a step after you finish downloading the new packages, but before the installation starts, where it shows you the changelog entry for each package about to be upgraded. You can then continue or cancel. You can install it with

sudo apt-get install apt-listchanges

then set it up with

sudo dpkg-reconfigure apt-listchanges
Zanna
  • 72,312
Ken Simon
  • 2,115