debian: use dpkg-divert to adjust the launch script for CI testing

This means that if someone wants to use the test inteface with
packages, no hacky launching needed.

Just:
This commit is contained in:
Mario Limonciello 2017-06-22 14:43:14 -05:00
parent 6db2a4057c
commit 43775d03f9
5 changed files with 33 additions and 4 deletions

View File

@ -11,13 +11,24 @@ EDITOR=/bin/true dch --create --package fwupd -v $VERSION "CI Build"
dpkg-buildpackage
#test the packages install
dpkg -i ../*.deb
dpkg -i `ls ../*.deb | grep -v fwupd-tests`
# run the installed tests
if [ "$CI" = "true" ]; then
sed -i "s,Exec=,Exec=/bin/sh -c 'FWUPD_TESTS=$CI ,;
s,Exec=.*$,&',;" \
/usr/share/dbus-1/system-services/org.freedesktop.fwupd.service
dpkg -i ../fwupd-tests*.deb
/etc/init.d/dbus start
gnome-desktop-testing-runner fwupd
apt purge -y fwupd-tests
fi
#test the packages remove
apt purge -y fwupd \
fwupd-doc \
fwupd-dbgsym \
gir1.2-fwupd-1.0 \
libdfu1 \
libdfu1-dbgsym \
libdfu-dev \
libfwupd1 \
libfwupd1-dbgsym \
libfwupd-dev

View File

@ -1,2 +1,3 @@
usr/share/installed-tests/*
usr/lib/*/fwupd-plugins-2/libfu_plugin_test.so
usr/share/dbus-1/system-services/org.freedesktop.fwupd.service

View File

@ -0,0 +1,6 @@
#!/bin/sh
if [ "$1" = remove -o "$1" = purge ]; then
dpkg-divert --package fwupd-tests --remove --rename \
--divert /usr/share/dbus-1/system-services/org.freedesktop.fwupd.service.original \
/usr/share/dbus-1/system-services/org.freedesktop.fwupd.service
fi

View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ "$1" = "upgrade" ] || [ "$1" = "install" ]; then
dpkg-divert --package fwupd-tests --add --rename \
--divert /usr/share/dbus-1/system-services/org.freedesktop.fwupd.service.original \
/usr/share/dbus-1/system-services/org.freedesktop.fwupd.service
fi

View File

@ -33,9 +33,13 @@ override_dh_install:
sed -i 's,wheel,sudo,' ./debian/tmp/usr/share/polkit-1/rules.d/org.freedesktop.fwupd.rules
dh_install
dh_missing --fail-missing
#this is placed in fwupd-tests
rm -f debian/fwupd/usr/lib/*/fwupd-plugins-2/libfu_plugin_test.so
sed -i "s,Exec=,Exec=/bin/sh -c 'FWUPD_TESTS=1 ,; s,Exec=.*$$,&',;" \
debian/fwupd-tests/usr/share/dbus-1/system-services/org.freedesktop.fwupd.service
override_dh_strip_nondeterminism:
dh_strip_nondeterminism -Xfirmware-example.xml.gz