blob: e0b18718904decd4d8347c6912c9b61b85dbfe45 (
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
90
91
92
93
94
95
96
97
|
#!/bin/bash
if [ $# -eq 0 ]; then
>&2 echo 'usage: bumpPkgrel [-n] $pkg1 $pkg2 $pkg3 ...'
exit 1
fi
if [ "x$1" = 'x-n' ]; then
commit=false
shift
else
commit=true
fi
if [ $# -eq 1 ]; then
cd "$(dirname "$0")"
pkg="${1%/}"
cd "${pkg}"
eval "$(
sed -n '
/^pkgrel=/p
/^_pinned_dependencies=(.*)/p
/^_pinned_dependencies=([^)]*$/,/)/p
' 'PKGBUILD'
)"
mapfile -t _pinned_dependencies < <(
printf '%s\n' "${_pinned_dependencies[@]}" \
| sed -n '
s/=.*$//
/^[^<=>]\+$/ p
' \
| sort -u \
| join -1 1 -2 2 -o 1.1,2.1 - <(
find /var/lib/pacman/sync/ -name '*.db' \
-not -exec tar -Oxzf {} --wildcards '*/desc' \; \
-not -exec tar -OxJf {} --wildcards '*/desc' \; \
-not -exec tar -Oxjf {} --wildcards '*/desc' \; \
-not -exec tar -Oxf {} --wildcards '*/desc' \; \
2>/dev/null \
| sed -n '
/^%\(NAME\|VERSION\)%$/ {
N
s/\n/ /
p
}
' \
| sed -n '
/^%NAME%/ {
N
s/^%NAME% \(\S\+\)\n%VERSION% \(\S\+\)-\S\+$/\2 \1/
T
p
}
' \
| sort -k2,2 -k1Vr,1 \
| uniq -f1
) \
| awk '{print $1 "=" $2}'
)
sed -i '
s@^\(pkgrel=\)\('"'"'\?\)[0-9]\+\2$@\1'"$((pkgrel+1))"'@
/^_pinned_dependencies=(/ {
:a
/)/ {
s@.*@_pinned_dependencies=(\n'"$(printf ' '"'"'%s'"'"'\\n' "${_pinned_dependencies[@]}")"')@
b
}
$! {
N
ba
}
}
' 'PKGBUILD'
if ${commit}; then
if [ -d '.git' ] || [ -f '.git' ]; then
makepkg --printsrcinfo > .SRCINFO
git commit 'PKGBUILD' '.SRCINFO' -m "${pkg}: rebuild"
for remote in $(
git remote
); do
git push "${remote}" || exit 1
done
cd ..
git commit "${pkg}" -m "${pkg}: rebuild"
else
git commit 'PKGBUILD' -m "${pkg}: rebuild"
fi
fi
else
printf '%s\n' "$@" \
| xargs -rn1 "$0"
fi
|