summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-02 23:14:35 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-02 23:14:35 -0400
commit0d6706721278efd42eefa3a4d54ee9773711e65e (patch)
tree6781a8529270c82b88673943b90d4cd5e5ebbbed
parentb7edc550e67393483efe179d5d5cd8bd484a9a05 (diff)
testing cleanup (backported from lukeshu/xbs)
-rw-r--r--config.testing10
-rw-r--r--db-functions8
-rw-r--r--test/lib/common.inc37
-rwxr-xr-xtest/test.d/create-filelists.sh2
-rwxr-xr-xtest/test.d/db-update.sh6
-rwxr-xr-xtest/test.d/testing2x.sh2
6 files changed, 46 insertions, 19 deletions
diff --git a/config.testing b/config.testing
new file mode 100644
index 0000000..24c2283
--- /dev/null
+++ b/config.testing
@@ -0,0 +1,10 @@
+#!/hint/bash
+
+# The host architecture
+ARCH_HOST=$(uname -m)
+# Which architectures should we test building for?
+ARCH_BUILD=("$ARCH_HOST"); if [[ $ARCH_HOST == x86_64 ]]; then ARCH_BUILD+=("i686"); fi
+
+# override the default TMPDIR
+[[ -n $MASTER_TMPDIR ]] || export MASTER_TMPDIR="$(mktemp -dt "${0##*/}.XXXXXXXXXX")"
+TMPDIR=$MASTER_TMPDIR
diff --git a/db-functions b/db-functions
index 885e825..bd87064 100644
--- a/db-functions
+++ b/db-functions
@@ -449,3 +449,11 @@ arch_repo_remove() {
REPO_MODIFIED=1
}
+
+arch_svn() {
+ if [ -z "${SVNUSER}" ]; then
+ /usr/bin/svn "${@}"
+ else
+ sudo -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}"
+ fi
+}
diff --git a/test/lib/common.inc b/test/lib/common.inc
index bef8749..1831602 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -46,21 +46,19 @@ oneTimeSetUp() {
if ! "${build}"; then
if [ "${pkgarch[0]}" == 'any' ]; then
- sudo extra-x86_64-build || die 'extra-x86_64-build failed'
+ sudo libremakepkg || die 'libremakepkg failed'
else
for a in "${pkgarch[@]}"; do
if in_array "$a" "${ARCH_BUILD[@]}"; then
- sudo "extra-${a}-build" || die "extra-${a}-build failed"
+ sudo setarch "$a" libremakepkg -n "$a" || die "setarch ${a} libremakepkg -n ${a} failed"
+ for p in "${pkgname[@]}"; do
+ cp "${p}-${pkgversion}-${a}"${PKGEXT} "$(dirname "${BASH_SOURCE[0]})/../packages/${d##*/}")"
+ done
+ else
+ warning "skipping arch %s" "$a"
fi
done
fi
- for a in "${pkgarch[@]}"; do
- if in_array "$a" "${ARCH_BUILD[@]}"; then
- for p in "${pkgname[@]}"; do
- cp "${p}-${pkgversion}-${a}"${PKGEXT} "$(dirname "${BASH_SOURCE[0]}")/../packages/${d##*/}"
- done
- fi
- done
fi
popd >/dev/null
done
@@ -82,6 +80,7 @@ setUp() {
PKGREPOS=('core' 'extra' 'testing')
PKGPOOL='pool/packages'
+ SRCPOOL='pool/sources'
mkdir -p "${TMP}/"{ftp,tmp,staging,{package,source}-cleanup,svn-packages-{copy,repo}}
for r in "${PKGREPOS[@]}"; do
@@ -105,11 +104,21 @@ setUp() {
arch_svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy"
done
+ mkdir -p "${TMP}/home/.config/libretools"
+ export XDG_CONFIG_HOME="${TMP}/home/.config"
+ printf '%s\n' \
+ 'SVNURL=foo' \
+ "SVNREPO=\"${TMP}/svn-packages-copy\"" \
+ "ARCHES=($(printf '%q ' "${BUILD_ARCHES[@]}"))" \
+ > "$XDG_CONFIG_HOME/libretools/xbs-abs.conf"
+ printf '%s\n' 'BUILDSYSTEM=abs' > "$XDG_CONFIG_HOME/xbs.conf"
+
cat <<eot > "$(dirname "${BASH_SOURCE[0]}")/../../config.local"
FTP_BASE="${TMP}/ftp"
SVNREPO="file://${TMP}/svn-packages-repo"
PKGREPOS=("${PKGREPOS[@]}")
PKGPOOL="${PKGPOOL}"
+ SRCPOOL="${SRCPOOL}"
TESTING_REPO='testing'
STABLE_REPOS=('core' 'extra')
CLEANUP_DESTDIR="${TMP}/package-cleanup"
@@ -139,7 +148,7 @@ releasePackage() {
local pkgname
pushd "${TMP}/svn-packages-copy/${pkgbase}/trunk/" >/dev/null
- archrelease "${repo}-${arch}" >/dev/null 2>&1
+ xbs release "${repo}" "${arch}" >/dev/null 2>&1
pkgver=$(. PKGBUILD; get_full_version)
pkgname=($(. PKGBUILD; echo "${pkgname[@]}"))
popd >/dev/null
@@ -167,12 +176,12 @@ checkAnyPackageDB() {
for arch in "${ARCH_BUILD[@]}"; do
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} is not a symlink"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/${PKGPOOL}/${pkg}" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}")" ] \
|| fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}"
if "${REQUIRE_SIGNATURE}"; then
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}.sig")" ] \
|| fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig"
fi
@@ -208,7 +217,7 @@ checkPackageDB() {
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} not a symlink"
[ -r "${STAGING}/${repo}/${pkg}" ] && fail "${repo}/${pkg} found in staging dir"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/${PKGPOOL}/${pkg}" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}")" ] \
|| fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}"
if "${REQUIRE_SIGNATURE}"; then
@@ -216,7 +225,7 @@ checkPackageDB() {
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink"
[ -r "${STAGING}/${repo}/${pkg}.sig" ] && fail "${repo}/${pkg}.sig found in staging dir"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}.sig")" ] \
|| fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig"
fi
diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh
index 20dafc6..837c432 100755
--- a/test/test.d/create-filelists.sh
+++ b/test/test.d/create-filelists.sh
@@ -59,7 +59,7 @@ testCreateSplitFileLists() {
../db-update
for pkgbase in "${pkgs[@]}"; do
- pkgnames=($(source "${TMP}/svn-packages-copy/${pkgbase}/trunk/PKGBUILD"; echo ${pkgname[@]}))
+ pkgnames=($(source "${TMP}/svn-packages-copy/${pkgbase}/trunk/PKGBUILD"; echo "${pkgname[@]}"))
for pkgname in "${pkgnames[@]}"; do
for arch in "${ARCH_BUILD[@]}"; do
if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep "usr/bin/${pkgname}" &>/dev/null; then
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index 540eccf..5d3c833 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -80,7 +80,7 @@ testUpdateAnyPackage() {
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 libremakepkg
mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/"
popd >/dev/null
@@ -98,7 +98,7 @@ testUpdateAnyPackageToDifferentRepositoriesAtOnce() {
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 libremakepkg
mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/"
popd >/dev/null
@@ -130,7 +130,7 @@ testUpdateSameAnyPackageToDifferentRepositories() {
../db-update >/dev/null 2>&1 && (fail 'Adding an existing package to another repository should fail'; return 1)
local arch
- for arch in i686 x86_64; do
+ for arch in "${ARCH_BUILD[@]}"; do
( [ -r "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \
&& bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep "${pkgbase}" &>/dev/null) \
&& fail "${pkgbase} should not be in testing/os/${arch}/testing${DBEXT%.tar.*}"
diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh
index c611ce4..8232490 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 libremakepkg
mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/"
popd >/dev/null