Learning while updating

Hi, I’d like to have pacman to display some information about the packages it is updating.

That is, i’d like to have a line describing each package while it is downloading (like pacman -Q does)

Some package names are not so much self-explanatory !

man pacman

  -i, --info
      Display information on a given sync database package. Passing two --info or -i flags will also display
      those packages in all repositories that depend on this package.

Unfortunately, the -i option can’t be used along with the -u one. I wish it could, that’s my point.

Then I guess the only option is to roll your own update script, check for updated packages, then check for info on each, then update and display the info gathered for each package.

Personally I wouldn’t do this as it might lead to partial upgrades or database issues if not done right, it’s likely possible to add a patch to pacman and get it merged upstream but that’s probably out of the scope of this question.

Why not just combine two calls to pacman, one to do the upgrade and another to display info on the last updated packages afterwards.

First attempt:
cat /var/log/pacman.log | grep upgraded | cut --delimiter=\ -f4 | xargs pacman -Qi

I tried also replacing cat by tail -f -n1 to have this script working while updating – hence displaying only the packages being updated – but it seems the pipes prevent tail -f to work properly.

Nice, yea you’d need an unbuffered tail, you might be able to do it with a while loop over the log file using inotifywait to watch for writes, then read the most recent line.

You seem knowledgeable enough to figure this out but after work I’d be willing to “collab” on getting something working.

You shouldn’t need cat at all though (stop the cat abuse)

grep 'upgraded' /var/log/pacman.log | ...

At least I’ve got this script as a working base:

grep "$(date -I)" /var/log/pacman.log |\
grep "upgraded" |\
sed "s/^\(.*\) upgraded \([-_a-z0-9]\+\)\(.*\)$/\2/" |\
uniq |\
pacman -Qi - |\
egrep "^Description|^Nom" |\
sed "s/Description\|Nom\s*:\(.*\)/\1/"