You are not logged in.
Pages: 1
Hello,
Is there any pacman command that can tell about a new package added to the Arch Linux packages database ? e.g I want to check if there has been any new package added to the community repository which was previously not there in community repository , so is there any pacman command for checking this?
Thanks.
Offline
There is no history in the database, so the only way to do this would be to compare an old database to a newer one. Not something pacman can do without scripting it yourself.
Last edited by Scimmia (2022-02-25 17:46:23)
Offline
And in order to plan a good approach to scripting this, you'd need to define the relevant time frame. All packages currently in community were previously not there - but many of them have been for a long time. One approach is if - for example - you wanted a periodic check of new packages in the repos since your last check, just run `pacman -Ssq` putting the results into a list file and compare it to the previous list (e.g., with `comm`).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I have a script for this (sorry, not in english in code)
before update : `script -b`; pacman -Sy ; after: `script -a` (for get new version) and, `script -n` and `script -r` for compare
#!/usr/bin/bash
pkgname="diff-maj"
# show diff before/after pacman db update
CG='\033[1m\033[32m'
CB='\033[1m'
CE='\033[0m'
confdir="${HOME}/.config/share/${pkgname}"
[ -d "$confdir" ] || mkdir -p "$confdir"
fbefore="${confdir}/before-maj.pkgs"
fafter="${confdir}/after-maj.pkgs"
if [[ "$1" == '-h' || "$1" == '' ]]; then
cat <<EOF
${pkgname} Usage:
-b: save package list before update
-a: save package list after update
-d: diff before/after
-n: show new packages
-r: show pakages removed
EOF
exit
fi
if [[ "$1" == '-b' ]]; then
pacman -Ssq | sort > "${fbefore}"
[ -f "${fafter}" ] && rm -vf "${fafter}"
echo "saved in ${fbefore}"
printf "%s paquets avant mise à jour\n" $(cat "${fbefore}" | wc -l)
ls -l "${confdir}"
exit 0
fi
if [[ "$1" == '-a' ]]; then
pacman -Ssq | sort > "${fafter}"
echo "saved in ${fafter}"
printf "%s paquets après la mise à jour\n" $(cat "${fafter}" | wc -l)
exit 0
fi
if [[ "$1" == "-d" ]]; then
[ -f "${fbefore}" ] || exit 8
[ -f "${fafter}" ] || exit 9
echo "diff ${fbefore} ${fafter} --color"
diff "${fbefore}" "${fafter}" --color
fi
if [[ "$1" == "-n" ]]; then
[ -f "${fbefore}" ] || exit 8
[ -f "${fafter}" ] || exit 9
diffs=($(diff "${fbefore}" "${fafter}" | awk '/^>/ {print $2}'))
echo "-- ${diffs[*]}"
echo "-- Détails des ${#diffs[@]} nouveaux paquets:"
LANG=C pacman -Si ${diffs[*]} | awk -F': ' '/^Name/ {name=$2} /^Desc/ {desc=$2} /^URL/ {printf "\033[34m%-28s\033[0m %s \033[38;5;246m%s\033[0m\n",name,desc,$2}'
fi
if [[ "$1" == "-r" ]]; then
[ -f "${fbefore}" ] || exit 8
[ -f "${fafter}" ] || exit 9
count=$(diff "${fbefore}" "${fafter}" | awk '/^</ {print $2}' |wc -l)
echo "-- ${count} paquets supprimés:"
diff "${fbefore}" "${fafter}" | awk '/^</ {printf $2" "}'
echo
fiLTS - Fish - Kde - intel M100 - 16Go RAM - ssd
Offline
`comm` would be better than `diff ... | awk ...`
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks for all the kind replies , this info is very helpful indeed.
Offline
FYI, you could also get the changes since the last time you upgraded (or really since the last db sync, which should have been an upgrade) by using pacman's -b or --dbpath flag to download the new datases to an alternative location (e.g., under /tmp). E.g., something like the following:
mkdir -p /tmp/db
pacman -Sy -b /tmp/db
pacman -Ssq -b /tmp/db >| /tmp/packages
pacman -Ssq | comm -3 - /tmp/packagesWith bash you could do without the /tmp/packages file and save a line by using process substitution:
#!/bin/bash
mkdir -p /tmp/db
pacman -Sy -b /tmp/db
comm -3 <(pacman -Ssq) <(pacman -Ssq -b /tmp/db)The comm command as written shows packages removed in the first column, and packages added in the second column. If you really just want to see the new ones replace the -3 flag with -13.
Last edited by Trilby (2022-02-28 18:56:12)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1