summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-09-12 13:27:35 +0200
committerErich Eckner <git@eckner.net>2019-09-12 13:27:35 +0200
commitb0ad0a2bd9349e834ff3cc0bc0d7c35c07efa3c2 (patch)
treef5ec0371445596b578d846347bd3478986831e81
parent20ba272ee51a1deb4b5f2afc76bdcf019f629082 (diff)
downloadbuilder-b0ad0a2bd9349e834ff3cc0bc0d7c35c07efa3c2.tar.xz
bin/return-assignment: save out-of-date flag from upstream
-rwxr-xr-xbin/return-assignment58
1 files changed, 57 insertions, 1 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 5bf4c51..b29292b 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -103,6 +103,11 @@ if [ "$6" = 'ERROR' ]; then
printf 'SELECT'
printf ' `build_assignments`.`id`,'
printf 'IF(`build_assignments`.`is_broken`,"true","false"),'
+ printf 'replace(to_base64(%s),"\\n",""),' \
+ '`package_sources`.`upstream_flag_date`' \
+ '`binary_packages`.`pkgver`'
+ printf '`binary_packages`.`epoch`,'
+ printf '`binary_packages`.`pkgrel`,'
printf '`ba_a`.`name`'
printf ' FROM `build_slaves`'
mysql_join_build_slaves_build_assignments
@@ -143,6 +148,22 @@ if [ "$6" = 'ERROR' ]; then
fi
build_assignment_architecture="${infos##* }"
infos="${infos% ${build_assignment_architecture}}"
+ pkgrel="${infos##* }"
+ infos="${infos% ${pkgrel}}"
+ epoch="${infos##* }"
+ infos="${infos% ${epoch}}"
+ pkgver="${infos##* }"
+ infos="${infos% ${pkgver}}"
+ pkgver=$(
+ printf '%s' "${pkgver}" \
+ | base64 -d
+ )
+ upstream_flag_date="${infos##* }"
+ infos="${infos% ${upstream_flag_date}}"
+ upstream_flag_date=$(
+ printf '%s' "${upstream_flag_date}" \
+ | base64 -d
+ )
was_broken_before="${infos##* }"
build_assignment_id="${infos% ${was_broken_before}}"
@@ -156,6 +177,35 @@ if [ "$6" = 'ERROR' ]; then
'*.build-log.gz'
)
+ if [ "${upstream_flag_date}" = '0000-00-00' ]; then
+ upstream_flag_date=$(
+ curl -Ss 'https://www.archlinux.org/packages/search/json/?name='"$1" \
+ | sed '
+ s/{/\0\n/g
+ s/}/\n\0/g
+ ' \
+ | sed '
+ 1,2 d
+ $ d
+ ' \
+ | grep -F '"pkgname": "'"$1"'"' \
+ | grep -F '"epoch": '"${epoch}"'' \
+ | grep -F '"pkgver": "'"${pkgver}"'"' \
+ | grep -F '"pkgrel": "'"${pkgrel}"'"' \
+ | sed -n '
+ s/^.*"flag_date": "\([^"]\+\)",.*$/\1/
+ T
+ s/\.[0-9]\+[^.]*$//
+ T
+ y/T/ /
+ /^[0-9]\{4\}\(-[0-9]\{2\}\)\{2\} \([0-9]\{2\}:\)\{2\}[0-9]\{2\}$/ p
+ '
+ )
+ if [ -z "${upstream_flag_date}" ]; then
+ upstream_flag_date='0000-00-00 00:00:00'
+ fi
+ fi
+
# shellcheck disable=SC2016
{
if [ -n "${saved_build_logs}" ]; then
@@ -214,8 +264,14 @@ if [ "$6" = 'ERROR' ]; then
printf 'COMMIT;\n'
fi
printf 'UPDATE `build_assignments`'
+ mysql_join_build_assignments_package_sources
printf ' SET `build_assignments`.`is_broken`=1,'
- printf '`build_assignments`.`priority`=0'
+ printf '`build_assignments`.`priority`=0,'
+ printf '`package_sources`.`upstream_flag_date`=from_base64("%s")' \
+ "$(
+ printf '%s' "${upstream_flag_date}" | \
+ base64 -w0
+ )"
printf ' WHERE `build_assignments`.`id`=from_base64("%s");\n' \
"$(
printf '%s' "${build_assignment_id}" | \