2004-07-19 07:16:56 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-11-01 15:33:08 +01:00
|
|
|
m4_include(lib/common.sh)
|
2009-09-23 21:06:25 +02:00
|
|
|
|
2010-03-03 21:41:53 +01:00
|
|
|
getpkgfile() {
|
|
|
|
if [[ ${#} -ne 1 ]]; then
|
2011-11-02 01:38:42 +01:00
|
|
|
die 'No canonical package found!'
|
2011-12-02 08:33:33 +01:00
|
|
|
elif [[ ! -f $1 ]]; then
|
2011-11-02 01:38:42 +01:00
|
|
|
die "Package ${1} not found!"
|
2010-03-03 21:41:53 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ${1}
|
|
|
|
}
|
2009-09-25 10:02:32 +02:00
|
|
|
|
2008-01-13 20:53:29 +01:00
|
|
|
# Source makepkg.conf; fail if it is not found
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
2010-02-13 19:47:16 +01:00
|
|
|
source '/etc/makepkg.conf'
|
2008-01-13 20:53:29 +01:00
|
|
|
else
|
2011-11-01 15:33:08 +01:00
|
|
|
die '/etc/makepkg.conf not found!'
|
2008-01-13 20:53:29 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Source user-specific makepkg.conf overrides
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -r ~/.makepkg.conf ]]; then
|
2010-02-13 19:47:16 +01:00
|
|
|
. ~/.makepkg.conf
|
2008-01-13 20:53:29 +01:00
|
|
|
fi
|
2004-07-19 07:16:56 +02:00
|
|
|
|
2011-08-28 18:36:54 +02:00
|
|
|
cmd=${0##*/}
|
2004-07-19 07:16:56 +02:00
|
|
|
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ ! -f PKGBUILD ]]; then
|
2011-11-01 15:33:08 +01:00
|
|
|
die 'No PKGBUILD file'
|
2004-07-19 07:16:56 +02:00
|
|
|
fi
|
|
|
|
|
2010-02-13 19:47:16 +01:00
|
|
|
. PKGBUILD
|
2009-09-25 10:02:33 +02:00
|
|
|
pkgbase=${pkgbase:-$pkgname}
|
2004-09-28 20:57:58 +02:00
|
|
|
|
2011-04-01 23:35:31 +02:00
|
|
|
case "$cmd" in
|
|
|
|
commitpkg)
|
2011-12-02 08:33:33 +01:00
|
|
|
if (( $# == 0 )); then
|
2011-11-01 15:33:08 +01:00
|
|
|
die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]'
|
2011-04-01 23:35:31 +02:00
|
|
|
fi
|
|
|
|
repo="$1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*pkg)
|
|
|
|
repo="${cmd%pkg}"
|
|
|
|
;;
|
|
|
|
*)
|
2011-11-01 15:33:08 +01:00
|
|
|
die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]'
|
2011-04-01 23:35:31 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$repo" in
|
2011-12-04 17:48:46 +01:00
|
|
|
core|extra|testing|staging|kde-unstable|gnome-unstable)
|
2011-04-01 23:35:31 +02:00
|
|
|
server='gerolde.archlinux.org' ;;
|
|
|
|
community*|multilib*)
|
|
|
|
server='aur.archlinux.org' ;;
|
|
|
|
*)
|
|
|
|
server='gerolde.archlinux.org'
|
2011-11-01 15:33:08 +01:00
|
|
|
msg "Non-standard repository $repo in use, defaulting to server $server" ;;
|
2011-04-01 23:35:31 +02:00
|
|
|
esac
|
2009-09-23 18:17:48 +02:00
|
|
|
|
2010-02-11 15:19:13 +01:00
|
|
|
# check if all local source files are under version control
|
2011-08-10 15:17:58 +02:00
|
|
|
for s in "${source[@]}"; do
|
2011-08-10 15:18:00 +02:00
|
|
|
if [[ $s != *://* ]] && ! svn status -v "$s" | grep -q '^[ AMRX~]'; then
|
2011-11-01 15:33:08 +01:00
|
|
|
die "$s is not under version control"
|
2011-08-10 15:17:59 +02:00
|
|
|
fi
|
2011-03-11 21:18:24 +01:00
|
|
|
done
|
2010-02-11 15:19:13 +01:00
|
|
|
|
2010-06-28 09:54:50 +02:00
|
|
|
# check if changelog and install files are under version control
|
2011-03-11 21:18:24 +01:00
|
|
|
for i in 'changelog' 'install'; do
|
2011-10-24 20:15:22 +02:00
|
|
|
while read -r file; do
|
2010-06-28 09:54:50 +02:00
|
|
|
# evaluate any bash variables used
|
2011-10-24 20:15:22 +02:00
|
|
|
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
2011-08-10 15:18:00 +02:00
|
|
|
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
|
2011-11-01 15:33:08 +01:00
|
|
|
die "${file} is not under version control"
|
2010-06-28 09:54:50 +02:00
|
|
|
fi
|
2011-10-24 20:15:22 +02:00
|
|
|
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
2011-03-11 21:18:24 +01:00
|
|
|
done
|
2010-06-28 09:54:50 +02:00
|
|
|
|
2010-02-11 15:27:24 +01:00
|
|
|
# see if any limit options were passed, we'll send them to rsync
|
2011-08-17 03:35:56 +02:00
|
|
|
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
2011-08-17 03:35:57 +02:00
|
|
|
while getopts ':l:a:' flag; do
|
|
|
|
case $flag in
|
|
|
|
l) rsyncopts+=("--bwlimit=$2") ;;
|
|
|
|
a) commit_arch=$2 ;;
|
2011-11-02 01:38:42 +01:00
|
|
|
:) die "Option requires an argument -- '$OPTARG'" ;;
|
|
|
|
\?) die "Invalid option -- '$OPTARG'" ;;
|
2011-08-17 03:35:57 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(( OPTIND - 1 ))
|
2011-05-16 20:11:59 +02:00
|
|
|
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -n $(svn status -q) ]]; then
|
2011-11-03 09:09:46 +01:00
|
|
|
msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n'
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -n $1 ]]; then
|
2011-11-02 01:38:42 +01:00
|
|
|
stat_busy 'Committing changes to trunk'
|
2011-11-01 15:33:08 +01:00
|
|
|
svn commit -q -m "${msgtemplate}${1}" || die
|
|
|
|
stat_done
|
2011-08-12 18:28:13 +02:00
|
|
|
else
|
2011-08-14 21:30:08 +02:00
|
|
|
msgfile="$(mktemp)"
|
|
|
|
echo "$msgtemplate" > "$msgfile"
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -n $SVN_EDITOR ]]; then
|
2011-08-14 21:30:08 +02:00
|
|
|
$SVN_EDITOR "$msgfile"
|
2011-12-02 08:33:33 +01:00
|
|
|
elif [[ -n $VISUAL ]]; then
|
2011-08-14 21:30:08 +02:00
|
|
|
$VISUAL "$msgfile"
|
2011-12-02 08:33:33 +01:00
|
|
|
elif [[ -n $EDITOR ]]; then
|
2011-08-14 21:30:08 +02:00
|
|
|
$EDITOR "$msgfile"
|
|
|
|
else
|
|
|
|
vi "$msgfile"
|
|
|
|
fi
|
2011-12-02 08:33:33 +01:00
|
|
|
[[ -s $msgfile ]] || die
|
2011-11-02 01:38:42 +01:00
|
|
|
stat_busy 'Committing changes to trunk'
|
2011-11-01 15:33:08 +01:00
|
|
|
svn commit -q -F "$msgfile" || die
|
2011-08-14 21:30:08 +02:00
|
|
|
unlink "$msgfile"
|
2011-11-01 15:33:08 +01:00
|
|
|
stat_done
|
2011-08-12 18:28:13 +02:00
|
|
|
fi
|
2010-02-11 13:53:30 +01:00
|
|
|
fi
|
|
|
|
|
2011-04-01 23:35:34 +02:00
|
|
|
declare -a uploads
|
2011-11-21 10:24:29 +01:00
|
|
|
declare -a commit_arches
|
|
|
|
declare -a skip_arches
|
2011-04-01 23:35:34 +02:00
|
|
|
|
2009-10-21 10:20:31 +02:00
|
|
|
for _arch in ${arch[@]}; do
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then
|
2011-11-21 10:24:29 +01:00
|
|
|
skip_arches+=($_arch)
|
2011-05-16 20:11:59 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2010-02-13 19:47:16 +01:00
|
|
|
for _pkgname in ${pkgname[@]}; do
|
2011-11-01 15:33:08 +01:00
|
|
|
fullver=$(get_full_version $_pkgname)
|
2011-03-13 04:24:20 +01:00
|
|
|
pkgfile=$(getpkgfile "$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null)
|
|
|
|
pkgdestfile=$(getpkgfile "$PKGDEST/$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null)
|
2010-02-13 19:47:16 +01:00
|
|
|
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -f $pkgfile ]]; then
|
2011-03-27 13:50:13 +02:00
|
|
|
pkgfile="./$pkgfile"
|
2011-12-02 08:33:33 +01:00
|
|
|
elif [[ -f $pkgdestfile ]]; then
|
2010-03-03 21:41:53 +01:00
|
|
|
pkgfile="$pkgdestfile"
|
2011-03-27 13:50:13 +02:00
|
|
|
else
|
2011-11-21 10:24:29 +01:00
|
|
|
warning "Could not find ${pkgfile}. Skipping ${_arch}"
|
|
|
|
skip_arches+=($_arch)
|
2010-02-13 19:47:16 +01:00
|
|
|
continue 2
|
|
|
|
fi
|
2011-04-01 23:35:34 +02:00
|
|
|
uploads+=("$pkgfile")
|
2011-04-01 23:35:35 +02:00
|
|
|
|
2011-10-31 12:53:50 +01:00
|
|
|
sigfile="${pkgfile}.sig"
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ $SIGNPKG == 'y' && ! -f $sigfile ]]; then
|
2011-11-01 15:33:08 +01:00
|
|
|
msg "Signing package ${pkgfile}..."
|
2011-04-17 14:51:23 +02:00
|
|
|
if [[ -n $GPGKEY ]]; then
|
|
|
|
SIGNWITHKEY="-u ${GPGKEY}"
|
|
|
|
fi
|
2011-11-01 15:33:08 +01:00
|
|
|
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
|
2011-04-11 18:26:11 +02:00
|
|
|
fi
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -f $sigfile ]]; then
|
2011-10-31 13:14:16 +01:00
|
|
|
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
2011-11-01 15:33:08 +01:00
|
|
|
die "Signature ${pkgfile}.sig is incorrect!"
|
2011-10-31 13:14:16 +01:00
|
|
|
fi
|
2011-04-01 23:35:35 +02:00
|
|
|
uploads+=("$sigfile")
|
2011-10-31 13:53:43 +01:00
|
|
|
else
|
2011-11-01 15:33:08 +01:00
|
|
|
die "Signature ${pkgfile}.sig was not found"
|
2011-04-01 23:35:35 +02:00
|
|
|
fi
|
2010-02-13 19:47:16 +01:00
|
|
|
done
|
2009-09-02 04:35:25 +02:00
|
|
|
done
|
2004-08-22 22:24:02 +02:00
|
|
|
|
2011-11-21 10:24:29 +01:00
|
|
|
for _arch in ${arch[@]}; do
|
|
|
|
if ! in_array $_arch ${skip_arches[@]}; then
|
|
|
|
commit_arches+=($_arch)
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
archrelease "${commit_arches[@]/#/$repo-}" || die
|
2011-08-20 22:20:19 +02:00
|
|
|
|
2011-04-01 23:35:34 +02:00
|
|
|
if [[ ${#uploads[*]} -gt 0 ]]; then
|
2011-11-02 01:38:42 +01:00
|
|
|
msg 'Uploading all package and signature files'
|
2011-11-01 15:33:08 +01:00
|
|
|
rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:staging/$repo/" || die
|
2011-04-01 23:35:34 +02:00
|
|
|
fi
|
|
|
|
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ "${arch[*]}" == 'any' ]]; then
|
|
|
|
if [[ -d ../repos/$repo-i686 && -d ../repos/$repo-x86_64 ]]; then
|
2010-02-13 19:47:16 +01:00
|
|
|
pushd ../repos/ >/dev/null
|
2011-11-02 01:38:42 +01:00
|
|
|
stat_busy "Removing $repo-i686 and $repo-x86_64"
|
2011-11-04 06:51:49 +01:00
|
|
|
svn rm -q $repo-i686
|
|
|
|
svn rm -q $repo-x86_64
|
2011-11-02 01:38:42 +01:00
|
|
|
svn commit -q -m "Removed $repo-i686 and $repo-x86_64 for $pkgname"
|
2011-11-01 15:33:08 +01:00
|
|
|
stat_done
|
2010-02-13 19:47:16 +01:00
|
|
|
popd >/dev/null
|
|
|
|
fi
|
2011-04-15 22:45:46 +02:00
|
|
|
else
|
2011-12-02 08:33:33 +01:00
|
|
|
if [[ -d ../repos/$repo-any ]]; then
|
2011-04-15 22:45:46 +02:00
|
|
|
pushd ../repos/ >/dev/null
|
2011-11-02 01:38:42 +01:00
|
|
|
stat_busy "Removing $repo-any"
|
2011-11-04 06:51:49 +01:00
|
|
|
svn rm -q $repo-any
|
2011-11-02 01:38:42 +01:00
|
|
|
svn commit -q -m "Removed $repo-any for $pkgname"
|
2011-11-01 15:33:08 +01:00
|
|
|
stat_done
|
2011-04-15 22:45:46 +02:00
|
|
|
popd >/dev/null
|
|
|
|
fi
|
2009-09-18 21:39:37 +02:00
|
|
|
fi
|