summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db-functions15
-rwxr-xr-xdb-move4
-rw-r--r--test/lib/common.inc4
l---------test/packages/pkg-simple-epoch/Makefile1
-rw-r--r--test/packages/pkg-simple-epoch/PKGBUILD23
l---------test/packages/pkg-simple-epoch/test.c1
-rwxr-xr-xtest/test.d/create-filelists.sh2
-rwxr-xr-xtest/test.d/db-move.sh22
-rwxr-xr-xtest/test.d/db-remove.sh2
-rwxr-xr-xtest/test.d/db-update.sh6
-rwxr-xr-xtest/test.d/ftpdir-cleanup.sh28
-rwxr-xr-xtest/test.d/sourceballs.sh2
12 files changed, 102 insertions, 8 deletions
diff --git a/db-functions b/db-functions
index 7d431fc..676ecf4 100644
--- a/db-functions
+++ b/db-functions
@@ -71,6 +71,19 @@ in_array() {
return 1 # Not Found
}
+##
+# usage : get_full_version( $epoch, $pkgver, $pkgrel )
+# return : full version spec, including epoch (if necessary), pkgver, pkgrel
+##
+get_full_version() {
+ if [[ $1 -eq 0 ]]; then
+ # zero epoch case, don't include it in version
+ echo $2-$3
+ else
+ echo $1:$2-$3
+ fi
+}
+
script_lock() {
local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
@@ -328,7 +341,7 @@ check_pkgsvn() {
[ $? -ge 1 ] && return 1
fi
- local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgver}-${pkgrel}")"
+ local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) )"
[ "${svnver}" == "${_pkgver}" ] || return 1
local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
diff --git a/db-move b/db-move
index ae21781..ced90a3 100755
--- a/db-move
+++ b/db-move
@@ -36,7 +36,7 @@ for pkgbase in ${args[@]:2}; do
die "Could not read pkgname"
fi
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo "${pkgver}-${pkgrel}")
+ pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
if [ -z "${pkgver}" ]; then
die "Could not read pkgver"
fi
@@ -75,7 +75,7 @@ for pkgbase in ${args[@]:2}; do
fi
msg2 "${pkgbase} ($(echo ${tarches[@]}))"
pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo "${pkgver}-${pkgrel}")
+ pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
if [ -d "${svnrepo_to}" ]; then
/usr/bin/svn rm --force -q "${svnrepo_to}"
diff --git a/test/lib/common.inc b/test/lib/common.inc
index 208400c..46747ff 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -18,7 +18,7 @@ oneTimeSetUp() {
pushd $d >/dev/null
pkgname=($(. PKGBUILD; echo ${pkgname[@]}))
pkgarch=($(. PKGBUILD; echo ${arch[@]}))
- pkgversion=$(. PKGBUILD; echo ${pkgver}-${pkgrel})
+ pkgversion=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
build=true
for a in ${pkgarch[@]}; do
@@ -112,7 +112,7 @@ releasePackage() {
pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null
archrelease ${repo}-${arch} >/dev/null 2&>1
- pkgver=$(. PKGBUILD; echo "${pkgver}-${pkgrel}")
+ pkgver=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
popd >/dev/null
cp "${pkgdir}/${pkgbase}"/*-${pkgver}-${arch}.pkg.tar.* "${STAGING}"/${repo}/
}
diff --git a/test/packages/pkg-simple-epoch/Makefile b/test/packages/pkg-simple-epoch/Makefile
new file mode 120000
index 0000000..50be211
--- /dev/null
+++ b/test/packages/pkg-simple-epoch/Makefile
@@ -0,0 +1 @@
+../../src/Makefile \ No newline at end of file
diff --git a/test/packages/pkg-simple-epoch/PKGBUILD b/test/packages/pkg-simple-epoch/PKGBUILD
new file mode 100644
index 0000000..eebe2bd
--- /dev/null
+++ b/test/packages/pkg-simple-epoch/PKGBUILD
@@ -0,0 +1,23 @@
+pkgname=pkg-simple-epoch
+pkgver=1
+pkgrel=1
+epoch=1
+pkgdesc="A package called ${pkgname}"
+arch=('i686' 'x86_64')
+url='http://www.archlinux.org/'
+license=('GPL')
+depends=('glibc')
+makedepends=('gcc')
+source=('Makefile' 'test.c')
+md5sums=('c6cb8dcc86253355fed559416d0c8dcf'
+ '3c1e4279feb678fd9cabaccdb28e40d0')
+
+build() {
+ cd ${srcdir}
+ make
+}
+
+package() {
+ cd ${srcdir}
+ make install DESTDIR=${pkgdir} DESTBIN=${pkgname}
+}
diff --git a/test/packages/pkg-simple-epoch/test.c b/test/packages/pkg-simple-epoch/test.c
new file mode 120000
index 0000000..ed5b5ac
--- /dev/null
+++ b/test/packages/pkg-simple-epoch/test.c
@@ -0,0 +1 @@
+../../src/test.c \ No newline at end of file
diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh
index da76710..08b6790 100755
--- a/test/test.d/create-filelists.sh
+++ b/test/test.d/create-filelists.sh
@@ -5,7 +5,7 @@ curdir=$(readlink -e $(dirname $0))
testCreateSimpleFileLists() {
local arches=('i686' 'x86_64')
- local pkgs=('pkg-simple-a' 'pkg-simple-b')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
local pkgbase
local arch
diff --git a/test/test.d/db-move.sh b/test/test.d/db-move.sh
index 57cbf71..6da25c4 100755
--- a/test/test.d/db-move.sh
+++ b/test/test.d/db-move.sh
@@ -27,6 +27,28 @@ testMoveSimplePackages() {
done
}
+testMoveEpochPackages() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-epoch')
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ releasePackage testing ${pkgbase} ${arch}
+ done
+ done
+
+ ../db-update
+
+ ../db-move testing extra pkg-simple-epoch
+
+ for arch in ${arches[@]}; do
+ checkPackage extra pkg-simple-epoch-1:1-1-${arch}.pkg.tar.xz ${arch}
+ checkRemovedPackage testing pkg-simple-epoch-1:1-1-${arch}.pkg.tar.xz ${arch}
+ done
+}
+
testMoveAnyPackages() {
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh
index b66466d..573bd71 100755
--- a/test/test.d/db-remove.sh
+++ b/test/test.d/db-remove.sh
@@ -5,7 +5,7 @@ curdir=$(readlink -e $(dirname $0))
testRemovePackages() {
local arches=('i686' 'x86_64')
- local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
local pkgbase
local arch
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index 5a3d01d..8acfbeb 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -30,6 +30,12 @@ testAddSingleSimplePackage() {
checkPackage extra 'pkg-simple-a-1-1-i686.pkg.tar.xz' 'i686'
}
+testAddSingleEpochPackage() {
+ releasePackage extra 'pkg-simple-epoch' 'i686'
+ ../db-update
+ checkPackage extra 'pkg-simple-epoch-1:1-1-i686.pkg.tar.xz' 'i686'
+}
+
testAddAnyPackages() {
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase
diff --git a/test/test.d/ftpdir-cleanup.sh b/test/test.d/ftpdir-cleanup.sh
index e9b977b..17287f5 100755
--- a/test/test.d/ftpdir-cleanup.sh
+++ b/test/test.d/ftpdir-cleanup.sh
@@ -34,6 +34,34 @@ testCleanupSimplePackages() {
done
}
+testCleanupEpochPackages() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-epoch')
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ releasePackage extra ${pkgbase} ${arch}
+ done
+ done
+
+ ../db-update
+
+ for arch in ${arches[@]}; do
+ ../db-remove pkg-simple-epoch extra ${arch}
+ done
+
+ ../cron-jobs/ftpdir-cleanup >/dev/null
+
+ for arch in ${arches[@]}; do
+ local pkg1="pkg-simple-epoch-1:1-1-${arch}.pkg.tar.xz"
+ checkRemovedPackage extra 'pkg-simple-epoch' ${arch}
+ [ -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found"
+ [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found"
+ done
+}
+
testCleanupAnyPackages() {
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase
diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh
index 8cba017..11bd0f4 100755
--- a/test/test.d/sourceballs.sh
+++ b/test/test.d/sourceballs.sh
@@ -5,7 +5,7 @@ curdir=$(readlink -e $(dirname $0))
testSourceballs() {
local arches=('i686' 'x86_64')
- local pkgs=('pkg-simple-a' 'pkg-simple-b')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
local pkgbase
local arch