diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-07-05 00:12:42 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-07-05 00:12:42 -0400 |
commit | 9030f048138895e95e9f93d297859de600846a81 (patch) | |
tree | e2c64c9f9f89393da5f753bc0b2fcf3f9c84d02f /src/abslibre-tools | |
parent | 17a2fc79ecedabaa68658f5a3e346570f705c98e (diff) |
librestage: Drop support for multiple repos, add support for guessing repos
Diffstat (limited to 'src/abslibre-tools')
-rwxr-xr-x | src/abslibre-tools/librestage | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index 908aed5..02bc0d0 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -27,12 +27,11 @@ . $(librelib conf.sh) usage() { - print "Usage: %s REPO [REPO2 REPO3...]" "${0##*/}" + print "Usage: %s [REPO]" "${0##*/}" print "Stages the package(s) build by ./PKGBUILD for upload." echo - prose "The package(s) are staged for the named repositories. - It is in general a bad idea to stage a package on multiple - repositories, but it supported by this tool." + prose "The package(s) are staged for the named repository, or the name + of the parent directory if a repository is not named." } main() { @@ -48,11 +47,12 @@ main() { *) usage >&2; return 1;; esac done - repos=("$@") - if [[ ${#repos[@]} -eq 0 ]]; then - usage >&2 - return 1 - fi + local repo= + case $# in + 0) repo="$(basename "$(dirname "$PWD")")";; + 1) repo=$1;; + *) usage >&2; return 1;; + esac if ! [[ -e ./PKGBUILD ]]; then error "PKGBUILD not found" @@ -85,24 +85,15 @@ main() { msg 'Found package: %s' "${pkgfile##*/}" - canonical="" # is empty for the first iteration, set after that - for repo in "${repos[@]}"; do - xbs release "$repo" "$CARCH" - mkdir -p "${WORKDIR}/staging/${repo}" - if [[ -z $canonical ]]; then - canonical="${WORKDIR}/staging/${repo}/${pkgfile##*/}" - cmd=(cp "$pkgfile" "$canonical") - else - cmd=(ln "$canonical" "${WORKDIR}/staging/${repo}/${pkgfile##*/}") - fi - if "${cmd[@]}"; then - msg2 "%s staged on [%s]" "$_pkgname" "$repo" - staged=true - else - error "Can't put %s on [%s]" "$_pkgname" "$repo" - return 1 - fi - done + xbs release "$repo" "$CARCH" + mkdir -p "${WORKDIR}/staging/${repo}" + if cp "$pkgfile" "${WORKDIR}/staging/${repo}/${pkgfile##*/}"; then + msg2 "%s staged on [%s]" "$_pkgname" "$repo" + staged=true + else + error "Can't put %s on [%s]" "$_pkgname" "$repo" + return 1 + fi done done |