blob: 3c0aae8606e01ff9a350b1c6df5d9e3f2f9ff770 (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/usr/bin/env bash
. "$HOME"/.makepkg.conf
cd "$HOME"/packaging/pkgbuilds
source $(dirname $0)/package-list.bash
need_rebuild=()
#for package in "${!packages[@]}"; do
# if [[ -d "$package" ]]; then
# cd "$package"
# (makepkg -src --noconfirm) &
# cd -
#done
##
# Buils the given package
#
# Arguments:
# $1: Directory that contains the PKGBUILD of the
# package to build.
build_package() {
if [[ -d "$1" ]]; then
(cd "$1"
makepkg -src --noconfirm 2>/dev/null)
fi
}
##
# Get newest commit of VCS repo.
#
# Arguments:
# $1 Path to the directory of the VCS repo.
# $2 Name of the ref to get the newest commit of
get_new_commit() {
if [[ -d "$1" ]]; then
(cd "$1"
if [[ -d .hg ]]; then
hg update &>/dev/null
printf "%s" "$(hg log -r "." --template "{node|short}")"
elif [[ -n "$(git config --get core.bare)" ]]; then
if [[ -n "$2" ]]; then
local ref="$2"
else
local ref=HEAD
fi
printf "%s" "$(git rev-parse --short $ref)"
fi)
else
printf "%s\n" "Repository to get commit from not found" 1>&2
fi
}
##
# Get commit of the laste built package from pkgver of PKGBUILD
#
# Arguments:
# $1 Path to the directory of the PKGBUILD to get te old commit from.
get_old_commit() {
(source "$1"/PKGBUILD
printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)")
}
for package in "${!packages[@]}"; do
new_head=$(get_new_commit "$SRCDEST"/"${packages[$package]}" "${branches[$package]}")
old_commit=$(get_old_commit $package)
# printf "%-30s\t\t%s\t\t%s\n" $package $old_commit $new_head
if [[ "$old_commit" != "$new_head" ]]; then
need_rebuild+=("$package")
fi
done
if [ ${#need_rebuild[@]} -eq 0 ]; then
printf "%s" "No VCS packages needing rebuilding."
else
printf "%s" "Packages needing rebuilding: "
for package in "${need_rebuild[@]}"; do
printf "%s" "$package"
build_package "$package" &>/dev/null &
done
fi
wait
printf "\n"
"$HOME"/packaging/vodik-repose/repose kyriasis -r "$HOME"/packaging/repo -p "$HOME"/packaging/built_packages -v
|