blob: e494f6a258fe2c9d06e30afa5ebc5ac9469ef780 (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/usr/bin/env bash
source $(dirname $0)/config.bash
cd "$PKGBUILD_DIR"
##
# Get commit sha from PKGVER of PKGBUILD
#
# Arguments:
# $1 Path to the directory containing the PKGBUILD
# to get the sha from
get_pkgver_sha() {
(source "$1"/PKGBUILD
printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)")
}
get_repo_sha() {
shopt -s nullglob
local packages
for f in "$REPO"/"$1"*.tar.xz; do
package="${f##*/}"
package="${package//-git-/-git }"
package="${package//-hg-/-hg }"
package="${package//-?-*.pkg.tar.xz}"
IFS=' ' read -ra p <<< "$package"
if [[ -z "${package//* debug-*}" ]]; then
continue
else
name="${p[0]}"
ver="${p[1]}"
printf "%s\n" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$ver)"
return
fi
done
}
main() {
for package in "${packages[@]}"; do
old_version[$package]=$(get_repo_sha "$package")
(cd "$PKGBUILD_DIR"/"$package"
makepkg --nobuild &>/dev/null) &
done
wait
local needs_rebuild=()
for package in "${packages[@]}"; do
new_head=$(get_pkgver_sha "$package")
if [[ "${old_version[$package]}" != "$new_head" ]]; then
needs_rebuild+=("$package")
fi
done
if [[ ${#needs_rebuild[@]} -eq 0 ]]; then
printf "%s\n" "No VCS packages found that needs to be rebuilt."
else
printf "Packages that needs to be rebuilt:"
printf "%s\n" "${needs_rebuild[@]}"
for package in "${needs_rebuild[@]}"; do
(cd "$package"
makepkg -src --noconfirm 2>/dev/null) &
done
wait
fi
$(dirname $0)/db-build
}
main "$@"
|