From aaa68e49e8e5a68950a63b9aa4a8c1f6aed2e2d2 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Tue, 1 Nov 2011 15:33:08 +0100 Subject: Move common functions to a shared file * common.sh is included on build time * most functions are copied from makepkg --- archrelease.in | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'archrelease.in') diff --git a/archrelease.in b/archrelease.in index 2f7725e..6fccfc9 100644 --- a/archrelease.in +++ b/archrelease.in @@ -1,18 +1,16 @@ #!/bin/bash -abort() { - echo ${1:-'archrelease: Cancelled'} - exit 1 -} +m4_include(lib/common.sh) if [[ -z $1 ]]; then - abort 'Usage: archrelease ...' + echo 'Usage: archrelease ...' + exit 1 fi # TODO: validate repo is really repo-arch if [[ ! -f PKGBUILD ]]; then - abort 'archrelease: PKGBUILD not found' + die 'archrelease: PKGBUILD not found' fi trunk=${PWD##*/} @@ -21,24 +19,24 @@ trunk=${PWD##*/} # such as 'gnome-unstable' IFS='/' read -r -d '' -a parts <<< "$PWD" if [[ "${parts[@]:(-2):1}" == "repos" ]]; then - abort 'archrelease: Should not be in repos dir (try from trunk/)' + die 'archrelease: Should not be in repos dir (try from trunk/)' fi unset parts if [[ $(svn status -q) ]]; then - abort 'archrelease: You have not committed your changes yet!' + die 'archrelease: You have not committed your changes yet!' fi pushd .. >/dev/null IFS=$'\n' read -r -d '' -a known_files < <(svn ls -r HEAD "$trunk") for file in "${known_files[@]}"; do if [[ ${file:(-1)} = '/' ]]; then - abort "archrelease: subdirectories are not supported in package directories!" + die "archrelease: subdirectories are not supported in package directories!" fi done for tag in "$@"; do - echo -n "copying ${trunk} to ${tag}..." + stat_busy "copying ${trunk} to ${tag}" if [[ -d repos/$tag ]]; then declare -a trash @@ -55,12 +53,12 @@ for tag in "$@"; do # copy all files at once from trunk to the subdirectory in repos/ svn copy -q -r HEAD ${known_files[@]/#/$trunk/} "repos/$tag/" - echo 'done' + stat_done done -echo -n "releasing package..." +stat_busy "releasing package" printf -v tag_list ", %s" "$@"; tag_list="${tag_list#, }" svn commit -q -m "archrelease: copy ${trunk} to $tag_list" || abort -echo 'done' +stat_done popd >/dev/null -- cgit v1.2.3-70-g09d2