summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-10-07 14:26:23 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-27 15:46:05 +0200
commit8b77df7580243360431cd5313841556dfa51e94e (patch)
tree5fa727c7bebc9d3601ed55d9dc8555450fcc014c
parent1a57633f1d8e15f4b0ca48f2acacf6b67f74b573 (diff)
downloaddbscripts-8b77df7580243360431cd5313841556dfa51e94e.tar.gz
dbscripts-8b77df7580243360431cd5313841556dfa51e94e.tar.xz
make tests.d/db-add work
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xdb-add1
-rw-r--r--test/lib/common.inc14
-rwxr-xr-xtest/test.d/db-add.sh50
-rwxr-xr-xtest/test.d/db-remove.sh8
-rwxr-xr-xtest/test.d/db-repo-add.sh54
5 files changed, 70 insertions, 57 deletions
diff --git a/db-add b/db-add
index 6c88611..9d21eb4 100755
--- a/db-add
+++ b/db-add
@@ -30,6 +30,7 @@ done
for pkgfile in ${pkgfiles[@]}; do
if [[ -f "$pkgfile" ]]; then
+ # TODO: check for signature before adding
arch_add_to_pool "$pkgfile"
fi
arch_db_add $repo ${tarches[@]} "$pkgfile"
diff --git a/test/lib/common.inc b/test/lib/common.inc
index 4f5a5b4..47b3f58 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -128,6 +128,17 @@ tearDown() {
echo
}
+archreleasePackage() {
+ local repo=$1
+ local pkgbase=$2
+ local arch=$3
+ pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null
+ # TODO: pull archrelease and commitpkg in dbscripts so this can be done cleaner?
+ ~/git/arch/devtools/archrelease ${repo}-${arch} >/dev/null 2>&1
+
+ popd >/dev/null
+}
+
releasePackage() {
local repo=$1
local pkgbase=$2
@@ -137,9 +148,8 @@ releasePackage() {
local pkgver
local pkgname
+ archreleasePackage "${repo}" "${pkgbase}" "${arch}"
pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null
- ~/git/arch/devtools/archrelease ${repo}-${arch} >/dev/null 2>&1
- # TODO: pull archrelease and commitpkg in dbscripts so this can be done cleaner?
pkgver=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
pkgname=($(. PKGBUILD; echo ${pkgname[@]}))
diff --git a/test/test.d/db-add.sh b/test/test.d/db-add.sh
new file mode 100755
index 0000000..cf8d091
--- /dev/null
+++ b/test/test.d/db-add.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+curdir=$(readlink -e $(dirname $0))
+. "${curdir}/../lib/common.inc"
+
+testAddSimplePackages() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b')
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ archreleasePackage extra "${pkgbase}" "${arch}"
+ signpkg "${TMP}/svn-packages-copy/${pkgbase}/trunk/${pkgbase}-1-1-${arch}.pkg.tar.xz"
+ ../db-add extra ${arch} "${TMP}/svn-packages-copy/${pkgbase}/trunk/${pkgbase}-1-1-${arch}.pkg.tar.xz"
+ done
+ done
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
+ done
+ done
+}
+
+testAddMultiplePackages() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b')
+ local pkgbase
+ local arch
+
+ for arch in ${arches[@]}; do
+ add_pkgs=()
+ for pkgbase in ${pkgs[@]}; do
+ archreleasePackage extra "${pkgbase}" "${arch}"
+ signpkg "${TMP}/svn-packages-copy/${pkgbase}/trunk/${pkgbase}-1-1-${arch}.pkg.tar.xz"
+ add_pkgs[${#add_pkgs[*]}]="${TMP}/svn-packages-copy/${pkgbase}/trunk/${pkgbase}-1-1-${arch}.pkg.tar.xz"
+ done
+ ../db-add extra ${arch} ${add_pkgs[@]}
+ done
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
+ done
+ done
+}
+
+. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh
index 416e693..0a9a386 100755
--- a/test/test.d/db-remove.sh
+++ b/test/test.d/db-remove.sh
@@ -19,6 +19,9 @@ testRemovePackages() {
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
+ # TODO: removing pkg-split-a/pkg-split-b won't work because
+ # db-remove only removes single packages, not a group of split
+ # packages. do we want that?
../db-remove extra ${arch} ${pkgbase}
done
done
@@ -45,6 +48,9 @@ testRemoveMultiplePackages() {
../db-update
for arch in ${arches[@]}; do
+ # TODO: removing pkg-split-a/pkg-split-b won't work because
+ # db-remove only removes single packages, not a group of split
+ # packages. do we want that?
../db-remove extra ${arch} ${pkgs[@]}
done
@@ -66,7 +72,7 @@ testRemoveAnyPackages() {
../db-update
for pkgbase in ${pkgs[@]}; do
- ../db-remove extra any ${pkgbase}
+ ../db-remove extra all ${pkgbase}
done
for pkgbase in ${pkgs[@]}; do
diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh
deleted file mode 100755
index 8603104..0000000
--- a/test/test.d/db-repo-add.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
-testAddSimplePackages() {
- local arches=('i686' 'x86_64')
- local pkgs=('pkg-simple-a' 'pkg-simple-b')
- local pkgbase
- local arch
-
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/"
- touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig"
- ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/"
- ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/"
- ../db-repo-add extra ${arch} ${pkgbase}-1-1-${arch}.pkg.tar.xz
- done
- done
-
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
- done
- done
-}
-
-testAddMultiplePackages() {
- local arches=('i686' 'x86_64')
- local pkgs=('pkg-simple-a' 'pkg-simple-b')
- local pkgbase
- local arch
-
- for arch in ${arches[@]}; do
- add_pkgs=()
- for pkgbase in ${pkgs[@]}; do
- cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/"
- touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig"
- ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/"
- ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/"
- add_pkgs[${#add_pkgs[*]}]=${pkgbase}-1-1-${arch}.pkg.tar.xz
- done
- ../db-repo-add extra ${arch} ${add_pkgs[@]}
- done
-
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
- done
- done
-}
-
-. "${curdir}/../lib/shunit2"