From: Pierre Schmitz <pie...@archlinux.de>

(cherry picked from commit 4751408429ba67625d8a54c6758e979cd20b4c5f)
---
 test/cases/db-move.bats        |  9 +++--
 test/cases/db-remove.bats      |  2 +-
 test/cases/db-repo-remove.bats |  2 +-
 test/cases/db-update.bats      | 12 +++---
 test/cases/ftpdir-cleanup.bats |  4 +-
 test/lib/common.bash           | 89 +++++++++++-------------------------------
 6 files changed, 37 insertions(+), 81 deletions(-)

diff --git a/test/cases/db-move.bats b/test/cases/db-move.bats
index b23a5b7..a3a41c8 100755
--- a/test/cases/db-move.bats
+++ b/test/cases/db-move.bats
@@ -78,9 +78,9 @@ load ../lib/common
        db-update
        db-move testing extra pkg-any-a
 
-       checkAnyPackage extra pkg-any-a-1-1-any.pkg.tar.xz
-       checkRemovedAnyPackage testing pkg-any-a
-       checkAnyPackage testing pkg-any-b-1-1-any.pkg.tar.xz
+       checkPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
+       checkRemovedPackage testing pkg-any-a any
+       checkPackage testing pkg-any-b-1-1-any.pkg.tar.xz any
 }
 
 @test "move split packages" {
@@ -109,5 +109,6 @@ load ../lib/common
                done
        done
 
-       checkRemovedAnyPackage testing pkg-split-a
+       # FIXME: Why any?
+       checkRemovedPackage testing pkg-split-a any
 }
diff --git a/test/cases/db-remove.bats b/test/cases/db-remove.bats
index 99b31f7..5201440 100755
--- a/test/cases/db-remove.bats
+++ b/test/cases/db-remove.bats
@@ -65,6 +65,6 @@ load ../lib/common
        done
 
        for pkgbase in "${pkgs[@]}"; do
-               checkRemovedAnyPackage extra "${pkgbase}"
+               checkRemovedPackage extra "${pkgbase}" any
        done
 }
diff --git a/test/cases/db-repo-remove.bats b/test/cases/db-repo-remove.bats
index 0e38ad5..165b759 100755
--- a/test/cases/db-repo-remove.bats
+++ b/test/cases/db-repo-remove.bats
@@ -65,6 +65,6 @@ load ../lib/common
        done
 
        for pkgbase in ${pkgs[@]}; do
-               checkRemovedAnyPackageDB extra ${pkgbase}
+               checkRemovedPackageDB extra ${pkgbase} any
        done
 }
diff --git a/test/cases/db-update.bats b/test/cases/db-update.bats
index 9c1226e..f648456 100755
--- a/test/cases/db-update.bats
+++ b/test/cases/db-update.bats
@@ -43,7 +43,7 @@ load ../lib/common
        db-update
 
        for pkgbase in "${pkgs[@]}"; do
-               checkAnyPackage extra "${pkgbase}-1-1-any.pkg.tar.xz"
+               checkPackage extra "${pkgbase}-1-1-any.pkg.tar.xz" any
        done
 }
 
@@ -79,7 +79,7 @@ load ../lib/common
        releasePackage extra pkg-any-a any
        db-update
 
-       checkAnyPackage extra pkg-any-a-1-2-any.pkg.tar.xz any
+       checkPackage extra pkg-any-a-1-2-any.pkg.tar.xz any
 }
 
 @test "update any package to different repositories at once" {
@@ -91,14 +91,14 @@ load ../lib/common
 
        db-update
 
-       checkAnyPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
-       checkAnyPackage testing pkg-any-a-1-2-any.pkg.tar.xz any
+       checkPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
+       checkPackage testing pkg-any-a-1-2-any.pkg.tar.xz any
 }
 
 @test "update same any package to same repository" {
        releasePackage extra pkg-any-a any
        db-update
-       checkAnyPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
+       checkPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
 
        releasePackage extra pkg-any-a any
        run db-update
@@ -108,7 +108,7 @@ load ../lib/common
 @test "update same any package to different repositories" {
        releasePackage extra pkg-any-a any
        db-update
-       checkAnyPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
+       checkPackage extra pkg-any-a-1-1-any.pkg.tar.xz any
 
        releasePackage testing pkg-any-a any
        run db-update
diff --git a/test/cases/ftpdir-cleanup.bats b/test/cases/ftpdir-cleanup.bats
index f1fd7e4..5f6b680 100755
--- a/test/cases/ftpdir-cleanup.bats
+++ b/test/cases/ftpdir-cleanup.bats
@@ -71,12 +71,12 @@ load ../lib/common
        ftpdir-cleanup
 
        local pkg1='pkg-any-a-1-1-any.pkg.tar.xz'
-       checkRemovedAnyPackage extra 'pkg-any-a'
+       checkRemovedPackage extra 'pkg-any-a' any
        [ ! -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" ]
        [ ! -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ]
 
        local pkg2="pkg-any-b-1-1-${arch}.pkg.tar.xz"
-       checkAnyPackage extra "${pkg2}"
+       checkPackage extra "${pkg2}" any
 }
 
 @test "cleanup split packages" {
diff --git a/test/lib/common.bash b/test/lib/common.bash
index 39ceeb4..d8a01ca 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -178,16 +178,25 @@ getPackageNamesFromPackageBase() {
        $(. "packages/${pkgbase}/PKGBUILD"; echo ${pkgname[@]})
 }
 
-checkAnyPackageDB() {
+checkPackageDB() {
        local repo=$1
        local pkg=$2
-       local arch
+       local arch=$3
        local db
+       local tarches
 
        [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}" ]
        [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ]
+       [ ! -r "${STAGING}/${repo}/${pkg}" ]
+       [ ! -r "${STAGING}/${repo}/${pkg}.sig" ]
 
-       for arch in "${ARCH_BUILD[@]}"; do
+       if [[ $arch == any ]]; then
+               tarches=("${ARCHES[@]}")
+       else
+               tarches=("${arch}")
+       fi
+
+       for arch in "${tarches[@]}"; do
                [ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ]
                [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == 
"$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}")" ]
 
@@ -199,44 +208,6 @@ checkAnyPackageDB() {
                        bsdtar -xf 
"${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep "${pkg}" 
&>/dev/null
                done
        done
-       [ ! -r "${STAGING}/${repo}/${pkg}" ]
-       [ ! -r "${STAGING}/${repo}/${pkg}".sig ]
-}
-
-checkAnyPackage() {
-       local repo=$1
-       local pkg=$2
-
-       checkAnyPackageDB "$repo" "$pkg"
-
-       local pkgbase=$(__getPackageBaseFromPackage 
"${FTP_BASE}/${PKGPOOL}/${pkg}")
-       svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
-       [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ]
-}
-
-checkPackageDB() {
-       local repo=$1
-       local pkg=$2
-       local arch=$3
-       local db
-
-       [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}" ]
-       [ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ]
-       [ ! -r "${STAGING}/${repo}/${pkg}" ]
-
-       [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == 
"$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}")" ]
-
-       [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ]
-       [ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig" ]
-       [ ! -r "${STAGING}/${repo}/${pkg}.sig" ]
-
-       [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == 
"$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}.sig")" ]
-
-       for db in "${DBEXT}" "${FILESEXT}"; do
-               if [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ]; 
then
-                       bsdtar -xf 
"${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep "${pkg}" 
&>/dev/null
-               fi
-       done
 }
 
 checkPackage() {
@@ -251,19 +222,6 @@ checkPackage() {
        [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ]
 }
 
-checkRemovedPackageDB() {
-       local repo=$1
-       local pkgbase=$2
-       local arch=$3
-       local db
-
-       for db in "${DBEXT}" "${FILESEXT}"; do
-               if [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ]; 
then
-                       ! bsdtar -xf 
"${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep "${pkgbase}" 
&>/dev/null
-               fi
-       done
-}
-
 checkRemovedPackage() {
        local repo=$1
        local pkgbase=$2
@@ -275,27 +233,24 @@ checkRemovedPackage() {
        [ ! -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ]
 }
 
-checkRemovedAnyPackageDB() {
+checkRemovedPackageDB() {
        local repo=$1
        local pkgbase=$2
-       local arch
+       local arch=$3
        local db
+       local tarches
+
+       if [[ $arch == any ]]; then
+               tarches=(${ARCHES[@]})
+       else
+               tarches=(${arch})
+       fi
 
        for db in "${DBEXT}" "${FILESEXT}"; do
-               for arch in "${ARCH_BUILD[@]}"; do
+               for arch in "${tarches[@]}"; do
                        if [ -r 
"${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ]; then
                                ! bsdtar -xf 
"${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep "${pkgbase}" 
&>/dev/null
                        fi
                done
        done
 }
-
-checkRemovedAnyPackage() {
-       local repo=$1
-       local pkgbase=$2
-
-       checkRemovedAnyPackageDB "$repo" "$pkgbase"
-
-       svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
-       [ ! -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ]
-}
-- 
2.16.2

_______________________________________________
Dev mailing list
Dev@lists.parabola.nu
https://lists.parabola.nu/mailman/listinfo/dev

Reply via email to