Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm currently have both Lenny and Squeeze installations.

I want to know how to:

  • list of all packages which are upgradable
  • know their current and future package numbers
  • have the changes (ChangeLog) for all of them between current/future version numbers
  • without actually upgrading anything

As a plus, I'd get this information without super user rights.

When I do aptitude update && aptitude upgrade I only see the packages; when I've installed apt-listchanges I only see them once I commited to installed them (yes, I know I can abort it).

Maybe I do not yet want to download all of the packages (could be a lot of them), which means I'd have to fetch the ChangeLog from somewhere else (but this is not a requirement; downloading them would fit too, but would require super user rights).

Update

A deleted answers mentioned to take a look at apt-listchanges. Despite sounding redundant given my question, it's true that I didn't realize I can use apt-listchanges alone. The man page mentions the option --apt but I fail to understand which pipeline I need to construct (and if it meets my goals).

Update 2

I figured that with apt-show-versions I get a nice output; it's just that the ChangeLog is missing:

$ apt-show-versions -u
apache2/squeeze upgradeable from 2.2.16-6+squeeze1 to 2.2.16-6+squeeze2
apache2-mpm-worker/squeeze upgradeable from 2.2.16-6+squeeze1 to 2.2.16-6+squeeze2
apache2-utils/squeeze upgradeable from 2.2.16-6+squeeze1 to 2.2.16-6+squeeze2
apache2.2-bin/squeeze upgradeable from 2.2.16-6+squeeze1 to 2.2.16-6+squeeze2
apache2.2-common/squeeze upgradeable from 2.2.16-6+squeeze1 to 2.2.16-6+squeeze2
share|improve this question

1 Answer 1

Here is a draft of a bash/zsh script that prints everything you want. It works only for upgradable packages, not for any new package which is installed because of changed dependencies. It does not work correctly for security or stable updates. And if http://packages.debian.org/changelogs/ is not up-to-date (does not include the version to which could be updated), it prints all changelog entries. Another issue (or feature if you want) is, that it prints the entries per binary package, not per source-package. Therefore you probably get duplications. You see, there is much room for improvements. It needs the apt-show-versions installed.

#!/bin/bash
FLAVOURS=(main contrib non-free)
TEMPFILE=$(mktemp)
trap "rm -f $TEMPFILE; exit" SIGHUP SIGINT SIGTERM

apt-show-versions -u | while read PACKAGE A B FROM C TO ; do
         PACKAGE=${PACKAGE%%/*}
         SOURCEPACKAGE=$(dpkg-query -W -f '${Source}' $PACKAGE)
         SOURCEPACKAGE=${SOURCEPACKAGE%% *}
         SOURCEPACKAGE=${SOURCEPACKAGE:-$PACKAGE}
         PREFIX=${SOURCEPACKAGE:0:1}
         if expr match $SOURCEPACKAGE "lib.*" > /dev/null ; then
            PREFIX=${SOURCEPACKAGE:0:4}
         fi      
         echo Changelog for $PACKAGE from $FROM to $TO
         for i in $FLAVOURS ; do
                if wget -q "http://packages.debian.org/changelogs/pool/$i/$PREFIX/$SOURCEPACKAGE/current/changelog.txt" -O $TEMPFILE ; then
                    dpkg-parsechangelog --since "$FROM" --to "$TO" -l$TEMPFILE | sed -e "1,/Changes:/d"
                    break   
                fi      
         done    
         echo    
   done
rm $TEMPFILE

If you do not need all the information in an automated way, you can use the user interface of aptitude. There you can see which packages can be upgraded and you get the corresponding changelog with the new entries highlighted by pressing C.

share|improve this answer
    
I know I can download them "somewhere", but I'm really seeking for a solution which automates all of this. I need a textual list I can safe somewhere, not working inside a tool and going through the data. –  mark Mar 13 '12 at 10:55
    
As you wrote in your update 2 that you already can get the old and new package versions, "only" a script need to be written which gets and filters the corresponding changelog entries. For this, I included the url to the changelogs. –  jofel Mar 13 '12 at 11:31
    
I've improved my answer by adding a script which should really answer your question. –  jofel Mar 13 '12 at 14:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.