Skip to content
Snippets Groups Projects
Verified Commit 725e7846 authored by Levente Polyak's avatar Levente Polyak :rocket:
Browse files

fix(repo_lock): remove superfluous exit pipe from repo_lock

Also add explicit logging in case flock fails
parent 0fb5bcec
No related branches found
No related tags found
No related merge requests found
Pipeline #86886 passed
......@@ -28,7 +28,7 @@ script_lock
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${arch}" || exit 1
repo_lock "${repo}" "${arch}"
done
done
......
#!/bin/bash
set -eo pipefail
shopt -s nullglob
dirname="$(dirname "$(readlink -e "$0")")"
. "${dirname}/../config"
. "${dirname}/../db-functions"
......@@ -9,7 +12,7 @@ script_lock
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${arch}" || exit 1
repo_lock "${repo}" "${arch}"
done
done
......
......@@ -117,6 +117,7 @@ acquire_lock() {
local lock_mode=$1
local handle=$2
local fd
local ret
# acquire fd from handle
fd=$(acquire_fd "${handle}")
......@@ -129,7 +130,11 @@ acquire_lock() {
if ! flock "${lock_mode}" --nonblock "${fd}"; then
stat_busy "${@:3}"
flock "${lock_mode}" "${fd}"
if ! flock "${lock_mode}" "${fd}"; then
ret=$?
error "failed to lock %s: %s" "${handle}" "${ret}"
return ${ret}
fi
stat_done
fi
}
......
......@@ -47,8 +47,8 @@ fi
# TODO: this might lock too much (architectures)
for pkgarch in "${ARCHES[@]}"; do
repo_lock "${repo_to}" "${pkgarch}" || exit 1
repo_lock "${repo_from}" "${pkgarch}" || exit 1
repo_lock "${repo_to}" "${pkgarch}"
repo_lock "${repo_from}" "${pkgarch}"
done
# check if packages to be moved exist in version control and ftp dir
......
......@@ -98,7 +98,7 @@ fi
# lock repos
for tarch in "${tarches[@]}"; do
repo_lock "$repo" "$tarch" || exit 1
repo_lock "$repo" "$tarch"
done
declare -A remove_pkgbases
......
......@@ -3,6 +3,11 @@
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
set -eo pipefail
shopt -s nullglob
colorize
if (( $# < 3 )); then
msg "usage: %s <repo> <arch> <pkgfile> ..." "${0##*/}"
exit 1
......@@ -25,7 +30,7 @@ else
fi
for tarch in "${tarches[@]}"; do
repo_lock "$repo" "$tarch" || exit 1
repo_lock "$repo" "$tarch"
done
for tarch in "${tarches[@]}"; do
......
......@@ -3,6 +3,11 @@
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
set -eo pipefail
shopt -s nullglob
colorize
if (( $# < 3 )); then
msg "usage: %s <repo> <arch> <pkgname> ..." "${0##*/}"
exit 1
......@@ -25,7 +30,7 @@ else
fi
for tarch in "${tarches[@]}"; do
repo_lock "$repo" "$tarch" || exit 1
repo_lock "$repo" "$tarch"
done
for tarch in "${tarches[@]}"; do
......
......@@ -107,7 +107,7 @@ done
# TODO: this might lock too much (architectures)
for repo in "${!staging[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${pkgarch}" || exit 1
repo_lock "${repo}" "${pkgarch}"
done
done
......
......@@ -3,6 +3,11 @@
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
set -eo pipefail
shopt -s nullglob
colorize
if (( $# < 1 )); then
msg "usage: %s <pkgname|pkgbase> ..." "${0##*/}"
exit 1
......@@ -12,7 +17,7 @@ fi
script_lock
for repo in "${TESTING_REPOS[@]}" "${STABLE_REPOS[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${pkgarch}" || exit 1
repo_lock "${repo}" "${pkgarch}"
done
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment