diff options
26 files changed, 51 insertions, 107 deletions
@@ -1,3 +1,4 @@ *~ /config.local -test/packages/*/*.pkg.tar.?z +/test/packages/*/*.pkg.tar.?z +/.idea diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3a59211 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +test-image: + docker build --pull -t dbscripts/test test + +test: test-image + docker run --rm --network=none -v $(PWD):/dbscripts:ro --tmpfs=/tmp:exec -w /dbscripts/test dbscripts/test ./runTest + +.PHONY: test-image test @@ -34,4 +34,5 @@ SRCEXT=".src.tar.gz" ALLOWED_LICENSES=('GPL' 'GPL1' 'GPL2' 'LGPL' 'LGPL1' 'LGPL2' 'LGPL2.1') # Override default config with config.local -[ -f "$(dirname ${BASH_SOURCE[0]})/config.local" ] && . "$(dirname ${BASH_SOURCE[0]})/config.local" +LOCAL_CONFIG=${DBSCRIPTS_CONFIG:-"$(dirname ${BASH_SOURCE[0]})/config.local"} +[ -f "${LOCAL_CONFIG}" ] && . "${LOCAL_CONFIG}" diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..30247bf --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,22 @@ +FROM pierres/archlinux +RUN pacman -Syu --noconfirm --needed base-devel devtools +RUN pacman-key --init +RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel +RUN useradd -N -g users -G wheel -m tester +RUN install -d -o tester -g users /build +USER tester +RUN echo -e "\ +%echo Generating signing key...\n\ +Key-Type: RSA\n\ +Key-Length: 1024\n\ +Key-Usage: sign\n\ +Name-Real: Bob Tester\n\ +Name-Email: tester@localhost\n\ +Expire-Date: 0\n\ +%no-protection\n\ +%commit\n\ +%echo Done\n"\ +| gpg --quiet --batch --no-tty --no-permission-warning --gen-key +RUN gpg --export | sudo pacman-key -a - +RUN sudo pacman-key --lsign-key tester@localhost +RUN echo -e 'BUILDDIR=/build\nPACKAGER="Bob Tester <tester@localhost>"' > /home/tester/.makepkg.conf diff --git a/test/lib/common.inc b/test/lib/common.inc index aeceece..d1ea100 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -46,17 +46,12 @@ oneTimeSetUp() { if ! ${build}; then if [ "${pkgarch[0]}" == 'any' ]; then - sudo extra-x86_64-build || die 'extra-x86_64-build failed' + makepkg -cCf || die 'makepkg failed' else for a in ${pkgarch[@]}; do - sudo extra-${a}-build || die "extra-${a}-build failed" + CARCH=${a} makepkg -cCf || die "makepkg failed" done fi - for a in ${pkgarch[@]}; do - for p in ${pkgname[@]}; do - cp ${p}-${pkgversion}-${a}${PKGEXT} $(dirname ${BASH_SOURCE[0]})/../packages/${d##*/} - done - done fi popd >/dev/null done @@ -72,9 +67,7 @@ setUp() { local r local a - [ -f "$(dirname ${BASH_SOURCE[0]})/../../config.local" ] && die "$(dirname ${BASH_SOURCE[0]})/../../config.local exists" TMP="$(mktemp -d /tmp/${0##*/}.XXXXXXXXXX)" - #msg "Using ${TMP}" PKGREPOS=('core' 'extra' 'testing') PKGPOOL='pool/packages' @@ -101,7 +94,8 @@ setUp() { arch_svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy" done - cat <<eot > "$(dirname ${BASH_SOURCE[0]})/../../config.local" + export DBSCRIPTS_CONFIG=${TMP}/config.local + cat <<eot > "${DBSCRIPTS_CONFIG}" FTP_BASE="${TMP}/ftp" SVNREPO="file://${TMP}/svn-packages-repo" PKGREPOS=(${PKGREPOS[@]}) @@ -121,7 +115,6 @@ eot tearDown() { rm -rf "${TMP}" - rm -f "$(dirname ${BASH_SOURCE[0]})/../../config.local" echo } diff --git a/test/packages/pkg-any-a/PKGBUILD b/test/packages/pkg-any-a/PKGBUILD index 8749a35..3026919 100644 --- a/test/packages/pkg-any-a/PKGBUILD +++ b/test/packages/pkg-any-a/PKGBUILD @@ -7,6 +7,6 @@ url='http://www.archlinux.org/' license=('GPL') package() { - install -d -m755 ${pkgdir}/usr/share/${pkgname} - echo 'test' > ${pkgdir}/usr/share/${pkgname}/test + install -d ${pkgdir}/usr/share/${pkgname} + :>${pkgdir}/usr/share/${pkgname}/test } diff --git a/test/packages/pkg-any-b/PKGBUILD b/test/packages/pkg-any-b/PKGBUILD index e6a0498..cca1859 100644 --- a/test/packages/pkg-any-b/PKGBUILD +++ b/test/packages/pkg-any-b/PKGBUILD @@ -7,6 +7,6 @@ url='http://www.archlinux.org/' license=('GPL') package() { - install -d -m755 ${pkgdir}/usr/share/${pkgname} - echo 'test' > ${pkgdir}/usr/share/${pkgname}/test + install -d ${pkgdir}/usr/share/${pkgname} + :>${pkgdir}/usr/share/${pkgname}/test } diff --git a/test/packages/pkg-simple-a/Makefile b/test/packages/pkg-simple-a/Makefile deleted file mode 120000 index 50be211..0000000 --- a/test/packages/pkg-simple-a/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../src/Makefile
\ No newline at end of file diff --git a/test/packages/pkg-simple-a/PKGBUILD b/test/packages/pkg-simple-a/PKGBUILD index 953ecfa..25dbed3 100644 --- a/test/packages/pkg-simple-a/PKGBUILD +++ b/test/packages/pkg-simple-a/PKGBUILD @@ -5,18 +5,7 @@ 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} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } diff --git a/test/packages/pkg-simple-a/test.c b/test/packages/pkg-simple-a/test.c deleted file mode 120000 index ed5b5ac..0000000 --- a/test/packages/pkg-simple-a/test.c +++ /dev/null @@ -1 +0,0 @@ -../../src/test.c
\ No newline at end of file diff --git a/test/packages/pkg-simple-b/Makefile b/test/packages/pkg-simple-b/Makefile deleted file mode 120000 index 50be211..0000000 --- a/test/packages/pkg-simple-b/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../src/Makefile
\ No newline at end of file diff --git a/test/packages/pkg-simple-b/PKGBUILD b/test/packages/pkg-simple-b/PKGBUILD index 95ffd09..49bffab 100644 --- a/test/packages/pkg-simple-b/PKGBUILD +++ b/test/packages/pkg-simple-b/PKGBUILD @@ -5,18 +5,7 @@ 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} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } diff --git a/test/packages/pkg-simple-b/test.c b/test/packages/pkg-simple-b/test.c deleted file mode 120000 index ed5b5ac..0000000 --- a/test/packages/pkg-simple-b/test.c +++ /dev/null @@ -1 +0,0 @@ -../../src/test.c
\ No newline at end of file diff --git a/test/packages/pkg-simple-epoch/Makefile b/test/packages/pkg-simple-epoch/Makefile deleted file mode 120000 index 50be211..0000000 --- a/test/packages/pkg-simple-epoch/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../src/Makefile
\ No newline at end of file diff --git a/test/packages/pkg-simple-epoch/PKGBUILD b/test/packages/pkg-simple-epoch/PKGBUILD index eebe2bd..bdce203 100644 --- a/test/packages/pkg-simple-epoch/PKGBUILD +++ b/test/packages/pkg-simple-epoch/PKGBUILD @@ -6,18 +6,7 @@ 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} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } diff --git a/test/packages/pkg-simple-epoch/test.c b/test/packages/pkg-simple-epoch/test.c deleted file mode 120000 index ed5b5ac..0000000 --- a/test/packages/pkg-simple-epoch/test.c +++ /dev/null @@ -1 +0,0 @@ -../../src/test.c
\ No newline at end of file diff --git a/test/packages/pkg-split-a/Makefile b/test/packages/pkg-split-a/Makefile deleted file mode 120000 index 50be211..0000000 --- a/test/packages/pkg-split-a/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../src/Makefile
\ No newline at end of file diff --git a/test/packages/pkg-split-a/PKGBUILD b/test/packages/pkg-split-a/PKGBUILD index e941976..9b764db 100644 --- a/test/packages/pkg-split-a/PKGBUILD +++ b/test/packages/pkg-split-a/PKGBUILD @@ -6,23 +6,11 @@ pkgdesc="A split package called ${pkgbase}" 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_pkg-split-a1() { - cd ${srcdir} - make install DESTDIR=${pkgdir} DESTBIN=${pkgname[0]} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } package_pkg-split-a2() { - cd ${srcdir} - make install DESTDIR=${pkgdir} DESTBIN=${pkgname[1]} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } diff --git a/test/packages/pkg-split-a/test.c b/test/packages/pkg-split-a/test.c deleted file mode 120000 index ed5b5ac..0000000 --- a/test/packages/pkg-split-a/test.c +++ /dev/null @@ -1 +0,0 @@ -../../src/test.c
\ No newline at end of file diff --git a/test/packages/pkg-split-b/Makefile b/test/packages/pkg-split-b/Makefile deleted file mode 120000 index 50be211..0000000 --- a/test/packages/pkg-split-b/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../src/Makefile
\ No newline at end of file diff --git a/test/packages/pkg-split-b/PKGBUILD b/test/packages/pkg-split-b/PKGBUILD index 6ddbc45..3c05371 100644 --- a/test/packages/pkg-split-b/PKGBUILD +++ b/test/packages/pkg-split-b/PKGBUILD @@ -7,23 +7,10 @@ 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_pkg-split-b1() { - cd ${srcdir} - make install DESTDIR=${pkgdir} DESTBIN=${pkgname[0]} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } package_pkg-split-b2() { - cd ${srcdir} - make install DESTDIR=${pkgdir} DESTBIN=${pkgname[1]} + install -D -m755 /bin/true ${pkgdir}/usr/bin/${pkgname} } diff --git a/test/packages/pkg-split-b/test.c b/test/packages/pkg-split-b/test.c deleted file mode 120000 index ed5b5ac..0000000 --- a/test/packages/pkg-split-b/test.c +++ /dev/null @@ -1 +0,0 @@ -../../src/test.c
\ No newline at end of file diff --git a/test/src/Makefile b/test/src/Makefile deleted file mode 100644 index 105b730..0000000 --- a/test/src/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - gcc $(CFLAGS) -o test test.c - -install: - install -D -m755 test $(DESTDIR)/usr/bin/$(DESTBIN) diff --git a/test/src/test.c b/test/src/test.c deleted file mode 100644 index a661689..0000000 --- a/test/src/test.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -int main(void) { - printf("Arch is the best!\n"); - return EXIT_SUCCESS; -} diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh index 7a5ce4c..7ae7a06 100755 --- a/test/test.d/db-update.sh +++ b/test/test.d/db-update.sh @@ -82,7 +82,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 + makepkg -cCf mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/" popd >/dev/null @@ -100,7 +100,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 + makepkg -cCf mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/" popd >/dev/null diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh index 31d85b4..fdc7ca3 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 + makepkg -cCf mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/" popd >/dev/null |