blob: d7eb989644c236c4b706b02525c7890d0e05ef76 (
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#!/bin/bash
usage() {
>&2 echo 'usage: bumpPkgrel [-n] [-p /tmp/provided] $pkg1 $pkg2 $pkg3 ...'
>&2 echo ' -n: do not commit'
>&2 echo ' -p: use this temporary file'
exit 1
}
eval set -- "$(
getopt -o np: \
-n "$(basename "$0")" \
-- "$@" \
|| echo "usage"
)"
commit=true
commit_flag=''
provided=''
while true; do
case "$1" in
'-n')
commit=false
commit_flag='-n'
;;
'-p')
shift
provided="$1"
;;
'--')
shift
break
;;
*)
>&2 printf 'FEHLER: Verstehe Option "%s" doch nicht! Ich beende.\n' "$1"
exit 1
esac
shift
done
if [ $# -eq 0 ]; then
usage
fi
if [ -z "${provided}" ]; then
provided=$("${0%/*}/liste-verfuegbare-Versionen")
trap 'rm -f "${provided}"' EXIT
fi
pin_dependency() {
sed '
s/^\(\S\+\)>\?=\(\S\+\)$/\1 \2/
t
s/^\S\+$/\0 BOGUS/
t
d
' \
| sort -k1,1 \
| join -1 1 -2 2 -a 1 -e EMPTY -o 1.1,1.2,2.1 - "${provided}" \
| sed '
s/ \(\S\+\) EMPTY$/ \1 \1/
' \
| sed '
s/^\(\S\+\) \S\+ \(\S\+\)$/'"${1}'"'\1=\2'"'"'/
s/^\(\s*'"'"'glibc\)=/\1>=/
t
d
'
}
if [ $# -eq 1 ]; then
cd "$(dirname "$0")"
pkg="${1%/}"
cd "${pkg}"
while IFS=$(printf '\n') read -r line; do
if printf '%s\n' "${line}" \
| grep -q '^\s*pkgrel='; then
eval "${line}"
printf '%s=%s\n' "${line%%=*}" "$((pkgrel+1))"
continue
fi
if printf '%s\n' "${line}" \
| grep -q '^\s*_pinned_dependencies\([^=[:space:]]*\)=('; then
space="${line%%_pinned_dependencies*=(*}"
printf '%s=(\n' "${line%%=(*}"
line="${line#*_pinned_dependencies*=(}"
{
while ! printf '%s\n' "${line}" \
| grep -qF ')'; do
printf '%s\n' ${line%%#*}
IFS=$(printf '\n') read -r line
done
printf '%s\n' ${line%%)*}
} \
| sed '
/^$/d
s/^\(["'"'"']\)\(\S\+\)\1$/\2/
' \
| pin_dependency "${space} "
printf '%s)%s\n' "${space}" "${line#*)}"
continue
fi
printf '%s\n' "${line}"
done \
< 'PKGBUILD' \
| sponge '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" ${commit_flag} -p "${provided}"
fi
|