Currently multilib is a second-class citizen the way it is lumped into
community, and dbscripts cannot even keep track of whether it
constitutes a testing repo. Teach config to track both testing and
staging repos just like the stable ones, and teach testing2x to search
through TESTING_REPOS to determine which one it is operating on.

Signed-off-by: Eli Schwartz <eschwa...@archlinux.org>
---
 config                     |  3 ++-
 config.local.svn-community |  3 ++-
 config.local.svn-packages  |  3 ++-
 test/lib/common.bash       |  3 ++-
 testing2x                  | 26 ++++++++++++++++----------
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/config b/config
index 1cfe11f4..4c76558b 100644
--- a/config
+++ b/config
@@ -4,7 +4,8 @@ FTP_BASE="/srv/ftp"
 PKGREPOS=()
 PKGPOOL=''
 SRCPOOL=''
-TESTING_REPO=''
+STAGING_REPOS=()
+TESTING_REPOS=()
 STABLE_REPOS=()
 
 # VCS backend
diff --git a/config.local.svn-community b/config.local.svn-community
index 5d61b5ea..493f34e3 100644
--- a/config.local.svn-community
+++ b/config.local.svn-community
@@ -5,7 +5,8 @@ PKGPOOL='pool/community'
 SRCPOOL='sources/community'
 SVNREPO='file:///srv/repos/svn-community/svn'
 SVNUSER='svn-community'
-TESTING_REPO='community-testing'
+STAGING_REPOS=('community-staging' 'multilib-staging')
+TESTING_REPOS=('community-testing' 'multilib-testing')
 STABLE_REPOS=('community')
 
 CLEANUP_DESTDIR="/srv/repos/svn-community/package-cleanup"
diff --git a/config.local.svn-packages b/config.local.svn-packages
index 34aab35c..567d002e 100644
--- a/config.local.svn-packages
+++ b/config.local.svn-packages
@@ -5,7 +5,8 @@ PKGPOOL='pool/packages'
 SRCPOOL='sources/packages'
 SVNREPO='file:///srv/repos/svn-packages/svn'
 SVNUSER='svn-packages'
-TESTING_REPO='testing'
+STAGING_REPOS=('staging')
+TESTING_REPOS=('testing')
 STABLE_REPOS=('core' 'extra')
 
 CLEANUP_DESTDIR="/srv/repos/svn-packages/package-cleanup"
diff --git a/test/lib/common.bash b/test/lib/common.bash
index bc2b4e6d..a92a01ee 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -103,7 +103,8 @@ setup() {
        PKGREPOS=('core' 'extra' 'testing')
        PKGPOOL='pool/packages'
        SRCPOOL='sources/packages'
-       TESTING_REPO='testing'
+       STAGING_REPOS=('staging')
+       TESTING_REPOS=('testing')
        STABLE_REPOS=('core' 'extra')
        CLEANUP_DESTDIR="${TMP}/package-cleanup"
        SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup"
diff --git a/testing2x b/testing2x
index 14970a9f..215be39c 100755
--- a/testing2x
+++ b/testing2x
@@ -10,7 +10,7 @@ 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_REPOS[@]}" "${STABLE_REPOS[@]}"; do
        for pkgarch in "${ARCHES[@]}"; do
                repo_lock "${repo}" "${pkgarch}" || exit 1
        done
@@ -18,30 +18,36 @@ done
 
 declare -A pkgs
 
+testing_repo=
 for pkgbase in "$@"; do
        for pkgarch in "${ARCHES[@]}"; do
-               vcsrepo_from="$(find_repo_for_package "${pkgbase}" 
"${pkgarch[@]}" "${TESTING_REPO}")"
+               vcsrepo_from="$(find_repo_for_package "${pkgbase}" 
"${pkgarch[@]}" "${TESTING_REPOS[@]}")"
                vcsrepo_to="$(find_repo_for_package "${pkgbase}" 
"${pkgarch[@]}" "${STABLE_REPOS[@]}")"
+               repo_from=${vcsrepo_from%-@(any|${pkgarch})}
+               repo_to="${vcsrepo_to%-@(any|${pkgarch})}"
 
+               if [[ -z ${testing_repo} ]]; then
+                       testing_repo=${repo_from}
+               elif [[ ${testing_repo} != ${repo_from} ]]; then
+                       die "Cannot move packages from multiple repos at a 
time: %s" "${testing_repo} ${repo_from}"
+               fi
                if [[ ${vcsrepo_from} && ${vcsrepo_to} ]]; then
-                       move_to="${vcsrepo_to%-@(any|${pkgarch})}"
-                       pkgs[${move_to}]+="${pkgbase} "
+                       pkgs[${repo_to}]+="${pkgbase} "
                        break
                fi
        done
-       [[ ${vcsrepo_from} ]] || die "%s not found in [%s]" "$pkgbase" 
"$TESTING_REPO"
+       [[ ${vcsrepo_from} ]] || die "%s not found in any of these repos: %s" 
"${pkgbase}" "${TESTING_REPOS[@]}"
        [[ ${vcsrepo_to} ]] || die "%s not found in any of these repos: %s" 
"$pkgbase" "${STABLE_REPOS[*]}"
 done
 
-for pkgarch in "${ARCHES[@]}"; do
-       repo_unlock "${TESTING_REPO}" "${pkgarch}"
-done
-for repo in "${STABLE_REPOS[@]}"; do
+for repo in "${TESTING_REPOS[@]}" "${STABLE_REPOS[@]}"; do
        for pkgarch in "${ARCHES[@]}"; do
                repo_unlock "${repo}" "${pkgarch}"
        done
+done
+for repo in "${STABLE_REPOS[@]}"; do
        if [[ -n ${pkgs[${repo}]} ]]; then
-               "$(dirname "$(readlink -e "$0")")/db-move" "${TESTING_REPO}" 
"${repo}" ${pkgs[${repo}]}
+               "$(dirname "$(readlink -e "$0")")/db-move" "${testing_repo}" 
"${repo}" ${pkgs[${repo}]}
        fi
 done
 
-- 
2.19.2

Reply via email to