blob: 70c63ea0a0198525b5c8e3eb0f2cba2227513f5c (
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
#!/bin/bash
if [ $# -eq 2 ]; then
cd "${1}"
if [ ! -f '.SRCINFO' ] ||
[ "$(stat -c%Y PKGBUILD)" -gt "$(stat -c%Y .SRCINFO)" ]; then
makepkg --printsrcinfo > .SRCINFO
fi
sed '
/^\S/ b
/^\s\+\(arch\|epoch\|pkgver\|pkgrel\) = \S/ b
/^$/ b
d
' '.SRCINFO' \
> "${2}"
echo >> "${2}"
sed -i '/^\S/ s/^/\n/' "${2}"
all=$(
sed -n '
/^pkgbase = /,/^$/ {
/^\s/ p
}
' "${2}" \
| sed '
$! s/$/\\/
'
)
all_noarch=$(
printf '%s\n' "${all}" \
| grep -v '^\sarch = ' \
| sed '
$ s/\\$//
'
)
sed -i '
/^pkgbase = /,/^$/ d
/^pkgname = / {
:a
N
/\n$/ ! ba
/\n\sarch = / {
a\
'"${all_noarch}"'
b
}
a\
'"${all}"'
}
' "${2}"
sed -i '
/^\s*$/d
' "${2}"
exit
fi
if [ $# -ne 0 ]; then
>&2 echo 'usage error'
>&2 printf '"%s" ' "$@"
>&2 printf '\n'
exit 1
fi
tmp_dir=$(mktemp -d)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
find "$(pwd)" -maxdepth 2 -mindepth 2 -name 'PKGBUILD' -type f \
| sed -n '
s@/[^/]\+$@@
T
s@/[^/]\+$@\0\n'"${tmp_dir%/}"'\0.srcinfo@
T
p
' \
| parallel -j0 -L2 "$0"
print_names() {
if [ -z "${pkgname}" ] \
|| [ -z "${pkgver}" ] \
|| [ -z "${pkgrel}" ]; then
>&2 echo 'error: some variable is missing'
exit 1
fi
for arch in "${archs[@]}"; do
printf '%s-%s%s-%s-%s.pkg.tar.zst\n' \
"${pkgname}" \
"${epoch:+${epoch}:}" \
"${pkgver}" \
"${pkgrel}" \
"${arch}"
done
}
diff -u --color <(
for arch in armv6h armv7h aarch64 i486 i686 pentium4 x86_64; do
curl -Ss 'http://pkgcache.eckner.net/arch/'"${arch}"'/archlinuxewe/archlinuxewe.db' \
| bsdtar -Oxf -
done \
| sed '
/^%FILENAME%$/ !d
N
s/^.*\n//
' \
| sort -u
) <(
find "$tmp_dir" -name '*.srcinfo' -exec cat {} + \
| {
while read key eq value; do
if [ "x${eq}" != 'x=' ]; then
>&2 echo "syntax error"
exit 1
fi
case "${key}" in
'pkgname')
if [ -n "${pkgname}" ]; then
print_names
fi
archs=()
pkgname="${value}"
unset epoch
unset pkgver
unset pkgrel
;;
'arch')
archs+=("${value}")
;;
'epoch')
epoch="${value}"
;;
'pkgver')
pkgver="${value}"
;;
'pkgrel')
pkgrel="${value}"
;;
*)
>&2 printf 'unknown key "%s"\n' "${key}"
exit 1
;;
esac
done
if [ -n "${pkgname}" ]; then
print_names
fi
} \
| sort -u
)
|