Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/return-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-25 23:19:31 +0200
committerErich Eckner <git@eckner.net>2018-09-25 23:19:31 +0200
commit1bde639672388022104723bb65d863355b967fc7 (patch)
tree4c41433eb73de4982b23b99efb722443a67d5a4e /bin/return-assignment
parentbe86f11c3683be17e4a10f94d7dee053af36d20c (diff)
bin/return-assignment: "insert into" -> "insert ignore into" (there are "commits" inbetween which make parts of the query succeed)
Diffstat (limited to 'bin/return-assignment')
-rwxr-xr-xbin/return-assignment9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index e71680d..9a999ae 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -160,10 +160,10 @@ if [ "$6" = 'ERROR' ]; then
done
done | \
sed '
- 1 s/^/INSERT INTO `failures` (`date`,`reason`,`log_file`) VALUES /
+ 1 s/^/INSERT IGNORE INTO `failures` (`date`,`reason`,`log_file`) VALUES /
s/,$/;\n/
'
- printf 'INSERT INTO `failed_builds` (`build_slave`,`build_assignment`,`date`,`reason`,`log_file`,`log_file_exists`)'
+ printf 'INSERT IGNORE INTO `failed_builds` (`build_slave`,`build_assignment`,`date`,`reason`,`log_file`,`log_file_exists`)'
printf ' SELECT '
printf 'from_base64("%s"),' \
"$(printf '%s' "${slave_id}" | base64 -w0)" \
@@ -753,8 +753,9 @@ trigger_mirror_refreshs
# insert into appropriate repositories and retrieve ids
while read -r package_id _ repository_id _; do
printf 'INSERT INTO `binary_packages_in_repositories` (`package`,`repository`,`is_to_be_deleted`) VALUES '
- printf '(%s,%s,0);\n' \
+ printf '(%s,%s,0)' \
"${package_id}" "${repository_id}"
+ printf ' ON DUPLICATE KEY UPDATE `id`=LAST_INSERT_ID(`binary_packages_in_repositories`.`id`);\n'
printf 'SELECT LAST_INSERT_ID();\n'
done < \
"${tmp_dir}/repository-ids"
@@ -892,7 +893,7 @@ trigger_mirror_refreshs
# remove broken loops
printf 'CREATE TEMPORARY TABLE `loops_to_delete` (`loop` MEDIUMINT);\n'
- printf 'INSERT INTO `loops_to_delete`'
+ printf 'INSERT IGNORE INTO `loops_to_delete`'
printf ' SELECT `build_dependency_loops`.`loop` FROM `build_dependency_loops`'
mysql_join_build_dependency_loops_binary_packages
mysql_join_binary_packages_binary_packages_in_repositories