Debian – way to list packages from date when they entered Debian archive

aptdebiangreppackage-managementregular expression

I have asked numerous questions about apt and package management in the past. Not breaking with the tradition here's one more. After doing

$ sudo apt-get update 

Or/and

$ sudo apt update 

Is there a way to get listing of packages (descending) from when they entered in the Debian archive ?

Something similar to the new added packages sorted by age, but on the desktop . Let's say all packages which entered Debian archive and are in the /var/lib/apt/lists/ database.

Btw, I do regularly do $ sudo aptitude forget-new otherwise listing of new packages becomes too large to be useful in any way.

Looking forward to know.

Update :- I use zsh and here's my /etc/apt/sources.list

[$] cat /etc/apt/sources.list

     1   #### Debian stretch #########
     2  deb http://httpredir.debian.org/debian/ stretch main contrib non-free
     3  deb-src http://httpredir.debian.org/debian stretch main contrib non-free
     4  
     5   #### Debian unstable #########
     6  deb http://httpredir.debian.org/debian unstable main contrib non-free
     7  deb-src http://httpredir.debian.org/debian unstable main contrib 
     8  
     9   #### Debian experimental #########
    10  deb http://httpredir.debian.org/debian experimental main contrib 
    11  deb-src http://httpredir.debian.org/debian experimental main contrib
    12  
    13   ##### Debian Debug packages #######
    14  deb http://debug.mirrors.debian.org/debian-debug/ stretch-debug main
    15  deb http://debug.mirrors.debian.org/debian-debug/ unstable-debug main
    16  deb http://debug.mirrors.debian.org/debian-debug/ experimental-debug main
    17  
    18  ######## Third party repos #######
    19  deb https://riot.im/packages/debian/ stretch main
    20  
    21  ########## Non-free ########
    22  #deb http://www.deb-multimedia.org stretch main non-free

I am looking for package listing of all 'NEW' amd64 packages from last 3 months, not just packages installed on my system.

Best Answer

The information stored locally isn’t sufficient to build such a list: none of the files used to index repositories lists the date at which a package first became available.

The closest you can get, as far as I can see, is the first date mentioned in installed packages’ changelogs, which gives some approximation to the date at which the corresponding source package entered the archive. (The source aspect is significant since aptitude’s notion of new packages is based on binary packages.)

This can certainly be improved:

#!/bin/bash
for file in /usr/share/doc/*/changelog.Debian.gz; do
    package=${file:15}
    package=${package%%/*}
    echo -n "$package "
    date -d "$(zgrep "\\-\\- .* <.*>  .*" "${file}"|tail -n 1|awk 'BEGIN { FS="  " } { for (i = 2; i <= NF; i++) { if (i > 2) printf " "; printf "%s", $i } }')" +%s
done | sort -k2,2nr -k1

This outputs the names of all your locally-installed packages, with the earliest date in their changelog expressed as the number of seconds since the epoch, sorted by increasing age.

In Debian 9, aptitude allows finer-grained purging of the new packages list, which helps make it manageable and useful.

To obtain the information you’re actually after, assuming you don’t have access to the indexes on master.debian.org, you’ll probably have to parse the archives of debian-devel-changes. These include all changes made to Debian packages, old and new, but you can easily filter the changes corresponding to the introduction of a package: those are the only ones which repeat the suite (“unstable, unstable”; compare bdist-nsi and node-typescript for example).

Related Question