summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/abslibre-tools/librestage45
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