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-01-23 12:05:00 +0100
committerErich Eckner <git@eckner.net>2018-01-23 12:05:00 +0100
commitef0f12279a548aa30e987a29732b82622d302422 (patch)
tree056ab4ee30cf56b7ce62fdd14863f8d583028196 /bin/return-assignment
parentb7d3486e4c401294182f38917dede3e48616df5e (diff)
bin/return-assignment: fix multy-line output from mysql query
Diffstat (limited to 'bin/return-assignment')
-rwxr-xr-xbin/return-assignment24
1 files changed, 20 insertions, 4 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index a2b4c88..2253986 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -87,17 +87,33 @@ if [ "$5" = 'ERROR' ]; then
'reason' 'SMALLINT' \
'log_file' 'VARCHAR(512)' | \
sed 's/,$//'
- printf ');'
+ printf ');\n'
printf 'INSERT INTO `failures` (`date`,`reason`,`log_file`) VALUES'
fail_reason_identifiers=$(
- printf 'SELECT `fail_reasons`.`id`,to_base64(`fail_reasons`.`identifier`) FROM `fail_reasons` ORDER BY `fail_reasons`.`severity`' | \
+ {
+ printf 'SELECT `fail_reasons`.`id`,to_base64(`fail_reasons`.`identifier`),"%%END%%"'
+ printf ' FROM `fail_reasons` ORDER BY `fail_reasons`.`severity`'
+ } | \
${mysql_command} --raw --batch | \
- sed '1d'
+ sed '
+ 1d
+ :start
+ s/\s%END%$//
+ t
+ N
+ s/\n//g
+ b start
+ '
)
for saved_build_log in ${saved_build_logs}; do
printf '%s' "${fail_reason_identifiers}" | \
while read -r reason_id identifier; do
- if zgrep -q "^$(printf '%s' "${identifier}" | base64 -d)\$" "${build_log_directory}/error/$1.$2.$3.$4.${saved_build_log}"; then
+ if zgrep -q "^$(
+ printf '%s' "${identifier}" | \
+ base64 -d
+ )\$" \
+ "${build_log_directory}/error/$1.$2.$3.$4.${saved_build_log}"; then
+
printf ' (from_base64("%s"),%s,from_base64("%s")),' \
"$(
printf '%s' "${saved_build_log}" | \