Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-04 14:25:49 +0200
committerErich Eckner <git@eckner.net>2018-05-04 14:25:49 +0200
commitcc0ff34336cde2408fcfc8724f48719f6f10ecb8 (patch)
tree8cfefddeb1148adb6d2bf8a823eaa23689d76b88
parentb4601c1e413e1d1f8db002fa4e126f4e9290555b (diff)
lib/mysql-functions: add build_assignments earlier
-rwxr-xr-xlib/mysql-functions27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 10808ab..3c45edc 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -299,22 +299,20 @@ mysql_generate_package_metadata() {
grep -vxF 'any' || \
echo 'any'
} | \
+ base64_encode_each | \
while read -r arch; do
- printf 'INSERT IGNORE INTO `build_assignments` (`package_source`,`architecture`,`is_blocked`,`is_broken`,`priority`)'
- printf ' SELECT from_base64("%s"),`architectures`.`id`,NULL,0,0' \
- "$(
- printf '%s' "${package_source_id}" | \
- base64 -w0
- )"
+ printf 'INSERT INTO `build_assignments` (`package_source`,`architecture`,`is_blocked`,`is_broken`,`priority`)'
+ printf ' SELECT %s,`architectures`.`id`,NULL,0,0' \
+ "${package_source_id}"
printf ' FROM `architectures`'
printf ' WHERE `architectures`.`name` = from_base64("%s")' \
- "$(
- printf '%s' "${arch}" | \
- base64 -w0
- )"
- printf ';\n'
- done > \
- "${temp_dir}/add-build-assignments-command"
+ "${arch}"
+ printf ' ON DUPLICATE KEY UPDATE `id`=LAST_INSERT_ID(`id`);\n'
+ printf 'SELECT "%s",LAST_INSERT_ID();\n' \
+ "${arch}"
+ done | \
+ mysql_run_query > \
+ "${tmp_dir}/build-assignments.id"
# TODO: correctly link between binary_packages and build_assignments using any_arch
@@ -630,9 +628,6 @@ mysql_generate_package_metadata() {
done
{
- if [ -s "${temp_dir}/add-build-assignments-command" ]; then
- cat "${temp_dir}/add-build-assignments-command"
- fi
if [ -s "${temp_dir}/add-binary-packages-command" ]; then
cat "${temp_dir}/add-binary-packages-command"
fi