How do I see the changelog for a debian/ubuntu deb package?

585

Solution 1

Alternatively if the deb is also in the repository and you want to know older versions changelog, you can use apt-get changelog package to read all the changelog. For example for openssl:

apt-get changelog libssl1.0.0

Solution 2

apt-listchanges is a nice package to have around, but without having a deb file around your best bet most probably is to read the Debian changelog from /usr/share/doc/somepackage/changelog.Debian.gz.

Create a shell function with:

function debchanglog () {
  zless "/usr/share/doc/$1/changelog.Debian.gz"
}

Solution 3

To extend on Janne Pikkarainen's answer, here is an alias that can be used to read the changelog.Debian.gz for any given package:

alias changelog="xargs -I% -- zless /usr/share/doc/%/changelog.Debian.gz <<<"

It can be used like so:

changelog PACKAGE

Please note however that this is a terribly hackish solution and is not recommended under most circumstances. A function or standalone script is a much better solution.

Here is a function that reads all available changelogs for PACKAGE:

changelog(){
    if (( $# != 1 )); then
        echo "Usage: ${FUNCNAME[0]} PACKAGE"
        return 1
    fi

    find -L "/usr/share/doc/$1" -type f -name 'changelog*.gz' -exec zless {} \; 2>/dev/null
}

Here is a function that prints a list of all available changelogs for PACKAGE and queries the user to select which one to read:

changelog(){
    if (( $# != 1 )); then
        echo "Usage: ${FUNCNAME[0]} PACKAGE"
        return 1
    fi

    local changelog changelogs

    readarray -t changelogs < <(find -L "/usr/share/doc/$1" -type f -name 'changelog*.gz' 2>/dev/null)

    if (( ${#changelogs[@]} == 0 )); then
        return 0
    elif (( ${#changelogs[@]} == 1 )); then
        zless "${changelogs[0]}"
        return $?
    fi

    select changelog in "${changelogs[@]}" EXIT; do
        case $changelog in
            '')
                echo "ERROR: Invalid selection" >&2
                continue
                ;;
            EXIT)
                return 0
                ;;
            *)
                zless "$changelog"
                return $?
                ;;
        esac            
    done
}

Solution 4

In Ubuntu 18.04+, the modern version of apt can do this (as opposed to apt-get):

ubuntu18-04:~% apt changelog nginx
nginx (1.14.0-0ubuntu1.9) bionic-security; urgency=medium

  * SECURITY UPDATE: DNS Resolver issues
    - debian/patches/CVE-2021-23017-1.patch: fixed off-by-one write in
      src/core/ngx_resolver.c.
    - debian/patches/CVE-2021-23017-2.patch: fixed off-by-one read in
      src/core/ngx_resolver.c.
    - CVE-2021-23017
...
Share:
585

Related videos on Youtube

victor
Author by

victor

Updated on September 17, 2022

Comments

  • victor
    victor over 1 year

    I need to parse the following

    model { 
    
    // any content, including brackets {}
    
    var x= {} ; 
    
    // any content, including brackets {}
    }
    

    If I do it like this :

    model : MODEL OBR modelBody CBR;
    
    modelBody: modelBodyLine;
    
    modelBodyLine: TEXT* (OBR TEXT* CBR)* TEXT*;
    
    TEXT : ('a'..'z'|'A'..'Z'| '_' | '-')+ ;
    OBR: '{';
    CBR: '}';
    

    I get this error

    warning(200): /SWL Parser/src/ro/sft/swl/language/parser/SWL.g:46:16: Decision can match input such as "TEXT" using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that input |---> modelBodyLine: TEXT* (OBR TEXT* CBR)* TEXT*;

    So what would be the best way to parse it ?

    • Admin
      Admin over 10 years
      @J.F.Sebastian apt-get doesn't have such a command.
    • Admin
      Admin over 10 years
      @gipi: apt-get changelog apt | grep -C5 'apt-get changelog' shows that this command is introduced in apt (0.8.9ubuntu1) natty (2010). You can get the source (it is open-source after all): run apt-get source apt and find cmdline/apt-get.cc file and look at DoChangelog() function (btw, look at DoMoo() function).
    • Admin
      Admin over 10 years
      strange, I have the (debian) apt 0.9.12.1 and this command is not available.
    • Admin
      Admin over 3 years
      I know the question is old, but it would be nice if you accept an answer.
  • victor
    victor almost 11 years
    Thanks for the answer. Problem is that if I try to parse something like model { some text } it goes into an infinite loop. The grammar is this : model : MODEL modelBody; modelBody: genericBlock; genericBlock : OBR ( ~(OBR | CBR) | genericBlock )* CBR ; . Hope you can spot the problem :)
  • victor
    victor almost 11 years
    another pattern which causes infinite loop: model { var cv =; }
  • Sam Harwell
    Sam Harwell almost 11 years
    You have a lexer rule which is able to match an empty string (such as WS : '\t'*; when it should be WS : '\t'+;) and you have some input which no lexer rule matches.
  • Six
    Six over 8 years
    As the OP alluded to, debchange is actually an existing tool in devscripts used for creating changelog entries. So I'd strongly recommend choosing another name. Also, $0 will probably not do what you're expecting. In my case, it will always execute zless /usr/share/doc/bash/changelog.Debian.gz. In your case, replace bash with the name of the shell or script you are executing it from.
  • Dmitri DB
    Dmitri DB almost 8 years
    This is definitely the relevant answer for 2016 in both Debian Jessie and Ubuntu :)
  • chris94
    chris94 over 6 years
    This is the correct answer.