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-02-11 21:05:26 +0100
committerErich Eckner <git@eckner.net>2018-02-11 21:05:26 +0100
commit3a10fa0e0834764c6a87f7ae93081361fc99d10e (patch)
treec672fa245253aa2901fe8aea6f9d376d8d9786a0
parent9252ad4a7f3dbabf9b6c0e59219d94f3b1066a25 (diff)
bin/return-assignment: rely on db for checking if sent package is actually to be built currently
-rwxr-xr-xbin/return-assignment34
1 files changed, 25 insertions, 9 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 9dd7a2b..5560bd0 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -265,19 +265,35 @@ clean_up_lock_file() {
rm -f "${package_database_lock_file}"
}
-if ! grep -qxF "$1 $2 $3 $4" "${work_dir}/build-list" ||
- ! [ -f "${work_dir}/package-states/$1.$2.$3.$4.locked" ] ||
- ! [ "$5" = "$(next_sub_pkgrel "$1" "$2" "$3" "$4")" ]; then
+# shellcheck disable=SC2016
+if ! {
+ printf 'SELECT count(*)'
+ printf ' FROM `binary_packages`'
+ printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \
+ 'build_assignments' 'build_assignments' 'binary_packages' 'build_assignment' \
+ 'build_slaves' 'build_assignments' 'build_slaves' 'currently_building' \
+ 'repositories' 'repositories' 'binary_packages' 'repository' \
+ 'package_sources' 'package_sources' 'build_assignments' 'package_source' \
+ 'upstream_repositories' 'upstream_repositories' 'package_sources' 'upstream_package_repository'
+ printf ' WHERE `repositories`.`name`="build-list"'
+ printf ' AND `build_slaves`.`name`=from_base64("%s")' \
+ "$(printf '%s' "${slave}" | base64 -w0)"
+ printf ' AND `package_sources`.`%s`=from_base64("%s")' \
+ 'pkgbase' "$(printf '%s' "$1" | base64 -w0)" \
+ 'git_revision' "$(printf '%s' "$2" | base64 -w0)" \
+ 'mod_git_revision' "$(printf '%s' "$3" | base64 -w0)"
+ printf ' AND `upstream_repositories`.`name`=from_base64("%s")' \
+ "$(printf '%s' "$4" | base64 -w0)"
+ printf ' AND `binary_packages`.`sub_pkgrel`=from_base64("%s");\n' \
+ "$(printf '%s' "$5" | base64 -w0)"
+ } | \
+ ${mysql_command} --raw --batch | \
+ sed '1d' | \
+ grep -vxF '0'; then
>&2 echo 'Sorry, the sent package is outdated.'
exit 2
fi
-# shellcheck disable=SC2154
-if ! grep -qxF "${slave}" "${work_dir}/package-states/$1.$2.$3.$4.locked"; then
- >&2 echo 'Whoops, this package is not built by this slave.'
- exit 2
-fi
-
clean_up_tmp_dir() {
cd "${base_dir}"
rm -rf --one-file-system "${tmp_dir}"