blob: 0b87107cedf22289904ffcb23b11b1919f925fd0 (
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
|
#!/bin/sh
# copy the given package(s) into build-support
# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
if [ "$#" -ne 1 ]; then
>&2 echo 'usage:'
>&2 echo ' copy-to-build-support package-list'
exit 2
fi
tmp_dir=$(mktemp -d "${work_dir}/tmp.copy-to-build-support.0.XXXXXXXXXX")
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
to_copy='build_assignment epoch pkgver pkgrel sub_pkgrel has_issues is_tested pkgname architecture'
sed -n '
s/.\+/\0 \0/
T
s/\.pkg\.tar\.xz$//
s/\(-[0-9]\+\)\(-[^- ]\+\)$/\1.0\2/
s/-\([^-: ]\+\)\(\(-[^- ]\+\)\{2\}\)$/-0:\1\2/
s/-\([^-: ]\+\):\([^-: ]\+\)-\([^-. ]\+\).\([^-. ]\+\)-\([^- ]\+\)$/ \1 \2 \3 \4 \5/
p
' "$1" | \
while read -r package pkgname epoch pkgver pkgrel sub_pkgrel architecture; do
# shellcheck disable=SC2016
id=$(
{
printf 'SELECT `binary_packages`.`id`,`repositories`.`name`'
printf ' FROM `binary_packages`'
mysql_join_binary_packages_repositories
mysql_join_binary_packages_architectures
printf ' WHERE'
printf ' `binary_packages`.`%s`=from_base64("%s") AND' \
'epoch' "$(printf '%s' "${epoch}" | base64 -w0)" \
'pkgver' "$(printf '%s' "${pkgver}" | base64 -w0)" \
'pkgrel' "$(printf '%s' "${pkgrel}" | base64 -w0)" \
'sub_pkgrel' "$(printf '%s' "${sub_pkgrel}" | base64 -w0)" \
'pkgname' "$(printf '%s' "${pkgname}" | base64 -w0)"
printf ' `architectures`.`name`=from_base64("%s")' \
"$(printf '%s' "${architecture}" | base64 -w0)"
printf ' LIMIT 1;\n'
} | \
mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
'
)
if [ -z "${id}" ]; then
continue
fi
repository="${id#* }"
id="${id%% *}"
printf '%s\n' "${package}" >> \
"${tmp_dir}/packages"
for suffix in '' '.sig'; do
printf 'ln "i686/%s/%s%s" "i686/build-support/%s%s"\n' \
"${repository}" \
"${package}" \
"${suffix}" \
"${package}" \
"${suffix}"
done >> \
"${tmp_dir}/sftp-command"
printf '%s/i686/%s/%s\n' \
"${master_mirror_rsync_directory}" \
"${repository}" \
"${package}" | \
sed '
p
s/$/.sig/
' >> \
"${tmp_dir}/to-copy"
# shellcheck disable=SC2016
{
printf 'INSERT IGNORE INTO `binary_packages`'
printf ' (`repository`'
# shellcheck disable=SC2086
printf ',`%s`' ${to_copy}
printf ')'
printf ' SELECT'
printf ' (SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`="build-support")'
# shellcheck disable=SC2086
printf ',`binary_packages`.`%s`' ${to_copy}
printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
printf ' WHERE'
printf ' `binary_packages`.`id`=%s;\n' \
"${id}"
} >> \
"${tmp_dir}/mysql-command"
done
${master_mirror_rsync_command} \
"${master_mirror_rsync_directory}/i686/build-support/build-support.db."* \
"${master_mirror_rsync_directory}/i686/build-support/build-support.files."* \
"${tmp_dir}/"
if [ -s "${tmp_dir}/to-copy" ]; then
mkdir "${tmp_dir}/transit/"
# shellcheck disable=SC2046
${master_mirror_rsync_command} \
$(cat "${tmp_dir}/to-copy") \
"${tmp_dir}/transit/"
repo-add "${tmp_dir}/build-support.db.tar.gz" \
"${tmp_dir}/transit/"*".pkg.tar.xz"
fi
if [ -s "${tmp_dir}/sftp-command" ]; then
${master_mirror_sftp_command} < \
"${tmp_dir}/sftp-command"
fi
${master_mirror_rsync_command} \
"${tmp_dir}/build-support.db."* \
"${tmp_dir}/build-support.files."* \
"${master_mirror_rsync_directory}/i686/build-support/"
if [ -s "${tmp_dir}/mysql-command" ]; then
mysql_run_query < \
"${tmp_dir}/mysql-command"
fi
if [ -s "${tmp_dir}/packages" ]; then
while read -r package; do
remove_old_package_versions 'i686' 'build-support' "${package}"
done < \
"${tmp_dir}/packages"
fi
if [ -w "$1" ]; then
cat "${tmp_dir}/packages" > \
"$1"
fi
|