summaryrefslogtreecommitdiff
path: root/commitpkg
diff options
context:
space:
mode:
authorEvangelos Foutras <foutrelis@gmail.com>2009-09-23 12:06:25 -0700
committerAaron Griffin <aaronmgriffin@gmail.com>2009-09-23 12:06:25 -0700
commit381f91c33602e624bc6ac5ce7e7b65eecaf6088f (patch)
treed02425c5aab58286883ec2c9718aa3ca70281f0a /commitpkg
parentfa47bd1a171251f282a03ae7e7626a170a0723df (diff)
downloaddevtools-381f91c33602e624bc6ac5ce7e7b65eecaf6088f.tar.xz
commitpkg: introduce abort function for errors
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'commitpkg')
-rwxr-xr-xcommitpkg42
1 files changed, 13 insertions, 29 deletions
diff --git a/commitpkg b/commitpkg
index 5a37ae3..ba98490 100755
--- a/commitpkg
+++ b/commitpkg
@@ -1,11 +1,15 @@
#!/bin/bash
+abort() {
+ echo ${1:-"Cancelled"}
+ exit 1
+}
+
# Source makepkg.conf; fail if it is not found
if [ -r "/etc/makepkg.conf" ]; then
source "/etc/makepkg.conf"
else
- echo "/etc/makepkg.conf not found!"
- exit 1
+ abort "/etc/makepkg.conf not found!"
fi
# Source user-specific makepkg.conf overrides
@@ -16,8 +20,7 @@ fi
cmd=$(basename $0)
if [ ! -f PKGBUILD ]; then
- echo "No PKGBUILD file"
- exit 1
+ abort "No PKGBUILD file"
fi
source PKGBUILD
@@ -39,8 +42,7 @@ elif [ "$cmd" == "community-testingpkg" ]; then
server="aur.archlinux.org"
else
if [ $# -eq 0 ]; then
- echo "usage: commitpkg <reponame> [-l limit] [commit message]"
- exit 1
+ abort "usage: commitpkg <reponame> [-l limit] [commit message]"
fi
repo="$1"
shift
@@ -70,46 +72,28 @@ for CARCH in ${arch[@]}; do
uploadto="staging/${repo}/$(basename ${pkgfile})"
# don't re-upload the same package (useful for -any sub packages)
if [ "$(md5sum "${pkgfile}" | cut -d' ' -f1)" != "$(ssh ${server} md5sum "${uploadto}" | cut -d' ' -f1)" ]; then
- scp ${scpopts} "${pkgfile}" "${server}:${uploadto}"
+ scp ${scpopts} "${pkgfile}" "${server}:${uploadto}" || abort
fi
if [ "$(md5sum "${pkgfile}" | cut -d' ' -f1)" != "$(ssh ${server} md5sum "${uploadto}" | cut -d' ' -f1)" ]; then
- echo "File got corrupted during upload, cancelled."
- exit 1
+ abort "File got corrupted during upload, cancelled."
else
echo "File integrity okay."
fi
-
- if [ $? -ne 0 ]; then
- echo "Cancelled"
- exit 1
- fi
echo "===> Uploaded $pkgfile"
done
if [ "$1" != "" ]; then
svn commit -m "upgpkg: $pkgbase $pkgver-$pkgrel
- $1" > /dev/null
- if [ $? -ne 0 ]; then
- echo "Cancelled"
- exit 1
- fi
+ $1" > /dev/null || abort
echo "===> Commited with message:
upgpkg: $pkgbase $pkgver-$pkgrel
$1"
else
- svn commit
- if [ $? -ne 0 ]; then
- echo "Cancelled"
- exit 1
- fi
+ svn commit || abort
echo "===> Commited"
fi
- archrelease $repo-$CARCH
- if [ $? -ne 0 ]; then
- echo "Cancelled"
- exit 1
- fi
+ archrelease $repo-$CARCH || abort
echo "===> Tagged for $repo-$CARCH"
done