diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-10-08 19:42:22 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-27 15:46:05 +0200 |
commit | d21c84ef995248661da4d9d8b8e12499144f37f5 (patch) | |
tree | d22f33707ced28f8d1458c68e4cda86a4de8218a | |
parent | 62a6e9c592faf92c18a93b6876caf93f8c14d8be (diff) | |
download | dbscripts-d21c84ef995248661da4d9d8b8e12499144f37f5.tar.gz dbscripts-d21c84ef995248661da4d9d8b8e12499144f37f5.tar.xz |
make tests.d/testing2x work
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | db-functions | 26 | ||||
-rwxr-xr-x | db-move | 15 | ||||
-rwxr-xr-x | test/test.d/testing2x.sh | 2 | ||||
-rwxr-xr-x | testing2x | 62 |
4 files changed, 58 insertions, 47 deletions
diff --git a/db-functions b/db-functions index c637b35..83f1732 100644 --- a/db-functions +++ b/db-functions @@ -552,6 +552,32 @@ arch_db_remove() { done } +arch_db_move() { + local repo_from=$1 + local repo_to=$2 + local arch=$3 + local pkgnames=(${@:4}) + + + local ftppath_from="${FTP_BASE}/${repo_from}/os/" + + for pkgname in "${pkgnames[@]}"; do + pkgentry=$(pkgentry_from_db "$repo_from" "$arch" "$pkgname") + pkgs=($(getpkgfiles "$ftppath_from$arch/$pkgentry"*${PKGEXT})) + + if [[ -z $pkgentry ]]; then + warning "Failed to detect pkgentry for $pkgname" + return 1 + fi + + for pkg in "${pkgs[@]}"; do + pkgname=$(getpkgname "$pkg") + arch_db_add "${repo_to}" "$arch" "${pkg##*/}" + arch_db_remove "${repo_from}" "$arch" "$pkgname" + done + done +} + arch_history_add() { local repo="$1" local pkgfile="$2" @@ -40,20 +40,7 @@ msg "Moving packages from [${repo_from}] to [${repo_to}]..." for arch in ${arches[@]}; do for pkgname in "${pkgnames[@]}"; do msg2 "$arch $pkgname" - - pkgentry=$(pkgentry_from_db "$repo_from" "$arch" "$pkgname") - pkgs=($(getpkgfiles "$ftppath_from$arch/$pkgentry"*${PKGEXT})) - - if [[ -z $pkgentry ]]; then - warning "Failed to detect pkgentry for $pkgname" - continue - fi - - for pkg in "${pkgs[@]}"; do - pkgname=$(getpkgname "$pkg") - arch_db_add "${repo_to}" "$arch" "${pkg##*/}" - arch_db_remove "${repo_from}" "$arch" "$pkgname" - done + arch_db_move "${repo_from}" "${repo_to}" "${arch}" "${pkgname}" done done diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh index 31d85b4..586ce40 100755 --- a/test/test.d/testing2x.sh +++ b/test/test.d/testing2x.sh @@ -10,7 +10,7 @@ testTesting2xAnyPackage() { pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null sed 's/pkgrel=1/pkgrel=2/g' -i PKGBUILD arch_svn commit -q -m"update pkg to pkgrel=2" >/dev/null - sudo extra-i686-build + sudo chronic extra-i686-build mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/" popd >/dev/null @@ -4,58 +4,56 @@ . "$(dirname $0)/db-functions" if [ $# -lt 1 ]; then - msg "usage: ${0##*/} <pkgname|pkgbase> ..." + msg "usage: ${0##*/} <pkgname> ..." 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 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 +for pkgname in "$@"; do + msg "Moving $pkgname" + for pkgarch in ${ARCHES[@]}; do + repo_from="" + repo_to="" 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 + found_target=false + + path="${HISTORYREPO}/${TESTING_REPO}/${pkgarch}/${pkgname}" + if [ -e "${path}" ]; then + found_source=true + repo_from="${TESTING_REPO}" + fi + ${found_source} || continue + + for repo in ${STABLE_REPOS[@]}; do + path="${HISTORYREPO}/${repo}/${pkgarch}/${pkgname}" + if [ -e "${path}" ]; then + found_target=true + repo_to="${repo}" + + msg2 "$pkgarch $repo_from -> $repo_to" + arch_db_move "$repo_from" "$repo_to" "$pkgarch" "$pkgname" break fi done - ${found_source} || die "${pkgbase} not found in [${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} || die "${pkgbase} not found in any of these repos: ${STABLE_REPOS[@]}" - fi + ${found_target} || warning "${pkgname} not found in any of these repos: ${STABLE_REPOS[@]}. skipping" + done + ${found_source} || warning "${pkgname} not found in [${TESTING_REPO}]. skipping" done -for pkgarch in ${ARCHES[@]}; do - repo_unlock ${TESTING_REPO} ${pkgarch} -done -for repo in ${STABLE_REPOS[@]}; do +arch_history_commit "testing2x: $@" + +for repo in ${TESTING_REPO} ${STABLE_REPOS[@]}; do for pkgarch in ${ARCHES[@]}; do repo_unlock ${repo} ${pkgarch} done - if [ -n "${pkgs[${repo}]}" ]; then - "$(dirname $0)/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]} - fi done script_unlock |