summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-01 08:37:27 +0100
committerErich Eckner <git@eckner.net>2018-03-01 08:37:27 +0100
commit6047f2686cfe623e08fbaf4eae0a552ded731eb1 (patch)
treea4e8df807732b035c3a8d430ddb8cb44565b49cd /bin
parent1b15a4704e80853b99eef83a3e26e7735bec2f54 (diff)
downloadbuilder-6047f2686cfe623e08fbaf4eae0a552ded731eb1.tar.xz
switch from calling ${mysql_command} to calling the wrapper function mysql_run_query()
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bootstrap-mysql4
-rwxr-xr-xbin/build-master-status6
-rwxr-xr-xbin/build-master-status-from-mysql16
-rwxr-xr-xbin/check-bugtracker4
-rwxr-xr-xbin/copy-to-build-support4
-rwxr-xr-xbin/db-update6
-rwxr-xr-xbin/get-assignment10
-rwxr-xr-xbin/get-package-updates12
-rwxr-xr-xbin/modify-package-state4
-rwxr-xr-xbin/prioritize-build-list2
-rwxr-xr-xbin/return-assignment14
-rwxr-xr-xbin/seed-build-list6
-rwxr-xr-xbin/show-dependencies4
-rwxr-xr-xbin/slave-build-connect2
-rwxr-xr-xbin/why-dont-you2
15 files changed, 48 insertions, 48 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index b23bba4..236b0b7 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -590,7 +590,7 @@ find "${work_dir}/package-states" -name '*.blocked' -printf '%p %f\n' | \
printf ' `upstream_repositories`.`name`=from_base64("%s");\n' \
"$(printf '%s' "${repository}" | base64 -w0)"
done | \
- ${mysql_command}
+ mysql_run_query
grep '^\('"$(
# shellcheck disable=SC2086
@@ -665,7 +665,7 @@ if [ -s "${tmp_dir}/new-stable-packages" ]; then
printf ';\n'
printf 'DROP TABLE `stable_packages`;\n'
} | \
- ${mysql_command}
+ mysql_run_query
fi
mysql_repair_binary_packages_without_build_assignment
diff --git a/bin/build-master-status b/bin/build-master-status
index d74ff8a..9be7823 100755
--- a/bin/build-master-status
+++ b/bin/build-master-status
@@ -557,12 +557,12 @@ if ${web}; then
"${line}"
done < \
"${tmp_dir}/todos" | \
- ${mysql_command}
+ mysql_run_query
# insert unfound todos
# shellcheck disable=SC2016
{
printf 'SHOW CREATE TABLE `todos`' | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
2s/^\S\+\s\+CREATE TABLE `todos` /CREATE TEMPORARY TABLE `td` /
@@ -611,7 +611,7 @@ if ${web}; then
printf 'WHERE `todos`.`id`=`todo_links`.`dependent`'
printf ');\n'
} | \
- ${mysql_command}
+ mysql_run_query
rm -f "${tmp_dir}/todos"
fi
diff --git a/bin/build-master-status-from-mysql b/bin/build-master-status-from-mysql
index b55ca65..fa54177 100755
--- a/bin/build-master-status-from-mysql
+++ b/bin/build-master-status-from-mysql
@@ -27,7 +27,7 @@ fi
mysql_join_binary_packages_repositories
printf ' WHERE `repositories`.`name`="build-list"'
} | \
- ${mysql_command} --batch | \
+ mysql_run_query --batch | \
sed '
1d
y/\t/ /
@@ -48,7 +48,7 @@ sort "${work_dir}/build-list" > \
mysql_join_build_assignments_package_sources
mysql_join_package_sources_upstream_repositories
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
@@ -72,7 +72,7 @@ find "${work_dir}/package-states" -mindepth 1 -maxdepth 1 -name '*.locked' -prin
printf ' WHERE `repositories`.`name`="deletion-list"'
printf ' OR `binary_packages`.`is_to_be_deleted`;\n'
} | \
- ${mysql_command} --batch | \
+ mysql_run_query --batch | \
sed '
1d
y/\t/ /
@@ -90,7 +90,7 @@ sort "${work_dir}/deletion-list" > \
mysql_join_build_assignments_build_dependency_loops
printf ';\n'
} | \
- ${mysql_command} --batch | \
+ mysql_run_query --batch | \
sed '
1d
y/\t/ /
@@ -121,7 +121,7 @@ find "${work_dir}/build-list.loops" -regextype grep -mindepth 1 -maxdepth 1 \
printf ' AND NOT `binary_packages`.`has_issues`'
printf ' AND `repository_stabilities`.`name`="testing"'
} | \
- ${mysql_command} --batch | \
+ mysql_run_query --batch | \
sed '
1d
s/^\(\S\+\)\s\(\S\+\)\s\(\S\+\)\s\(\S\+\)\s\(\S\+\)\s\(\S\+\)$/\1-\2:\3-\4.\5-\6.pkg.tar.xz/
@@ -156,7 +156,7 @@ find "${work_dir}/package-states" -mindepth 1 -maxdepth 1 \
printf ' AND NOT `binary_packages`.`has_issues`'
printf ' AND `repository_stabilities`.`name`="testing"'
} | \
- ${mysql_command} --batch | \
+ mysql_run_query --batch | \
sed '
1d
s/^\(\S\+\)\s\(\S\+\)\s\(\S\+\)\s\(\S\+\)\s\(\S\+\)\s\(\S\+\)$/\1-\2:\3-\4.\5-\6.pkg.tar.xz/
@@ -190,7 +190,7 @@ find "${work_dir}/package-states" -mindepth 1 -maxdepth 1 \
mysql_join_package_sources_upstream_repositories
printf ' WHERE `dependency_types`.`relevant_for_building`'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
@@ -210,7 +210,7 @@ find "${work_dir}/package-states" -mindepth 1 -maxdepth 1 \
mysql_join_package_sources_build_assignments
mysql_join_build_assignments_binary_packages
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
diff --git a/bin/check-bugtracker b/bin/check-bugtracker
index d6e92e5..f15757b 100755
--- a/bin/check-bugtracker
+++ b/bin/check-bugtracker
@@ -26,7 +26,7 @@ bug_list=$(
printf ' FROM `repository_stabilities`'
printf ' WHERE NOT `repository_stabilities`.`bugtracker_category` IS NULL'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d' | \
while read -r stability_id category; do
for has_issues in '1:' '0:NOT '; do
@@ -62,4 +62,4 @@ bug_list=$(
printf '"");\n'
done
done | tee /dev/stderr | \
- ${mysql_command}
+ mysql_run_query
diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support
index 808d041..0b87107 100755
--- a/bin/copy-to-build-support
+++ b/bin/copy-to-build-support
@@ -44,7 +44,7 @@ sed -n '
"$(printf '%s' "${architecture}" | base64 -w0)"
printf ' LIMIT 1;\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
@@ -123,7 +123,7 @@ ${master_mirror_rsync_command} \
"${master_mirror_rsync_directory}/i686/build-support/"
if [ -s "${tmp_dir}/mysql-command" ]; then
- ${mysql_command} < \
+ mysql_run_query < \
"${tmp_dir}/mysql-command"
fi
diff --git a/bin/db-update b/bin/db-update
index de263be..534c245 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -370,7 +370,7 @@ move_packages() {
if ${no_action}; then
sed 's|^|mysql: |'
else
- ${mysql_command}
+ mysql_run_query
fi
${dummynator} trigger_mirror_refreshs
@@ -457,7 +457,7 @@ errors=$(
printf ' JOIN `repository_stabilities` ON `repository_stability_relations`.`more_stable`=`repository_stabilities`.`id`'
printf ' WHERE `repository_stabilities`.`name` = "testing"'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
p
@@ -496,7 +496,7 @@ errors=$(
printf ' JOIN `repository_stabilities` ON `repository_stability_relations`.`more_stable`=`repository_stabilities`.`id`'
printf ' WHERE `repository_stabilities`.`name` = "staging"'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
p
diff --git a/bin/get-assignment b/bin/get-assignment
index e3299f6..bc67fab 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -58,7 +58,7 @@ hand_out_assignment() {
"$(printf '%s' "$4" | base64 -w0)"
printf ' LIMIT 1;\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
@@ -104,7 +104,7 @@ hand_out_assignment() {
printf ' `upstream_repositories`.`name` = from_base64("%s");\n' \
"$(printf '%s' "$4" | base64 -w0)"
} | \
- ${mysql_command}
+ mysql_run_query
# lock every loop this package breaks
find "${work_dir}/build-list.loops" -maxdepth 1 -regextype grep \
@@ -157,7 +157,7 @@ currently_building=$(
printf ' AND `repositories`.`name`="build-list"'
printf ' LIMIT 1;\n'
} | \
- ${mysql_command} --batch --raw | \
+ mysql_run_query --batch --raw | \
sed '1d'
)
@@ -214,7 +214,7 @@ next_building=$(
printf ' ORDER BY `requested` DESC, `priority` DESC, `last_trial`, `part_of_loop`, `build_assignments`.`id`'
printf ' LIMIT 1;\n'
} | \
- ${mysql_command} --batch --raw | \
+ mysql_run_query --batch --raw | \
sed '
1d
y/\t/ /
@@ -238,7 +238,7 @@ count_pending=$(
printf ' AND `build_assignments`.`is_blocked` IS NULL'
printf ';\n'
} | \
- ${mysql_command} --batch --raw | \
+ mysql_run_query --batch --raw | \
sed '1d'
)
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 2fd0993..11f384c 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -129,7 +129,7 @@ delete_package() {
printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");' \
"$(printf '%s' "$1" | base64 -w0)"
} | \
- ${mysql_command}
+ mysql_run_query
fi
}
@@ -144,7 +144,7 @@ clean_up() {
printf ' WHERE `repositories`.`name`="to-be-decided"'
printf ');\n'
} | \
- ${mysql_command}
+ mysql_run_query
}
tmp_dir=$(mktemp -d 'tmp.get-package-updates.XXXXXXXXXX' --tmpdir)
trap 'clean_up' EXIT
@@ -353,7 +353,7 @@ done | \
base64 -w0
)"
} | \
- ${mysql_command}
+ mysql_run_query
mysql_generate_package_metadata 'to-be-decided' "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}"
generate_package_metadata "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}"
continue
@@ -391,7 +391,7 @@ black_listed_new=$(
printf ' FROM `package_sources`'
printf ' WHERE `package_sources`.`pkgbase` LIKE "lib32-%%"'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d'
} | \
sort -u
@@ -443,7 +443,7 @@ while [ -n "${black_listed_new}" ]; do
printf ' WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`'
printf ');\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d' | \
sort -u
} | \
@@ -604,7 +604,7 @@ fi
printf ')'
printf ' WHERE `from_repo`.`name`="to-be-decided";\n'
} | \
- ${mysql_command}
+ mysql_run_query
# update loop list in database (beware, the packages are expected to be in "build-list",
# not "to-be-decided", so we need to run this after moving the packages from "to-be-decided" to the "build-list".
diff --git a/bin/modify-package-state b/bin/modify-package-state
index b0ba53e..8c5fac7 100755
--- a/bin/modify-package-state
+++ b/bin/modify-package-state
@@ -225,7 +225,7 @@ while read -r package reason; do
;;
esac
if printf 'SELECT 1 FROM %s %s AND %s LIMIT 1' "${combiner}" "${selector}" "${tester}" | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d' | \
grep -qxF '1'; then
# shellcheck disable=SC2016
@@ -242,7 +242,7 @@ while read -r package reason; do
printf ' AND NOT `b`.`is_tested`'
printf ' AND NOT `repositories`.`name`="deletion-list";\n'
} | \
- ${mysql_command}
+ mysql_run_query
case "${action}" in
'block')
printf '%s' "${reason}" > \
diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list
index e8dcf0a..1ff3d5a 100755
--- a/bin/prioritize-build-list
+++ b/bin/prioritize-build-list
@@ -46,7 +46,7 @@ fi
"$(printf '%s' "$1" | base64 -w0)"
printf ' AND `repositories`.`name`="build-list";\n'
} | \
- ${mysql_command}
+ mysql_run_query
# Remove the lock file
diff --git a/bin/return-assignment b/bin/return-assignment
index db433ee..ed29f34 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -70,7 +70,7 @@ if [ "$5" = 'ERROR' ]; then
"$(printf '%s' "$4" | base64 -w0)"
printf ' AND `repositories`.`name`="build-list"'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /
@@ -111,7 +111,7 @@ if [ "$5" = 'ERROR' ]; then
printf 'SELECT `fail_reasons`.`id`,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")'
printf ' FROM `fail_reasons` ORDER BY `fail_reasons`.`severity`'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d'
)
for saved_build_log in ${saved_build_logs}; do
@@ -164,7 +164,7 @@ if [ "$5" = 'ERROR' ]; then
base64 -w0
)"
} | \
- ${mysql_command}
+ mysql_run_query
# shellcheck disable=SC2154
sed -i '
@@ -283,7 +283,7 @@ if ! {
printf ' AND `binary_packages`.`sub_pkgrel`=from_base64("%s");\n' \
"$(printf '%s' "$5" | base64 -w0)"
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d' | \
grep -vxF '0'; then
>&2 echo 'Sorry, the sent package is outdated.'
@@ -441,7 +441,7 @@ package_errors=$(
printf ' AND `repositories`.`name`="build-list"'
printf ';\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
'
@@ -513,7 +513,7 @@ find . -maxdepth 1 -name '*.pkg.tar.xz-namcap.log.gz' -execdir mv '{}' "${build_
printf ';\n'
done
} | \
- ${mysql_command}
+ mysql_run_query
# move packages
destination=$(official_or_community "$1.$2.$3.$4" 'staging')
@@ -605,7 +605,7 @@ fi
printf ');\n'
printf 'DROP TABLE `loops_to_delete`;\n'
} | \
- ${mysql_command}
+ mysql_run_query
rm -f \
"${work_dir}/package-states/$1.$2.$3.$4.locked" \
"${work_dir}/package-states/$1.$2.$3.$4.broken"
diff --git a/bin/seed-build-list b/bin/seed-build-list
index 465ef5d..b9ae193 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -125,7 +125,7 @@ if [ -s "${tmp_dir}/mirrors" ]; then
printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
s/^\(.*\)-\([^-]\+-[^-]\+\)-\([^-]\+\)/ours \2 \3 \1/
@@ -206,7 +206,7 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V
printf ' WHERE `ignore_packages`.`pkgname`=`must_haves`.`pkgname`'
printf ') AND NOT `must_haves`.`pkgname` LIKE "lib32-%%";\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '1d' | \
while read -r pkgname; do
content=$(
@@ -294,7 +294,7 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V
printf ' WHERE `ignore_packages`.`pkgname`=`binary_packages`.`pkgname`'
printf ');\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sort -u | \
sed '
y/\t/ /
diff --git a/bin/show-dependencies b/bin/show-dependencies
index 4e90258..9e94fe3 100755
--- a/bin/show-dependencies
+++ b/bin/show-dependencies
@@ -10,7 +10,7 @@
if [ $# -eq 0 ]; then
broken=$(
printf 'CALL show_broken_packages_and_dependencies;\n' | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
s/\s.*$//
@@ -178,7 +178,7 @@ for target_package in "$@"; do
mysql_join_dependencies_install_targets
printf ';\n'
} | \
- ${mysql_command} -N --raw --batch | \
+ mysql_run_query -N --raw --batch | \
sed '
y/\t/ /
/^knot /{
diff --git a/bin/slave-build-connect b/bin/slave-build-connect
index 119592e..f8ee9ad 100755
--- a/bin/slave-build-connect
+++ b/bin/slave-build-connect
@@ -29,7 +29,7 @@ if [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xget-assignment' ] || \
base64 -w0
)"
} | \
- ${mysql_command}
+ mysql_run_query
slave="$1" /bin/sh -c "${base_dir}/bin/${SSH_ORIGINAL_COMMAND}"
diff --git a/bin/why-dont-you b/bin/why-dont-you
index d95f2a7..b5d73c5 100755
--- a/bin/why-dont-you
+++ b/bin/why-dont-you
@@ -85,7 +85,7 @@ case "${action}" in
printf ' LEFT JOIN `build_slaves` ON `build_slaves`.`currently_building`=`to_build`.`ba_id`'
printf ';\n'
} | \
- ${mysql_command} --raw --batch | \
+ mysql_run_query --raw --batch | \
sed '
1d
y/\t/ /