2004-07-19 07:16:56 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2009-09-23 21:06:25 +02:00
|
|
|
abort() {
|
|
|
|
echo ${1:-"Cancelled"}
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2009-09-25 10:02:32 +02:00
|
|
|
# Verify that a remote file exists and is identical to a local one
|
|
|
|
# Usage: package_verify <local path> <remote host> <remote path>
|
|
|
|
package_verify() {
|
|
|
|
local remote_checksum=$(ssh $2 openssl sha1 "'$3'" 2>/dev/null |
|
|
|
|
grep -o '[0-9a-f]\{40\}$')
|
|
|
|
local local_checksum=$(openssl sha1 "$1" | grep -o '[0-9a-f]\{40\}$')
|
|
|
|
if [ -n "$remote_checksum" -a "$remote_checksum" == "$local_checksum" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-13 20:53:29 +01:00
|
|
|
# Source makepkg.conf; fail if it is not found
|
|
|
|
if [ -r "/etc/makepkg.conf" ]; then
|
2009-09-23 18:17:47 +02:00
|
|
|
source "/etc/makepkg.conf"
|
2008-01-13 20:53:29 +01:00
|
|
|
else
|
2009-09-23 21:06:25 +02:00
|
|
|
abort "/etc/makepkg.conf not found!"
|
2008-01-13 20:53:29 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Source user-specific makepkg.conf overrides
|
|
|
|
if [ -r ~/.makepkg.conf ]; then
|
2009-09-23 18:17:47 +02:00
|
|
|
source ~/.makepkg.conf
|
2008-01-13 20:53:29 +01:00
|
|
|
fi
|
2004-07-19 07:16:56 +02:00
|
|
|
|
2009-09-25 10:02:33 +02:00
|
|
|
cmd=$(basename "$0")
|
2004-07-19 07:16:56 +02:00
|
|
|
|
2004-09-28 20:57:58 +02:00
|
|
|
if [ ! -f PKGBUILD ]; then
|
2009-09-23 21:06:25 +02:00
|
|
|
abort "No PKGBUILD file"
|
2004-07-19 07:16:56 +02:00
|
|
|
fi
|
|
|
|
|
2004-09-28 20:57:58 +02:00
|
|
|
source PKGBUILD
|
2009-09-25 10:02:33 +02:00
|
|
|
pkgbase=${pkgbase:-$pkgname}
|
2004-09-28 20:57:58 +02:00
|
|
|
|
2009-09-23 18:17:48 +02:00
|
|
|
# set up repo-specific opts depending on how we were called
|
|
|
|
server="gerolde.archlinux.org"
|
|
|
|
if [ "$cmd" == "extrapkg" ]; then
|
|
|
|
repo="extra"
|
|
|
|
elif [ "$cmd" == "corepkg" ]; then
|
|
|
|
repo="core"
|
|
|
|
elif [ "$cmd" == "testingpkg" ]; then
|
|
|
|
repo="testing"
|
|
|
|
elif [ "$cmd" == "communitypkg" ]; then
|
|
|
|
repo="community"
|
|
|
|
server="aur.archlinux.org"
|
|
|
|
elif [ "$cmd" == "community-testingpkg" ]; then
|
|
|
|
repo="community-testing"
|
|
|
|
server="aur.archlinux.org"
|
|
|
|
else
|
|
|
|
if [ $# -eq 0 ]; then
|
2009-09-23 21:06:25 +02:00
|
|
|
abort "usage: commitpkg <reponame> [-l limit] [commit message]"
|
2009-09-23 18:17:48 +02:00
|
|
|
fi
|
|
|
|
repo="$1"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
# see if any limit options were passed, we'll send them to SCP
|
|
|
|
unset scpopts
|
|
|
|
if [ "$1" = "-l" ]; then
|
2009-09-25 10:02:33 +02:00
|
|
|
scpopts="-l $2"
|
2009-09-23 18:17:48 +02:00
|
|
|
shift 2
|
|
|
|
fi
|
|
|
|
|
2009-10-21 10:20:31 +02:00
|
|
|
for _arch in ${arch[@]}; do
|
|
|
|
echo "===> Uploading to staging/$repo for arch=${_arch}"
|
2009-09-23 18:17:49 +02:00
|
|
|
for _pkgname in ${pkgname[@]}; do
|
2009-10-21 10:20:31 +02:00
|
|
|
pkgfile=$_pkgname-$pkgver-$pkgrel-${_arch}$PKGEXT
|
2009-09-02 04:35:25 +02:00
|
|
|
|
2009-09-25 10:02:33 +02:00
|
|
|
if [ ! -f $pkgfile -a -f "$PKGDEST/$pkgfile" ]; then
|
|
|
|
pkgfile="$PKGDEST/$pkgfile"
|
2009-09-23 18:17:49 +02:00
|
|
|
elif [ ! -f $pkgfile ]; then
|
2009-09-02 04:35:25 +02:00
|
|
|
echo "File $pkgfile doesn't exist"
|
2009-09-23 18:17:49 +02:00
|
|
|
# skip to next architecture
|
|
|
|
continue 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
# combine what we know into a variable
|
2009-09-25 10:02:33 +02:00
|
|
|
uploadto=staging/$repo/$(basename "$pkgfile")
|
2009-09-23 18:17:49 +02:00
|
|
|
# don't re-upload the same package (useful for -any sub packages)
|
2009-09-25 10:02:33 +02:00
|
|
|
if ! package_verify "$pkgfile" $server "$uploadto"; then
|
|
|
|
scp $scpopts "$pkgfile" $server:"$uploadto" || abort
|
2009-09-23 18:17:49 +02:00
|
|
|
fi
|
2009-09-25 10:02:33 +02:00
|
|
|
if ! package_verify "$pkgfile" $server "$uploadto"; then
|
2009-09-23 21:06:25 +02:00
|
|
|
abort "File got corrupted during upload, cancelled."
|
2009-09-23 18:17:49 +02:00
|
|
|
else
|
|
|
|
echo "File integrity okay."
|
2009-09-19 14:33:13 +02:00
|
|
|
fi
|
2009-09-23 18:17:49 +02:00
|
|
|
echo "===> Uploaded $pkgfile"
|
|
|
|
done
|
|
|
|
|
2009-09-25 10:02:33 +02:00
|
|
|
if [ -n "$1" ]; then
|
2009-09-23 18:17:49 +02:00
|
|
|
svn commit -m "upgpkg: $pkgbase $pkgver-$pkgrel
|
2009-09-25 10:02:33 +02:00
|
|
|
$1" >/dev/null || abort
|
2009-09-23 18:17:49 +02:00
|
|
|
echo "===> Commited with message:
|
|
|
|
upgpkg: $pkgbase $pkgver-$pkgrel
|
2009-09-23 20:04:37 +02:00
|
|
|
$1"
|
2009-09-02 04:35:25 +02:00
|
|
|
else
|
2009-09-23 21:06:25 +02:00
|
|
|
svn commit || abort
|
2009-09-23 18:17:49 +02:00
|
|
|
echo "===> Commited"
|
2009-09-02 04:35:25 +02:00
|
|
|
fi
|
2009-04-04 07:00:36 +02:00
|
|
|
|
2009-10-21 10:20:31 +02:00
|
|
|
archrelease $repo-${_arch} || abort
|
2009-09-02 04:35:25 +02:00
|
|
|
done
|
2004-08-22 22:24:02 +02:00
|
|
|
|
2009-09-23 18:17:49 +02:00
|
|
|
if [ "${arch[*]}" == "any" ]; then
|
2009-09-25 10:02:33 +02:00
|
|
|
if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then
|
2009-09-23 21:31:19 +02:00
|
|
|
pushd ../repos/
|
2009-09-18 21:39:37 +02:00
|
|
|
svn rm $repo-i686
|
|
|
|
svn rm $repo-x86_64
|
|
|
|
svn commit -m "removed $repo-i686 and $repo-x86_64 for $pkgname"
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2007-11-29 04:20:24 +01:00
|
|
|
# vim:ft=sh:ts=4:sw=4:et:
|