-
Notifications
You must be signed in to change notification settings - Fork 39
/
rebuild-notify
executable file
·39 lines (29 loc) · 1.07 KB
/
rebuild-notify
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -e
source "/usr/share/makepkg/util/message.sh"
colorize
# all local packages which are not in the official repositories
targets=( $(comm -23 <(pacman -Qq | sort) <(pacman -Slq core extra | sort)) )
msg "Checking versions of local packages..."
# go over the targets and if a package provides 'foo' and 'foo' is in the sync
# repositories with a newer version, trigger a warning
while read -r line; do
# split line by spaces: first word is the pkgname, second its pkgver,
# the rest are its provides
_items=($line)
pkgname="${_items[0]}"
pkgver="${_items[1]}"
provides=(${_items[@]:2})
# drop epoch
pkgver="${pkgver#*:}"
for pkg in ${provides[@]}; do
ver=$(expac -S "%v" "$pkg" || true)
# drop epoch
ver="${ver#*:}"
# skip invalid packages (provides can be invalid pkgname)
[[ -z "$ver" ]] && continue
if (( $(vercmp "$pkgver" "$ver") < 0 )); then
warning "old local package: $pkgname=$pkgver (remote: $pkg=$ver)"
fi
done
done < <(expac -Q "%n %v %S" ${targets[@]})