Commit 00ee3650 authored by Héctor Orón Martínez's avatar Héctor Orón Martínez

Merge branch 'autopkgtests' into 'collabora/master'

Backport the autopkgtests added to the Debian OBS package

See merge request !14
parents 00027447 2a1e1cb0
#!/bin/sh
eval "$(dpkg-architecture --print-set)"
case "$DEB_HOST_ARCH" in
(i?86)
echo "i586"
;;
(armel)
echo "armv5el"
;;
(armhf)
echo "armv7hl"
;;
# add any more special cases here
(*)
echo "$DEB_HOST_GNU_CPU"
;;
esac
Repotype: debian
# create initial user
Preinstall: base-passwd
Preinstall: user-setup
# required for preinstall images
Preinstall: perl
# preinstall essentials + dependencies
Preinstall: base-files base-passwd bash bsdutils coreutils dash debconf
Preinstall: debianutils diffutils dpkg e2fslibs e2fsprogs findutils gawk
Preinstall: gcc-6-base grep gzip hostname initscripts init-system-helpers
Preinstall: insserv libacl1 libattr1 libblkid1 libbz2-1.0 libc-bin libc6
Preinstall: libcomerr2 libdb5.3 libgcc1 liblzma5 libmount1 libncurses5
Preinstall: libpam-modules libpcre3 libsmartcols1
Preinstall: libpam-modules-bin libpam-runtime libpam0g libreadline7
Preinstall: libselinux1 libsemanage-common libsemanage1 libsepol1 libsigsegv2
Preinstall: libslang2 libss2 libtinfo5 libustr-1.0-1 libuuid1 login lsb-base
Preinstall: mount multiarch-support ncurses-base ncurses-bin passwd perl-base
Preinstall: readline-common sed sensible-utils sysv-rc sysvinit-utils
Preinstall: tar tzdata util-linux zlib1g
Runscripts: base-passwd user-setup base-files gawk
VMinstall: libdevmapper1.02.1
Order: user-setup:base-files
# Essential packages (this should also pull the dependencies)
Support: base-files base-passwd bash bsdutils coreutils dash debianutils
Support: diffutils dpkg e2fsprogs findutils grep gzip hostname libc-bin
Support: login mount ncurses-base ncurses-bin perl-base sed
Support: sysvinit-utils tar util-linux
# Build-essentials
Required: build-essential
Prefer: build-essential:make
# build script needs fakeroot
Support: fakeroot
# lintian support would be nice, but breaks too much atm
#Support: lintian
# helper tools in the chroot
Support: less kmod net-tools procps psmisc strace vim
%define debian_version 900
Macros:
%debian_version 900
Test-Command: /bin/true
Depends: obs-api, obs-server, obs-worker, obs-productconverter, obs-utils
Restrictions: superficial
Tests: install-purge-install
Depends: obs-api, obs-server, obs-worker, obs-productconverter, obs-utils
Restrictions: needs-root, isolation-machine, breaks-testbed
Tests: install-break-purge
Depends: obs-api, obs-server, obs-worker, obs-productconverter, obs-utils
Restrictions: needs-root, isolation-machine, breaks-testbed
Tests: setup-api-and-check
Depends: obs-api, obs-server, default-mysql-server, ssl-cert, curl, apache2
Restrictions: needs-root, isolation-machine, breaks-testbed
Tests: smoke-test
Depends: obs-api, obs-server, obs-worker, obs-utils, osc, default-mysql-server, ssl-cert, apache2, dpkg-dev
Restrictions: needs-root, isolation-machine, breaks-testbed
#!/bin/sh
packages=${1:-obs-api obs-server obs-worker obs-productconverter obs-utils}
exec 2>&1
set -exu
export DEBIAN_FRONTEND=noninteractive
# if install failed for some reason or the user broke the configuration
# we should still be able to cleanup things
rm -rf /etc/obs
apt-get purge -qy $packages
#!/bin/sh
packages=${1:-obs-api obs-server obs-worker obs-productconverter obs-utils}
exec 2>&1
set -exu
export DEBIAN_FRONTEND=noninteractive
apt-get purge -qy $packages
apt-get install -qy $packages
dummy (1.0) unstable; urgency=medium
* Initial Release.
-- Lucas Kanashiro <lucas.kanashiro@collabora.com> Mon, 01 Apr 2019 12:01:50 -0300
Source: dummy
Priority: optional
Maintainer: Lucas Kanashiro <lucas.kanashiro@collabora.com>
Build-Depends: debhelper (>= 9)
Standards-Version: 4.1.3
Package: dummy
Architecture: all
Depends: ${misc:Depends}
Description: dummy native package
This package is used to test open-build-service source package
#!/bin/sh
exec 2>&1
set -exu
# TODO: https://bugs.debian.org/926198
# set up obs-api app
/usr/share/obs/api/script/rake-tasks.sh setup
# create certificate
make-ssl-cert generate-default-snakeoil --force-overwrite
# update apache2 config
sed -ri 's/(\s*)ServerName api/\1Servername localhost/' /etc/apache2/sites-available/obs.conf
service apache2 restart
# try to access the home page
curl --insecure -s https://localhost | grep "Welcome - Open Build Service"
#!/bin/sh
exec 2>&1
set -exu
# TODO: https://bugs.debian.org/926198
# set up obs-api app
/usr/share/obs/api/script/rake-tasks.sh setup
# create certificate
make-ssl-cert generate-default-snakeoil --force-overwrite
# update apache2 config
sed -ri 's/(\s*)ServerName api/\1Servername localhost/' /etc/apache2/sites-available/obs.conf
service apache2 restart
# TODO: https://bugs.debian.org/926200
# configure obs-server
sed -i "s/frontend = undef/frontend = 'localhost'/g" /etc/obs/BSConfig.pm
# configure obs-worker
sed -i 's/obs:5352/localhost:5352/g' /etc/default/obsworker
sed -i 's/obs:5252/localhost:5252/g' /etc/default/obsworker
sed -i 's/INSTANCES="0"/INSTANCES="1"/g' /etc/default/obsworker
# start worker
service obsworker start
# Debian and OBS use different nomenclature for architectures
obs_arch="$(debian/deb-arch-to-obs-arch)"
mkdir "$AUTOPKGTEST_TMP"/data
cat << EOF > "$AUTOPKGTEST_TMP"/data/test_meta_prj_Debian_9
<project name="Debian:9">
<title>Debian 9 DoD</title>
<description>Debian 9 DoD</description>
<person userid="Admin" role="maintainer"/>
<repository name="main">
<download arch="$obs_arch" url="http://deb.debian.org/debian/stretch/main" repotype="deb"/>
<arch>$obs_arch</arch>
</repository>
</project>
EOF
cat << EOF > "$AUTOPKGTEST_TMP"/data/test_meta_prj_test
<project name="test">
<title>test</title>
<description>test</description>
<person userid="Admin" role="maintainer"/>
<repository name="Debian_9.0">
<path project="Debian:9" repository="main"/>
<arch>$obs_arch</arch>
</repository>
</project>
EOF
cat << EOF > /root/.oscrc
[general]
apiurl = https://localhost
[https://localhost]
user = Admin
pass = opensuse
# do not check self signed certificate
sslcertck = 0
EOF
# create a test project and Debian DoD
osc -A https://localhost/ ls
osc -A https://localhost/ meta prj Debian:9 -c -F "$AUTOPKGTEST_TMP"/data/test_meta_prj_Debian_9
osc -A https://localhost/ meta prjconf Debian:9 -c -F debian/examples/debian-stretch.prjconf
osc -A https://localhost/ meta prj test -c -F "$AUTOPKGTEST_TMP"/data/test_meta_prj_test
# upload the dummy native package
cp -r debian/tests/obs-test-trivial-package "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
osc -A https://localhost/ co test
mkdir -p test/dummy/dummy-1.0; cp -r obs-test-trivial-package/debian test/dummy/dummy-1.0; cd test;
cd dummy; dpkg-source -b dummy-1.0; cd "$AUTOPKGTEST_TMP"/test;
rm -rf dummy/dummy-1.0
osc add dummy
osc ci -m "New import" dummy
cd dummy
found=0
for i in $(seq 1 35); do
echo "Round $i: checking binary..."
output=$(osc -A https://localhost/ ls -b .)
case $output in
*"dummy_1.0_all.deb"*) found=1 && break ;;
*) sleep 10
esac
done
[ "$found" -eq 1 ] || exit 1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment