#!/bin/bash . "$(dirname "$(readlink -e "$0")")/config" . "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# < 1 )); then msg "usage: %s ..." "${0##*/}" exit 1 fi # Lock everything to reduce possibility of interfering task between the different repo-updates script_lock for repo in "${TESTING_REPO}" "${STABLE_REPOS[@]}"; do for pkgarch in "${ARCHES[@]}"; do repo_lock "${repo}" "${pkgarch}" || exit 1 done done declare -A pkgs for pkgbase in "$@"; do if [[ ! -d ${WORKDIR}/${pkgbase} ]]; then arch_svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null found_source=false for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/${pkgbase}/${TESTING_REPO}-${pkgarch}" if [[ -r ${svnrepo_from}/PKGBUILD ]]; then found_source=true break fi done [[ $found_source = true ]] || die "%s not found in [%s]" "$pkgbase" "$TESTING_REPO" found_target=false for pkgarch in "${ARCHES[@]}" 'any'; do for repo in "${STABLE_REPOS[@]}"; do svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}" if [[ -r ${svnrepo_to}/PKGBUILD ]]; then found_target=true pkgs[${repo}]+="${pkgbase} " break 2 fi done done [[ $found_target = true ]] || die "%s not found in any of these repos: %s" "$pkgbase" "${STABLE_REPOS[*]}" fi done for pkgarch in "${ARCHES[@]}"; do repo_unlock "${TESTING_REPO}" "${pkgarch}" done for repo in "${STABLE_REPOS[@]}"; do for pkgarch in "${ARCHES[@]}"; do repo_unlock "${repo}" "${pkgarch}" done if [[ -n ${pkgs[${repo}]} ]]; then "$(dirname "$(readlink -e "$0")")/db-move" "${TESTING_REPO}" "${repo}" ${pkgs[${repo}]} fi done script_unlock