Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-01 09:57:59 +0100
committerErich Eckner <git@eckner.net>2018-02-01 09:57:59 +0100
commit0553c6d12a5e310899e8a5679913faafa72b17fb (patch)
tree8e51e929529b51e8c7f10a5def71fb573a070725 /bin
parent12f0a85eccf4803af088399843fe915a598f3f20 (diff)
bin/build-master-status: write todos into database
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-master-status57
1 files changed, 57 insertions, 0 deletions
diff --git a/bin/build-master-status b/bin/build-master-status
index 4d47976..2477e3b 100755
--- a/bin/build-master-status
+++ b/bin/build-master-status
@@ -502,6 +502,7 @@ if ${web}; then
s/\n[^:\n]\+:[0-9]\+:[^\n]*$/\n/
p
' | \
+ tee "${tmp_dir}/todos" | \
sed '
:a
N
@@ -517,6 +518,62 @@ if ${web}; then
} > \
"${tmp_dir}/todos.html"
+ if [ -s "${tmp_dir}/todos" ]; then
+ sed '
+ :a
+ N
+ /\n$/!ba
+ s|^[^\n]*/\([^/\n]\+/[^/\n]\+\)\n\([0-9]\+\)\n\([0-9]\+\)\n|\1 \3 |
+ s/\n$//
+ s/\n/\\n/g
+ ' -i "${tmp_dir}/todos"
+ while read -r file line desc; do
+ printf '%s %s %s\n' \
+ "$(printf '%s' "${file}" | base64 -w0)" \
+ "$(printf '%s' "${line}" | base64 -w0)" \
+ "$(printf '%s' "${desc}" | base64 -w0)"
+ done < \
+ "${tmp_dir}/todos" | \
+ sponge "${tmp_dir}/todos"
+ # update todos
+ # shellcheck disable=SC2016
+ while read -r file line desc; do
+ printf 'UPDATE TABLE `todos`'
+ printf ' SET `todos`.`line`=from_base64("%s")' \
+ "${line}"
+ printf ' WHERE `todos`.`file`=from_base64("%s")' \
+ "${file}"
+ printf ' AND `todos`.`desc`=from_base64("%s");\n' \
+ "${desc}"
+
+ printf 'UPDATE TABLE `todos`'
+ printf ' SET `todos`.`desc`=from_base64("%s")' \
+ "${desc}"
+ printf ' WHERE `todos`.`file`=from_base64("%s")' \
+ "${file}"
+ printf ' AND `todos`.`line`=from_base64("%s");\n' \
+ "${line}"
+ done | \
+ ${mysql_command}
+ # insert unfound todos
+ # shellcheck disable=SC2016
+ while read -r file line desc; do
+ printf ' ('
+ printf 'from_base64("%s"),' \
+ "${file}" \
+ "${line}" \
+ "${desc}" | \
+ sed 's/,$/),/'
+ done < \
+ "${tmp_dir}/todos" | \
+ sed '
+ 1 i INSERT IGNORE INTO `todos` (`file`,`line`,`description`) VALUES
+ s/,$/;\n/
+ ' | \
+ ${mysql_command}
+ rm -f "${tmp_dir}/todos"
+ fi
+
{
printf '%s\n' \
'<html>' \