0

I would like to be able to list all the NEWS from packages that have been upgraded since I last ran the script/command. This would then likely be run in a cron job once per week in order to provide a summary of any upgrade information.

The apt-listchanges command looks like what I want, but I can't seem to get it to behave exactly as I described. The command I've tried running is:

apt-listchanges -f text -a --which=news --save_seen=/var/lib/apt/listchanges.db /var/cache/apt/archives/*.deb

It seems to want the actual packages to be listed, rather than just checking all of them by default, so I gave it everything in the cache, I'm not sure if that is the best way to do that.

But, the bigger problem, is that by default it only shows changes between the currently installed versions, therefore shows no changes. Therefore I added the -a option to display all changes, and then added the save_seen option which claims that it will stop it displaying changes that have been previously shown. But, each time I run the command it displays all the changes every time.

Is there a way to tweak the command to work as expected? Or, maybe some other solution, such as using an apt hook to append the NEWS for each upgraded package to a file, then my script can simply read the file and delete the contents each time it runs.

0

I can think of two approaches which don’t involve tweaking apt-listchanges too much. Both rely on the default apt-listchanges hook in apt; check that /etc/apt/apt.conf.d/20listchanges exists on your system. This works nicely because apt-listchanges is run with the list of packages which apt is about to upgrade, and can thus compare the current installed versions with these. (apt-listchanges’ design makes it difficult to run after the fact; you could use the --since option but you’d need to keep track of the appropriate values.)

The first approach is to configure apt-listchanges to send an email with any changes. This needs a working mail setup on the system, which might not be convenient for you; but I find it very handy. In the [apt] section of /etc/apt/listchanges.conf, set frontend=mail, and email_address as appropriate; then apt-listchanges will run every time apt runs, and send an email containing the news items (and/or changelogs, depending on the which setting).

The second, which I haven’t actually tried, is to configure apt-listchanges to simply dump news entries and/or changelogs to its standard output, and redirect that to a log file which you can then read whenever convenient. In the [apt] section of /etc/apt/listchanges.conf, set frontend=text; in /etc/apt/apt.conf.d/20listchanges, add an appending redirection to your target file.

  • I've been testing out the second option, and I think I have it working. The only problem is that even when there is nothing to display it does still append "apt-listchanges: Reading changelogs..." to the file. Is that something that can be suppressed? – Sam Bull Dec 20 '17 at 18:53
  • For anyone wanting to try this, the changed line in /etc/apt/apt.conf.d/20listchanges is: DPkg::Pre-Install-Pkgs { "/usr/bin/apt-listchanges --apt >> /var/lib/apt/listchanges-news || test $? -lt 10"; }; – Sam Bull Dec 20 '17 at 18:54
  • Try the -q option (perhaps doubled), I think it will disable the “Reading changelogs” message. – Stephen Kitt Dec 20 '17 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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