diff options
Diffstat (limited to 'src/xbs-abslibre')
-rwxr-xr-x | src/xbs-abslibre/helper-abslibre | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/src/xbs-abslibre/helper-abslibre b/src/xbs-abslibre/helper-abslibre index 76e9cfa..66c6846 100755 --- a/src/xbs-abslibre/helper-abslibre +++ b/src/xbs-abslibre/helper-abslibre @@ -17,14 +17,31 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +lockarch() { + local arch=$1 + lock 9 "${ABSLIBREDEST}/${arch}.lock" \ + "Waiting for a lock on the ABSLibre release directory for %s" "${arch}" +} + +unlockarch() { + lock_close 9 +} + +conf() { + . libremessages + . "$(librelib conf)" + load_files libretools + check_vars libretools "$@" || exit 1 +} + +################################################################################ + status() { [[ -z $(git status -s .) ]] } download() { - . $(librelib conf) - load_files libretools - check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND || return 1 + conf WORKDIR ABSLIBRERECV ABSLIBRESEND gitget -f -p "$ABSLIBRESEND" checkout "$ABSLIBRERECV" "$WORKDIR/abslibre" || return 1 } @@ -33,14 +50,10 @@ release-client() { local repo=$1 local arch=$2 - . libremessages - . $(librelib conf) - load_files libretools - check_vars libretools WORKDIR ABSLIBREDEST || return 1 + conf ABSLIBREDEST local pkgbase="$(load_PKGBUILD >/dev/null; printf '%s\n' "${pkgbase:-${pkgname}}")" local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" - - lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + lockarch "$arch" if [[ -e $pkgdir ]]; then rm -rf -- "$pkgdir" @@ -54,14 +67,10 @@ release-server() { local repo=$1 local repo=$2 - . libremessages - . $(librelib conf) - load_files libretools - check_vars libretools WORKDIR ABSLIBREDEST || return 1 + conf ABSLIBREDEST local pkgbase="$(load_PKGBUILD >/dev/null; printf '%s\n' "${pkgbase:-${pkgname}}")" local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" - - lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + lockarch "$arch" if [[ -e $pkgdir ]]; then rm -rf -- "$pkgdir" @@ -88,15 +97,10 @@ unrelease() { local repo=$2 local arch=$3 - . libremessages - . $(librelib conf) - load_files libretools - check_vars libretools ABSLIBREDEST || return 1 - + conf ABSLIBREDEST local pkgbase="$(load_PKGBUILD >/dev/null; printf '%s\n' "${pkgbase:-${pkgname}}")" local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" - - lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + lockarch "$arch" if [[ -f "${pkgdir}/PKGBUILD" ]]; then if [[ -e "${ABSLIBREDEST}/${arch}/.git" ]]; then @@ -113,15 +117,12 @@ move() { local repo_to=$2 local pkgbase=$3 - . libremessages - . $(librelib conf) - load_files libretools - check_vars libretools ABSLIBREDEST ARCHES || return 1 + conf ABSLIBREDEST ARCHES local mv local arch for arch in "${ARCHES[@]}" any; do - lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + lockarch "$arch" local dir_from="${ABSLIBREDEST}/${arch}/${repo_from}/${pkgbase}" local dir_to="${ABSLIBREDEST}/${arch}/${repo_to}/${pkgbase}" @@ -140,7 +141,7 @@ move() { mv "$dir_from" "$dir_to" fi fi - lock_close 9 + unlock arch done } @@ -149,13 +150,10 @@ releasepath() { local repo=$2 local arch=$3 - . libremessages - . $(librelib conf) - load_files libretools - check_vars libretools ABSLIBREDEST || return 1 + conf ABSLIBREDEST local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" - lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + lockarch "$arch" if [[ -f "${pkgdir}/PKGBUILD" ]]; then printf '%s\n' "$pkgdir" |