summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common-functions13
-rwxr-xr-xlib/intentions-queue6
-rwxr-xr-xlib/load-configuration4
-rwxr-xr-xlib/mysql-functions13
4 files changed, 19 insertions, 17 deletions
diff --git a/lib/common-functions b/lib/common-functions
index 8b842ff..eb61e9e 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
@@ -277,8 +277,8 @@ remove_old_package_versions() {
# wait between minimum and minimum+diff seconds (diff defaults to 30)
wait_some_time() {
- local minimum=$1
- local diff=$2
+ local minimum="$1"
+ local diff="$2"
local random
if [ -z "${diff}" ]; then
@@ -358,6 +358,7 @@ make_source_info() {
p
' "${tmp_dir}/SRCINFO"
)"
+ # shellcheck disable=SC2031
sed -i '
/^pkgname = /! b
/= gtk-doc$/ b
@@ -447,7 +448,7 @@ mangle_pkgbuild() {
/^arch=[^#]*any/!{
/^arch=(/s/(/(i486 i686 pentium4 /
}
- s/^\(\s*pkgrel=\)['"'"'"]\?\([0-9.]\+\)['"'"'"]\?\s*\(#.*\)\?$/\1"\2'"${sub_pkgrel}"'"/
+ s/^\(\s*pkgrel=\)['"'"'"]\?\([0-9]\+\)\(\.[0-9.]*\)\?['"'"'"]\?\s*\(#.*\)\?$/\1"\2'"${sub_pkgrel:-\\3}"'"/
' "${PKGBUILD}"
# shellcheck disable=SC2016
@@ -778,7 +779,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 +787,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)'