diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-07-05 02:10:21 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-07-05 18:08:41 -0400 |
commit | ac6c975cde77b1fa8f3a8df2f9c966b3dc5fc90c (patch) | |
tree | 56f8a52bd5ac62f2240c46305f8baa425db30073 /src | |
parent | 8435815a7690830dece329ac9a71b1da04f4ba38 (diff) |
xbs: create separate release-client and release-server sub-commands
Diffstat (limited to 'src')
-rwxr-xr-x | src/abslibre-tools/librestage | 2 | ||||
-rw-r--r-- | src/xbs-abs/.gitignore | 1 | ||||
-rw-r--r-- | src/xbs-abs/Makefile | 21 | ||||
-rwxr-xr-x | src/xbs-abs/helper-abs | 15 | ||||
-rwxr-xr-x | src/xbs-abslibre/helper-abslibre | 34 | ||||
-rwxr-xr-x | src/xbs/xbs | 30 |
6 files changed, 79 insertions, 24 deletions
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index c12688b..039d9f7 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -93,7 +93,7 @@ main() { die "PACKAGER wes not set when building package" fi - xbs release "$repo" "$CARCH" + xbs release-client "$repo" "$CARCH" mkdir -p "${WORKDIR}/staging/${repo}" if cp "$pkgfile" "${WORKDIR}/staging/${repo}/${pkgfile##*/}"; then msg2 "%s staged on [%s]" "$_pkgname" "$repo" diff --git a/src/xbs-abs/.gitignore b/src/xbs-abs/.gitignore index 8421720..d472431 100644 --- a/src/xbs-abs/.gitignore +++ b/src/xbs-abs/.gitignore @@ -1,2 +1,3 @@ +commitpkg* archrelease* !*.patch diff --git a/src/xbs-abs/Makefile b/src/xbs-abs/Makefile index cac9aea..8688ed7 100644 --- a/src/xbs-abs/Makefile +++ b/src/xbs-abs/Makefile @@ -1,10 +1,23 @@ pkgconfdir = $(sysconfdir)/xbs pkglibexecdir = $(libexecdir)/xbs libexecs = helper-abs -no-progs = $(libexecs) archrelease -copy_files = archrelease.in -install_files = $(DESTDIR)$(pkglibexecdir)/helper-abs.d/archrelease + +_helpers = archrelease commitpkg +no-progs = $(libexecs) $(_helpers) +copy_files = $(addsuffix .in,$(_helpers)) +install_files = $(addprefix $(DESTDIR)$(pkglibexecdir)/helper-abs.d/,$(_helpers)) +pots = $(_helpers) + include ../../common.mk -$(DESTDIR)$(pkglibexecdir)/helper-abs.d/archrelease: archrelease +commitpkg: commitpkg.in + { \ + echo '#!/usr/bin/env bash'; \ + echo '. "$$(librelib common)"'; \ + echo '. ./PKGBUILD'; \ + echo 'repo=$$1; arch=$$2;'; \ + sed -n "/== 'any'/,\$$p" $<; \ + } > $@ + +$(DESTDIR)$(pkglibexecdir)/helper-abs.d/%: % install -Dm755 '$<' '$@' diff --git a/src/xbs-abs/helper-abs b/src/xbs-abs/helper-abs index 88f572a..6c57803 100755 --- a/src/xbs-abs/helper-abs +++ b/src/xbs-abs/helper-abs @@ -93,13 +93,13 @@ download() { done } -release() { +release-client() { local repo=$1 local arch=$2 + # Hack to use arch_svn as 'svn' in external scripts local tmpdir="$(mktemp -dt "xbs-abs-release.XXXXXXXXXX")" trap "$(printf 'rm -rf -- %q' "$tmpdir")" EXIT - printf '%s\n' \ '#!/bin/bash' \ "$(declare -p SVNUSER 2>/dev/null)" \ @@ -107,8 +107,15 @@ release() { 'arch_svn "$@"' \ > "$tmpdir/svn" chmod 755 "$tmpdir/svn" + export PATH="$tmpdir:$PATH" + + "${0}.d/archrelease" -f "${repo}-${arch}" + "${0}.d/commitpkg" "${repo}" "${arch}" +} - PATH="$tmpdir:$PATH" "${0}.d/archrelease" -f "${repo}-${arch}" +release-server() { + # Do nothing + : } unrelease() { @@ -185,6 +192,6 @@ releasepath() { } case "$1" in - status|download|release|unrelease|move|releasepath) "$@";; + status|download|release-client|release-server|unrelease|move|releasepath) "$@";; *) exit 127;; esac diff --git a/src/xbs-abslibre/helper-abslibre b/src/xbs-abslibre/helper-abslibre index 2e5ed27..76e9cfa 100755 --- a/src/xbs-abslibre/helper-abslibre +++ b/src/xbs-abslibre/helper-abslibre @@ -29,7 +29,7 @@ download() { gitget -f -p "$ABSLIBRESEND" checkout "$ABSLIBRERECV" "$WORKDIR/abslibre" || return 1 } -release() { +release-client() { local repo=$1 local arch=$2 @@ -45,14 +45,42 @@ release() { if [[ -e $pkgdir ]]; then rm -rf -- "$pkgdir" fi + + mkdir -p -- "$pkgdir" + git ls-files -z | xargs -0 -I{} cp -- {} "$pkgdir" +} + +release-server() { + local repo=$1 + local repo=$2 + + . libremessages + . $(librelib conf) + load_files libretools + check_vars libretools WORKDIR ABSLIBREDEST || return 1 + 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}" + + if [[ -e $pkgdir ]]; then + rm -rf -- "$pkgdir" + fi + mkdir -p -- "$pkgdir" - git ls-files -z | xargs -0 -I{} cp {} "$pkgdir" + cp -- * "$pkgdir" if [[ -e "${ABSLIBREDEST}/${arch}/.git" ]]; then cd "$pkgdir" git add . git commit -q -m "xbs-abslibre: Release ${repo}/${pkgbase} for ${arch} (by $(id -un))" fi + + local olddir + for olddir in "${ABSLIBREDEST}"/*/"${repo}/${pkgbase}/PKGBUILD"; do + local oldarch=${olddir#"${ABSLIBREDEST}"}; oldarch="${oldarch%%/*}" + unrelease "$pkgbase" "$repo" "$oldarch" + done } unrelease() { @@ -138,6 +166,6 @@ releasepath() { } case "$1" in - status|download|release|unrelease|move|releasepath) "$@";; + status|download|release-client|release-server|unrelease|move|releasepath) "$@";; *) exit 127;; esac diff --git a/src/xbs/xbs b/src/xbs/xbs index ea762fb..a81d37c 100755 --- a/src/xbs/xbs +++ b/src/xbs/xbs @@ -54,8 +54,10 @@ usage() { 'Are there uncommited changes in `.`?' flag 'download' \ 'Download or update the tree' - flag "release $(_ 'REPO ARCH')" \ - 'Release `.`' + flag "release-client $(_ 'REPO ARCH')" \ + 'Release `.` (for developer boxes)' + flag "release-server $(_ 'REPO ARCH')" \ + 'Release `.` (for server boxes)' flag "unrelease $(_ 'PKGBASE REPO ARCH')" \ 'Unrelease a pkgbase' flag "move $(_ 'FROMREPO TOREPO PKGBASE')" \ @@ -77,16 +79,20 @@ download() { "$HELPER" download "$@" } -release() { - if [[ ! -f PKGBUILD ]]; then - error 'PKGBUILD not found' - exit 1 - fi +release-client() { if ! status; then error 'You have not committed your changes yet!' exit 1 fi - "$HELPER" release "$@" + "$HELPER" release-client "$@" +} + +release-server() { + if [[ ! -f PKGBUILD ]]; then + error 'PKGBUILD not found' + exit 1 + fi + "$HELPER" release-server "$@" } unrelease() { @@ -142,15 +148,15 @@ main() { case "$cmd" in status|download) [[ $# -eq 0 ]] || errusage 'bad number of argments' - $cmd "$@" + "$cmd" "$@" ;; - release) + release-client|release-server) [[ $# -eq 2 ]] || errusage 'bad number of argments' - $cmd "$@" + "$cmd" "$@" ;; move|unrelease|releasepath) [[ $# -eq 3 ]] || errusage 'bad number of argments' - $cmd "$@" + "$cmd" "$@" ;; *) errusage 'unknown command: %s' "$cmd";; esac |