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-06-26 11:49:55 +0200
committerErich Eckner <git@eckner.net>2018-06-26 11:49:55 +0200
commit6dffa7c3c6dc71b70dac9a2bd24faf6825fbe63f (patch)
treeb036242b91cbdaf643744a7ed210135da9af5299
parent98135be47afde21363d39b6ea5b8be8f10e435a1 (diff)
lib/load-configuration,lib/mysql-functions: make runable outside of build-master in build-master mode
-rwxr-xr-xlib/load-configuration19
-rwxr-xr-xlib/mysql-functions26
2 files changed, 23 insertions, 22 deletions
diff --git a/lib/load-configuration b/lib/load-configuration
index c89e757..fb9a2a2 100755
--- a/lib/load-configuration
+++ b/lib/load-configuration
@@ -19,19 +19,23 @@ work_dir="${base_dir}/work"
# shellcheck source=../lib/common-functions
. "${base_dir}/lib/common-functions"
+if [ "$(hostname)" = 'buildmaster.archlinux32.org' ]; then
+ i_am_the_master=true
+else
+ i_am_the_master=false
+fi
+
# if mysqld is not running, we're either on a build slave and don't need
# lib/mysql-functions or we're on the build master and something is wrong
# anyway
if pgrep -x mysqld >/dev/null 2>&1; then
# shellcheck source=../lib/mysql-functions
. "${base_dir}/lib/mysql-functions"
+ # load static values from the database
+ mysql_retrieve_static_information
fi
-if [ "$(hostname)" = 'buildmaster.archlinux32.org' ]; then
- i_am_the_master=true
-else
- i_am_the_master=false
-
+if ! ${i_am_the_master}; then
repo_names='packages community archlinux32'
repo_paths__packages="${work_dir}/repos/packages"
repo_paths__community="${work_dir}/repos/community"
@@ -107,11 +111,6 @@ if ! ${i_am_the_master} && \
. "${base_dir}/conf/slave.conf"
fi
-# load static values from the database
-if pgrep -x mysqld >/dev/null 2>&1; then
- mysql_retrieve_static_information
-fi
-
# check / set up environment
if [ -z "${build_list_lock_file}" ]; then
diff --git a/lib/mysql-functions b/lib/mysql-functions
index c7c87f0..2fccf46 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -62,19 +62,21 @@ mysql_run_query() {
# a present query_file means there was an error
if [ -f "${query_stdin}" ]; then
>&2 printf 'I could not complete a mysql query!\n'
- if [ ! -s "${work_dir}/build-master-sanity" ] && \
- [ -z "${file_name_extra}" ]; then
- printf '\001ACTION failed to execute a mysql query - can you have a look at "%s"?.\001\n' \
- "${query_stdin##*/}" \
- | irc_say
+ if ${i_am_the_master}; then
+ if [ ! -s "${work_dir}/build-master-sanity" ] && \
+ [ -z "${file_name_extra}" ]; then
+ printf '\001ACTION failed to execute a mysql query - can you have a look at "%s"?.\001\n' \
+ "${query_stdin##*/}" \
+ | irc_say
+ fi
+ for file in \
+ "${query_stdin}" \
+ "${query_stdout}" \
+ "${query_stderr}"; do
+ cp "${file}" "${webserver_directory}/mysql-queries/${file##*/}.txt"
+ chmod go+r "${webserver_directory}/mysql-queries/${file##*/}.txt"
+ done
fi
- for file in \
- "${query_stdin}" \
- "${query_stdout}" \
- "${query_stderr}"; do
- cp "${file}" "${webserver_directory}/mysql-queries/${file##*/}.txt"
- chmod go+r "${webserver_directory}/mysql-queries/${file##*/}.txt"
- done
if [ -z "${file_name_extra}" ]; then
echo 'A mysql query failed.' > \
"${work_dir}/build-master-sanity"