2021-04-26 14:45:18 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# For all packages in repository $REMOTE_DB_NAME,
|
|
|
|
# compare package version with AUR and
|
|
|
|
# print all outdated packages
|
|
|
|
#
|
|
|
|
|
2021-05-24 15:09:45 +02:00
|
|
|
source /usr/lib/de-p1st-repo/util.sh || exit $?
|
|
|
|
source /usr/lib/de-p1st-repo/pkgver.sh || exit $?
|
|
|
|
source /usr/lib/de-p1st-repo/pkginfo.sh || exit $?
|
|
|
|
source /etc/de-p1st-repo/arch-repo.cfg || exit $?
|
2021-04-26 14:45:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function main(){
|
2021-05-01 12:25:25 +02:00
|
|
|
echo "Note: You may run 'arch-repo-push-new' and 'pacman -Sy' first ..."
|
2021-04-26 14:45:18 +02:00
|
|
|
|
|
|
|
all_pkg_vers || return $?
|
|
|
|
check_aur_updates || return $?
|
|
|
|
|
|
|
|
if [ "${#AUR_UPDATES[@]}" -gt "0" ]; then
|
|
|
|
echo "Repository ${REMOTE_DB_NAME} contains packages with available AUR updates:"
|
2021-05-24 15:49:27 +02:00
|
|
|
printf " AUR_UPDATES=(%s)\n" "${AUR_UPDATES[*]}"
|
2021-04-26 14:45:18 +02:00
|
|
|
else
|
|
|
|
echo "There are no pending AUR updates in repository ${REMOTE_DB_NAME}."
|
|
|
|
fi
|
2021-05-24 15:09:45 +02:00
|
|
|
|
|
|
|
get_vcs_packages || return $?
|
|
|
|
if [ "${#VCS_PKGS[@]}" -gt "0" ]; then
|
|
|
|
echo ""
|
|
|
|
echo "Note: Some VCS packages were found which are possibly outdated:"
|
2021-05-24 15:49:27 +02:00
|
|
|
printf " VCS_PKG=(%s)\n" "${VCS_PKGS[*]}"
|
2021-05-24 15:09:45 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_vcs_packages(){
|
|
|
|
# return: array GIT_PKGS with all VCS packages
|
|
|
|
VCS_PKGS=()
|
|
|
|
|
|
|
|
# https://wiki.archlinux.org/title/VCS_package_guidelines#VCS_sources
|
|
|
|
# https://github.com/AladW/aurutils/pull/283/files
|
|
|
|
readonly AURVCS='.*-(bzr|git|hg|svn)$'
|
|
|
|
|
2021-05-24 15:37:46 +02:00
|
|
|
while IFS= read -r PKG_VER; do
|
2021-05-24 15:09:45 +02:00
|
|
|
PKGNAME=$(first_word "${PKG_VER}") || return $?
|
2021-05-24 15:40:06 +02:00
|
|
|
if echo "${PKGNAME}" | grep -E "$AURVCS" >/dev/null; then
|
2021-05-24 15:09:45 +02:00
|
|
|
VCS_PKGS+=("${PKGNAME}")
|
|
|
|
fi
|
2021-05-24 15:37:46 +02:00
|
|
|
done <<< "${PKG_VERS}"
|
2021-04-26 14:45:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Store packages from $PKG_VERS with available AUR updates in $AUR_UPDATES.
|
|
|
|
# $AUR_UPDATES is an array where each entry describes one outdated package with it's current and new version.
|
|
|
|
#
|
|
|
|
function check_aur_updates(){
|
|
|
|
mapfile -t AUR_UPDATES < <(echo "$PKG_VERS" | aur vercmp)
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Store all installed package names and their versions
|
|
|
|
# from repository $REMOTE_DB_NAME
|
|
|
|
# in variable $PKG_VERS.
|
|
|
|
# $PKG_VERS consists of multiple lines in the format: "<pkgname><whitespace><pkgver>"
|
|
|
|
#
|
|
|
|
function installed_pkg_vers(){
|
|
|
|
# The paclist script is partof the package "pacman-contrib"
|
|
|
|
PKG_VERS=$(paclist "${REMOTE_DB_NAME}") || return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Store all package names and their versions
|
|
|
|
# from repository $REMOTE_DB_NAME
|
|
|
|
# in variable $PKG_VERS.
|
|
|
|
# $PKG_VERS contains of multiple lines in the format: "<pkgname><whitespace><pkgver>"
|
|
|
|
#
|
|
|
|
function all_pkg_vers(){
|
2021-05-24 12:54:52 +02:00
|
|
|
PKG_VERS=$(pacman -S --list "${REMOTE_DB_NAME}" | sed "s|^${REMOTE_DB_NAME}\\s*||; s|\\s*\\[installed.*\\]\s*\$||") || return $?
|
2021-04-26 14:45:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|