Newer
Older
case $# in
0)
error 'No canonical package found!'
return 1
;;
[!1])
error 'Failed to canonicalize package name -- multiple packages found:'
msg2 '%s' "$@"
return 1
;;
esac
# Source makepkg.conf; fail if it is not found
die '/etc/makepkg.conf not found!'
fi
# Source user-specific makepkg.conf overrides
pkgbase=${pkgbase:-$pkgname}
case "$cmd" in
commitpkg)
die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]'
fi
repo="$1"
shift
;;
*pkg)
repo="${cmd%pkg}"
;;
*)
die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]'
;;
esac
case "$repo" in
core|extra|testing|staging|kde-unstable|gnome-unstable)
server='gerolde.archlinux.org' ;;
community*|multilib*)
server='aur.archlinux.org' ;;
*)
server='gerolde.archlinux.org'
msg "Non-standard repository $repo in use, defaulting to server $server" ;;
# check if all local source files are under version control
for s in "${source[@]}"; do
if [[ $s != *://* ]] && ! svn status -v "$s" | grep -q '^[ AMRX~]'; then
die "$s is not under version control"
done
# check if changelog and install files are under version control
for i in 'changelog' 'install'; do
while read -r file; do
# evaluate any bash variables used
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
die "${file} is not under version control"
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
done
# see if any limit options were passed, we'll send them to rsync
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
while getopts ':l:a:' flag; do
case $flag in
l) rsyncopts+=("--bwlimit=$2") ;;
a) commit_arch=$2 ;;
:) die "Option requires an argument -- '$OPTARG'" ;;
\?) die "Invalid option -- '$OPTARG'" ;;
esac
done
shift $(( OPTIND - 1 ))
msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n'
svn commit -q -m "${msgtemplate}${1}" || die
stat_done
msgfile="$(mktemp)"
echo "$msgtemplate" > "$msgfile"
$EDITOR "$msgfile"
else
vi "$msgfile"
fi
svn commit -q -F "$msgfile" || die
declare -a commit_arches
declare -a skip_arches
if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then
fullver=$(get_full_version $_pkgname)
if ! pkgfile=$(shopt -s nullglob;
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
sigfile="${pkgfile}.sig"
if [[ $SIGNPKG == 'y' && ! -f $sigfile ]]; then
msg "Signing package ${pkgfile}..."
if [[ -n $GPGKEY ]]; then
SIGNWITHKEY="-u ${GPGKEY}"
fi
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
die "Signature ${pkgfile}.sig is incorrect!"
die "Signature ${pkgfile}.sig was not found"
for _arch in ${arch[@]}; do
if ! in_array $_arch ${skip_arches[@]}; then
commit_arches+=($_arch)
fi
done
archrelease "${commit_arches[@]/#/$repo-}" || die
new_uploads=()
# convert to absolute paths so rsync can work with colons (epoch)
while read -r -d '' upload; do
new_uploads+=("$upload")
done < <(realpath -z "${uploads[@]}")
uploads=("${new_uploads[@]}")
unset new_uploads
if [[ ${#uploads[*]} -gt 0 ]]; then
msg 'Uploading all package and signature files'
rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:staging/$repo/" || die
if [[ "${arch[*]}" == 'any' ]]; then
if [[ -d ../repos/$repo-i686 && -d ../repos/$repo-x86_64 ]]; then
stat_busy "Removing $repo-i686 and $repo-x86_64"
svn rm -q $repo-i686
svn rm -q $repo-x86_64
svn commit -q -m "Removed $repo-i686 and $repo-x86_64 for $pkgname"
else
pushd ../repos/ >/dev/null
svn commit -q -m "Removed $repo-any for $pkgname"
popd >/dev/null
fi