summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/bootstrap-mysql2
-rwxr-xr-xbin/build-packages7
-rwxr-xr-xbin/change-git-remotes2
-rwxr-xr-xbin/check-opcodes2
-rwxr-xr-xbin/clean-cache2
-rwxr-xr-xbin/clean-dependencies2
-rwxr-xr-xbin/db-update48
-rwxr-xr-xbin/delete-packages2
-rwxr-xr-xbin/get-assignment4
-rwxr-xr-xbin/ii-answer56
-rwxr-xr-xbin/ii-connect4
-rwxr-xr-xbin/ii-watch4
-rwxr-xr-xbin/interpret-mail2
-rwxr-xr-xbin/nit-picker6
-rwxr-xr-xbin/slave-build-connect6
-rwxr-xr-xconf/master.conf.example2
-rwxr-xr-xlib/common-functions6
-rwxr-xr-xlib/intentions-queue6
-rwxr-xr-xlib/load-configuration4
-rwxr-xr-xlib/mysql-functions13
20 files changed, 112 insertions, 68 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index 711f3d1..fbcbc47 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -695,7 +695,7 @@ fi
printf 'DELIMITER ;\n'
- if [ "x$1" != 'x-no-privileges' ]; then
+ if [ "$1" != '-no-privileges' ]; then
printf 'GRANT %s ON %s TO '"'"'buildmaster'"'"'@'"'"'localhost'"'"';\n' \
'CREATE ROUTINE' 'buildmaster.*' \
'CREATE TEMPORARY TABLES' 'buildmaster.*' \
diff --git a/bin/build-packages b/bin/build-packages
index d73a440..9c5ab03 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -309,9 +309,10 @@ while [ "${count}" -ne 0 ] && \
if [ "${git_revision##*-}" = 'HEAD' ]; then
git_revision=$(
repo_name="${git_revision%-*}"
- eval repo_path='"${repo_paths__'"${repo_name}"'}"'
- if [ -z "${repo_path}" ]; then
- >&2 printf 'Unknown git repository "%s".\n' "${repo_name}"
+ eval l_repo_path='"${repo_paths__'"${repo_name}"'}"'
+ # shellcheck disable=SC2154
+ if [ -z "${l_repo_path}" ]; then
+ >&2 printf 'Unknown git repository "%s".\n' "${l_repo_name}"
exit 2
fi
git -C "${repo_path}" rev-parse HEAD
diff --git a/bin/change-git-remotes b/bin/change-git-remotes
index bc8e3f2..b7f687c 100755
--- a/bin/change-git-remotes
+++ b/bin/change-git-remotes
@@ -3,7 +3,7 @@
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
-if [ $# -eq 1 ] && [ "x$1" = 'x-q' ]; then
+if [ $# -eq 1 ] && [ "$1" = '-q' ]; then
quiet=true
elif [ $# -ne 0 ]; then
printf 'change-git-remotes [-q]\n'
diff --git a/bin/check-opcodes b/bin/check-opcodes
index e9f69a2..e8bb807 100755
--- a/bin/check-opcodes
+++ b/bin/check-opcodes
@@ -90,7 +90,7 @@ shift $((OPTIND-1))
PACKAGE=$1
-if test "x$PACKAGE" = "x"; then
+if test "$PACKAGE" = ""; then
echo "ERROR: Filename of a package required as argument" >&2
usage
exit 1
diff --git a/bin/clean-cache b/bin/clean-cache
index 8e6fb3c..21f1370 100755
--- a/bin/clean-cache
+++ b/bin/clean-cache
@@ -9,7 +9,7 @@
if [ $# -eq 0 ]; then
dummynator='sudo'
-elif [ $# -eq 1 ] && [ "x$1" = 'x-n' ]; then
+elif [ $# -eq 1 ] && [ "$1" = '-n' ]; then
dummynator='echo'
else
>&2 echo 'usage: clean-cache [-n]'
diff --git a/bin/clean-dependencies b/bin/clean-dependencies
index 82d49b3..63e9a9a 100755
--- a/bin/clean-dependencies
+++ b/bin/clean-dependencies
@@ -67,7 +67,7 @@ trap 'rm "${deps_file}"' EXIT
printf 'INSERT IGNORE INTO `bps`(`bp`)'
printf ' SELECT `deps`.`bp`'
printf ' FROM `deps`;\n'
- if [ $# -eq 1 ] && [ "x$1" = 'x-f' ]; then
+ if [ $# -eq 1 ] && [ "$1" = '-f' ]; then
printf 'DELETE `dependencies`'
else
printf 'SELECT *'
diff --git a/bin/db-update b/bin/db-update
index 59badd4..88c567d 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -52,13 +52,16 @@ usage() {
>&2 echo ' Move forward any package which replaces no package whose'
>&2 echo ' dependencies are all available somewhere.'
>&2 echo ' Note, that this _may_ move _less_ packages.'
+ >&2 echo ' -s|--stuck:'
+ >&2 echo ' Force movement of every package, that is stuck for too'
+ >&2 echo ' long, and move nothing else.'
>&2 echo ' -w|--wait:'
>&2 echo ' If necessary, wait for lock blocking.'
[ -z "$1" ] && exit 1 || exit "$1"
}
eval set -- "$(
- getopt -o ef:hino:pw \
+ getopt -o ef:hino:psw \
--long everything \
--long force: \
--long help \
@@ -66,6 +69,7 @@ eval set -- "$(
--long no-action \
--long only: \
--long progressive \
+ --long stuck \
--long wait \
-n "$(basename "$0")" -- "$@" || \
echo usage
@@ -77,6 +81,7 @@ no_action_flag=''
progressive=false
force_pkgs=''
force_every_pkg=false
+force_stuck_pkgs=false
only=''
while true
@@ -116,6 +121,9 @@ do
>&2 echo 'Do not use this option, it is currently broken.'
exit 42
;;
+ -s|--stuck)
+ force_stuck_pkgs=true
+ ;;
-w|--wait)
block_flag=''
;;
@@ -143,6 +151,8 @@ ${progressive} \
&& number_of_force_flags=$((number_of_force_flags+1))
${force_every_pkg} \
&& number_of_force_flags=$((number_of_force_flags+1))
+${force_stuck_pkgs} \
+&& number_of_force_flags=$((number_of_force_flags+1))
if [ ${number_of_force_flags} -gt 1 ]; then
>&2 echo 'db-update: conflicting arguments'
@@ -171,7 +181,7 @@ if [ -n "${only}" ]; then
printf 's@^!%s\\(/.\\+\\)\\?$@' \
"${arch}"
for arch2 in i486 i686 pentium4; do
- if [ "${arch}" == "${arch2}" ]; then
+ if [ "${arch}" = "${arch2}" ]; then
continue
fi
printf '%s\\1\\n' \
@@ -310,7 +320,8 @@ mysql_query_update_replaced_bpir() {
# repository_moves, because only repositories with the same
# architectures should be listed there.
if [ -n "${force_pkgs}" ] || \
- ${force_every_pkg}; then
+ ${force_every_pkg} || \
+ ${force_stuck_pkgs}; then
printf 'DROP TEMPORARY TABLE IF EXISTS `%s_bpir`;\n' \
'moveable' 'replaced'
printf 'CREATE TEMPORARY TABLE `replaced_bpir` (`id` BIGINT, `replaced_by` BIGINT, UNIQUE KEY (`id`));\n'
@@ -321,6 +332,10 @@ mysql_query_update_replaced_bpir() {
printf ' FROM `binary_packages_in_repositories`'
mysql_join_binary_packages_in_repositories_repositories
printf ' AND `repositories`.`is_on_master_mirror`'
+ printf ' AND `repositories`.`stability`=%s' \
+ "${source_stability_id}"
+ printf ' AND `repositories`.`architecture`=%s' \
+ "${arch_id}"
mysql_join_repositories_architectures
mysql_join_binary_packages_in_repositories_binary_packages
printf ' JOIN `binary_packages` AS `f_bp`'
@@ -337,19 +352,26 @@ mysql_query_update_replaced_bpir() {
printf 'from_base64("%s"),' \
${force_pkgs} | \
sed 's/,$/);\n/'
+ elif ${force_stuck_pkgs}; then
+ printf ' WHERE `binary_packages_in_repositories`.`last_moved` < DATE_SUB(NOW(),INTERVAL '
+ # shellcheck disable=SC2154
+ case "${source_stability_id}" in
+ "${repository_stability_ids__testing}")
+ printf '%s.5' "$((max_testing_duration+2))"
+ ;;
+ "${repository_stability_ids__staging}")
+ printf '2.5'
+ ;;
+ *)
+ >&2 printf 'unknown source stability id: %s\n' "${source_stability_id}"
+ printf '1000000'
+ ;;
+ esac
+ printf ' day);\n'
else # ${force_every_pkg}
printf ';\n'
fi
- printf 'DELETE `moveable_bpir`'
- printf ' FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories`'
- printf ' ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
- mysql_join_binary_packages_in_repositories_binary_packages
- mysql_join_binary_packages_in_repositories_repositories
- printf ' WHERE `repositories`.`stability`!=%s' \
- "${source_stability_id}"
- printf ' OR `repositories`.`architecture`!=%s;\n' \
- "${arch_id}"
+
printf 'UPDATE `moveable_bpir`'
printf ' JOIN `binary_packages_in_repositories`'
printf ' ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
diff --git a/bin/delete-packages b/bin/delete-packages
index a2e932c..2bb3072 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -152,6 +152,7 @@ export TMPDIR="${tmp_dir}"
{
printf 'CREATE TEMPORARY TABLE `bpir_to_delete` (`id` BIGINT, UNIQUE KEY (`id`));\n'
printf 'INSERT IGNORE INTO `bpir_to_delete`'
+ # shellcheck disable=SC2030
if [ -n "${force_packages}" ]; then
printf ' SELECT'
printf ' `binary_packages_in_repositories`.`id`'
@@ -342,6 +343,7 @@ export TMPDIR="${tmp_dir}"
}
'
+# shellcheck disable=SC2031
if [ -n "${build_support}" ] && \
[ -w "${build_support}" ] && \
[ ! -p "${build_support}" ]; then
diff --git a/bin/get-assignment b/bin/get-assignment
index f2930c4..6abfaef 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -553,7 +553,7 @@ next_building=$(
printf '`build_assignments`.`id`'
printf ' LIMIT 1;\n'
} | \
- mysql_run_query
+ mysql_run_query 'unimportant'
)
if [ -n "${next_building}" ]; then
hand_out_assignment "${next_building}"
@@ -579,7 +579,7 @@ count_pending=$(
"${arch}"
printf ';\n'
} | \
- mysql_run_query
+ mysql_run_query 'unimportant'
)
if [ "${count_pending}" -eq 0 ]; then
diff --git a/bin/ii-answer b/bin/ii-answer
index ffaa08b..16fbb78 100755
--- a/bin/ii-answer
+++ b/bin/ii-answer
@@ -7,25 +7,43 @@
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
-# welcome devs (in #archlinux32 only)
-welcome_user_regex='^\S\+ -!- \(abaumann\|buildmaster\|deep42thought\|girls\|nit-picker\|tyzoid\)(.* has joined \S\+$'
-new_users=$(
- sed -i '
- s/'"${welcome_user_regex}"'/\1/
- T
- w /dev/stdout
- d
- ' "${irc_dir}/#archlinux32/out" | \
- sort -u
-)
-if [ -n "${new_users}" ]; then
- printf '%s\n' "${new_users}" | \
- sed '
- s/^.*$/Hi \0!\n!rq \0/
- s/Hi buildmaster!\n//
- ' | \
- irc_say '' 'copy'
-fi
+# welcome devs (in #archlinux32 and #archlinux32-devops only)
+welcome_user_regex='^\S\+ -!- \(abaumann\|deep42thought\)(.* has joined \S\+$'
+for channel in '#archlinux32:Hi \0!\n!rq \0' '#archlinux32-devops:Hi \0!'; do
+ new_users=$(
+ sed -i '
+ s/'"${welcome_user_regex}"'/\1/
+ T
+ w /dev/stdout
+ d
+ ' "${irc_dir}/${channel%%:*}/out" \
+ | grep -vxF "$(
+ {
+ printf '%s SNIP\n' $(($(date +%s)-5*60))
+ cat "${irc_dir}/out"
+ cat "${irc_dir}/${channel%%:*}/out"
+ } \
+ | sort -k1nr,1 \
+ | sed '
+ /^\S\+ SNIP$/q
+ ' \
+ | sed '
+ s/^\S\+\s\+-!- \([^([:space:]]\+\)\((\S\+\)\? has quit.*$/\1/
+ t
+ d
+ ' \
+ | sort -u
+ )" \
+ | sort -u
+ )
+ if [ -n "${new_users}" ]; then
+ printf '%s\n' "${new_users}" | \
+ sed '
+ s/^.*$/'"${channel#*:}"'/
+ ' | \
+ irc_say "${channel%%:*}" 'copy'
+ fi
+done
find "${irc_dir}" \
-type f \
diff --git a/bin/ii-connect b/bin/ii-connect
index 652f94a..1e09d11 100755
--- a/bin/ii-connect
+++ b/bin/ii-connect
@@ -20,6 +20,6 @@ while ! grep -q 'You are \(now identified for\|already logged in as\) ' "${irc_d
sleep 5
done
-# join channel
-echo '/j #archlinux32' | \
+# join channels
+printf '/j #archlinux32%s\n' '' '-devops' | \
sponge "${irc_dir}/in"
diff --git a/bin/ii-watch b/bin/ii-watch
index 8ebefbe..ae008c4 100755
--- a/bin/ii-watch
+++ b/bin/ii-watch
@@ -23,7 +23,7 @@ while pgrep -x 'ii' >/dev/null && \
$(date +%s) + 60*5
))
fi
- echo '/NAMES #archlinux32' \
+ echo '/NAMES #archlinux32-devops' \
| sponge "${irc_dir}/in"
fi
if [ -z "${said}" ]; then
@@ -65,7 +65,7 @@ while pgrep -x 'ii' >/dev/null && \
{
echo 0
sed '
- s/^\([0-9]\+\) = #archlinux32\( \S\+\)* buildmaster\( \S\+\)*$/\1/
+ s/^\([0-9]\+\) = #archlinux32-devops\( \S\+\)* buildmaster\( \S\+\)*$/\1/
t
d
' "${irc_dir}/out"
diff --git a/bin/interpret-mail b/bin/interpret-mail
index 1d6bf7f..2580c00 100755
--- a/bin/interpret-mail
+++ b/bin/interpret-mail
@@ -1,6 +1,6 @@
#!/bin/sh
-# shellcheck disable=SC2119,SC2120
+# shellcheck disable=SC2119,SC2120,SC3043
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
diff --git a/bin/nit-picker b/bin/nit-picker
index 0739923..8dd0156 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -86,7 +86,7 @@ if ${irc}; then
rm -rf --one-file-system "${irc_dir}"
- ii -s irc.freenode.net -n nit-picker -f nit-picker >/dev/null 2>&1 &
+ ii -s irc.libera.chat -n nit-picker -f nit-picker >/dev/null 2>&1 &
ii_pid=$!
clean_up() {
@@ -109,10 +109,10 @@ if ${irc}; then
done
# join channel
- echo '/j #archlinux32' | \
+ echo '/j #archlinux32-devops' | \
sponge "${irc_dir}/in"
- while [ ! -f "${irc_dir}/#archlinux32/out" ]; do
+ while [ ! -f "${irc_dir}/#archlinux32-devops/out" ]; do
sleep 1
done
diff --git a/bin/slave-build-connect b/bin/slave-build-connect
index e40dc32..40a227c 100755
--- a/bin/slave-build-connect
+++ b/bin/slave-build-connect
@@ -5,9 +5,9 @@
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
-if [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xget-assignment' ] || \
- [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xreturn-assignment' ] || \
- [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xping-from-slave' ]; then
+if [ "${SSH_ORIGINAL_COMMAND%% *}" = 'get-assignment' ] || \
+ [ "${SSH_ORIGINAL_COMMAND%% *}" = 'return-assignment' ] || \
+ [ "${SSH_ORIGINAL_COMMAND%% *}" = 'ping-from-slave' ]; then
# small check to prevent some shell-injections
if printf '%s\n' "${SSH_ORIGINAL_COMMAND}" | \
diff --git a/conf/master.conf.example b/conf/master.conf.example
index 4ec36f8..2234dfd 100755
--- a/conf/master.conf.example
+++ b/conf/master.conf.example
@@ -29,7 +29,7 @@
#intentions_directory="${work_dir}/intentions"
# irc client configuration
-#irc_dir='/home/master/irc/irc.freenode.net'
+#irc_dir='/home/master/irc/irc.libera.chat'
#irc_password='top_secret'
# list of urls to trigger updates of the respective mirrors
diff --git a/lib/common-functions b/lib/common-functions
index 8b842ff..8c263ab 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -2,7 +2,7 @@
# contains functions used by more than one script
-# shellcheck disable=SC2039,SC2119,SC2120
+# shellcheck disable=SC2039,SC2119,SC2120,SC3043
if [ -z "${base_dir}" ]; then
# just to make shellcheck happy
@@ -778,7 +778,7 @@ extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name() {
}
# irc_say $channel [copy]
-# say content of stdin in irc channel $channel (default: #archlinux32)
+# say content of stdin in irc channel $channel (default: #archlinux32-devops)
# and print copy to stdout if 'copy' is given
# shellcheck disable=SC2120
@@ -786,7 +786,7 @@ irc_say() {
local channel
local content
if [ -z "$1" ]; then
- channel='#archlinux32'
+ channel='#archlinux32-devops'
else
channel="$1"
fi
diff --git a/lib/intentions-queue b/lib/intentions-queue
index c0d88a8..802d1ca 100755
--- a/lib/intentions-queue
+++ b/lib/intentions-queue
@@ -2,7 +2,7 @@
# contains functions related to the intentions-queue
-# shellcheck disable=SC2039
+# shellcheck disable=SC2039,SC3043
if [ -z "${base_dir}" ]; then
# just to make shellcheck happy
@@ -15,7 +15,7 @@ fi
# $package_database_lock_file externally
intent_something() {
local next_number
- if [ "x$1" = 'x-n' ]; then
+ if [ "$1" = '-n' ]; then
cat
return
fi
@@ -75,7 +75,7 @@ execute_intention() {
# with -n: return immediately
# without -n: wait until nothing more to do
intentions_left() {
- if [ ! "x$1" = 'x-n' ]; then
+ if [ ! "$1" = '-n' ]; then
while intentions_left -n; do
sleep 1
done
diff --git a/lib/load-configuration b/lib/load-configuration
index 37fd850..4c825f1 100755
--- a/lib/load-configuration
+++ b/lib/load-configuration
@@ -38,7 +38,7 @@ else
fi
# dirty hack to get this stuff debugable from a bash
-if [ "x${0##*/}" = "x-bash" ] || [ "x${0##*/}" = "xbash" ] || [ "x${0##*/}" = "xdash" ]; then
+if [ "${0##*/}" = "-bash" ] || [ "${0##*/}" = "bash" ] || [ "${0##*/}" = "dash" ]; then
set +e
if [ -z "${base_dir}" ]; then
base_dir=$(pwd)
@@ -114,7 +114,7 @@ webserver_directory='/srv/http'
build_log_directory='/srv/http/build-logs'
# irc client configuration
-irc_dir='/home/master/irc/irc.freenode.net'
+irc_dir='/home/master/irc/irc.libera.chat'
irc_password='top_secret'
# commands to run to update the package mirror used for installing archlinux32 packages,
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 6a6a1e7..af2c3ba 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -2,7 +2,7 @@
# contains functions used to access mysql db
-# shellcheck disable=SC2016,SC2039,SC2119,SC2120
+# shellcheck disable=SC2016,SC2039,SC2119,SC2120,SC3043
if [ -z "${base_dir}" ]; then
# just to make shellcheck happy
@@ -35,7 +35,7 @@ mysql_run_query() {
local number
file_name_extra=''
- if [ "x$1" = 'xunimportant' ]; then
+ if [ "$1" = 'unimportant' ]; then
shift
file_name_extra='unimportant_'
elif [ -s "${work_dir}/build-master-sanity" ]; then
@@ -47,7 +47,7 @@ mysql_run_query() {
query_stdout="${query_stdin%.stdin}.stdout"
query_stderr="${query_stdin%.stdin}.stderr"
cat > "${query_stdin}"
- for _ in {1..10}; do
+ for _ in $(seq 10); do
if [ -f "${query_stdout}" ]; then
wait_some_time 10 10
fi
@@ -221,7 +221,8 @@ mysql_generate_package_metadata() {
mod_git_revision="$4"
repository="$5"
- if [[ "${current_repository_id}" = *[!0-9]* ]]; then
+ if printf '%s\n' "${current_repository_id}" \
+ | grep -q '[^0-9]'; then
>&2 printf 'mysql_generate_package_metadata(): invalid current_repository_id="%s".\n' \
"${current_repository_id}"
exit 2
@@ -898,7 +899,7 @@ mysql_cleanup() {
local operator
if [ "$#" = '0' ]; then
operator='DELETE'
- elif [ "$#" = '1' ] && [ "x$1" = 'xdry' ]; then
+ elif [ "$#" = '1' ] && [ "$1" = 'dry' ]; then
operator='SELECT COUNT(1)'
else
>&2 echo 'Unknown parameter'
@@ -1558,7 +1559,7 @@ mysql_sort_versions() {
( # new shell is intentional
tmp_file=$(mktemp 'tmp.mysql_sort_versions.XXXXXXXXXX' --tmpdir)
trap 'rm "${tmp_file}"' EXIT
- if [ "x$1" != 'x-f' ] && \
+ if [ "$1" != '-f' ] && \
{
printf 'SELECT'
printf ' COUNT(1)'