index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-03-21 10:18:14 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-03-21 10:18:14 +0100 |
commit | bb66461d2a5a6639fa907c93a14a81f3837c3c89 (patch) | |
tree | 1e1e4d22a9d0e02b9ba19065501d3e533c7fa9d0 | |
parent | ec84ed09ff3683eb002765f06d585fb08d9a4671 (diff) |
-rwxr-xr-x | bin/seed-build-list | 25 |
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}" |