-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbump
More file actions
executable file
·61 lines (55 loc) · 1.64 KB
/
Copy pathbump
File metadata and controls
executable file
·61 lines (55 loc) · 1.64 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# bump — refresh packages to their latest upstream state, by tier.
#
# *-rel (releases/download source): pkgctl version upgrade + updpkgsums
# *-git (git+ VCS source): re-clone + rerun pkgver()
# Both then regenerate .SRCINFO. (-git has no hashes to bump — git's commit
# ref is the integrity check — so updpkgsums is skipped for it.)
#
# Usage, from the repo root:
# ./bump # refresh every package under pkgs/
# ./bump <pkg> ... # refresh only the named package(s)
set -u
shopt -s nullglob
source "$(dirname "$0")/acrlib"
targets=()
if (( $# > 0 )); then
for n in "$@"; do targets+=("pkgs/$n"); done
else
for pb in pkgs/*/PKGBUILD; do targets+=("$(dirname "$pb")"); done
fi
(( ${#targets[@]} )) || { echo "no packages found under pkgs/"; exit 0; }
rc=0
for dir in "${targets[@]}"; do
name=$(basename "$dir")
[[ "$name" == "template" ]] && continue
[[ -f "$dir/PKGBUILD" ]] || { echo "skip [$name]: no PKGBUILD"; rc=1; continue; }
old=$(sed -n "s/^pkgver=//p" "$dir/PKGBUILD" | head -1)
echo "==> $name (current $old)"
case "$(acr_tier "$name")" in
rel)
( cd "$dir" && pkgctl version upgrade && updpkgsums \
&& makepkg --printsrcinfo > .SRCINFO )
ok=$?
;;
git)
( cd "$dir" && makepkg -od --noprepare \
&& makepkg --printsrcinfo > .SRCINFO )
ok=$?
;;
*)
echo " skip: not a -git/-rel package"; continue
;;
esac
if (( ok == 0 )); then
new=$(sed -n "s/^pkgver=//p" "$dir/PKGBUILD" | head -1)
if [[ "$old" == "$new" ]]; then
echo " already latest ($new)"
else
echo " bumped $old -> $new"
fi
else
echo "FAIL [$name]: refresh failed"; rc=1
fi
done
exit $rc