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-03-21 10:18:14 +0100
committerErich Eckner <git@eckner.net>2018-03-21 10:18:14 +0100
commitbb66461d2a5a6639fa907c93a14a81f3837c3c89 (patch)
tree1e1e4d22a9d0e02b9ba19065501d3e533c7fa9d0
parentec84ed09ff3683eb002765f06d585fb08d9a4671 (diff)
bin/seed-build-list: --wait new - waiting for lock now optional
-rwxr-xr-xbin/seed-build-list25
1 files changed, 17 insertions, 8 deletions
diff --git a/bin/seed-build-list b/bin/seed-build-list
index 341ccc6..ef1ab62 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -27,6 +27,8 @@ usage() {
>&2 echo ' Do not actually update build-list, just print it.'
>&2 echo ' -p|--package $pkg_regex:'
>&2 echo ' Update packages matching $pkg_regex.'
+ >&2 echo ' -w|--wait:'
+ >&2 echo ' Wait for lock if necessary.'
[ -z "$1" ] && exit 1 || exit "$1"
}
@@ -35,13 +37,14 @@ tmp_dir=$(mktemp -d 'tmp.seed-build-list.XXXXXXXXXX' --tmpdir)
trap "rm -rf --one-file-system '${tmp_dir:?}'" EXIT
eval set -- "$(
- getopt -o ahi:m:np: \
+ getopt -o ahi:m:np:w \
--long auto \
--long help \
--long ignore: \
--long mirror: \
--long no-action \
--long package: \
+ --long wait \
-n "$(basename "$0")" -- "$@" || \
echo usage
)"
@@ -52,6 +55,7 @@ touch "${tmp_dir}/ignore-packages"
auto=false
update=true
+wait_for_lock='-n'
while true
do
@@ -80,6 +84,9 @@ do
echo "$1" >> \
"${tmp_dir}/package-regexes"
;;
+ -w|--wait)
+ wait_for_lock=''
+ ;;
--)
shift
break
@@ -103,6 +110,15 @@ if [ ! -s "${tmp_dir}/mirrors" ] && \
exit 0
fi
+# get locks
+if ${update}; then
+ exec 9> "${sanity_check_lock_file}"
+ flock -s ${wait_for_lock} 9
+
+ exec 8> "${build_list_lock_file}"
+ flock ${wait_for_lock} 8
+fi
+
repos="${stable_package_repositories}"
# genereate must-haves query from mirror delta
@@ -347,13 +363,6 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V
sort -u | \
tr '\t' ' ' | \
if ${update}; then
- # always block if locked
- exec 9> "${build_list_lock_file}"
- flock 9
-
- exec 8> "${sanity_check_lock_file}"
- flock -s 8
-
while read -r pkgbase git_rev mod_git_rev repo; do
printf '%s ' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}" >&2
generate_package_metadata "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}"