From 43775d03f96bf7c91096936a23771f1e115fec03 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Thu, 22 Jun 2017 14:43:14 -0500 Subject: [PATCH] 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: --- contrib/ci/build_and_install_debs.sh | 19 +++++++++++++++---- contrib/debian/fwupd-tests.install | 1 + contrib/debian/fwupd-tests.postrm | 6 ++++++ contrib/debian/fwupd-tests.preinst | 7 +++++++ contrib/debian/rules | 4 ++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 contrib/debian/fwupd-tests.postrm create mode 100644 contrib/debian/fwupd-tests.preinst diff --git a/contrib/ci/build_and_install_debs.sh b/contrib/ci/build_and_install_debs.sh index cacf28caf..4242ea358 100755 --- a/contrib/ci/build_and_install_debs.sh +++ b/contrib/ci/build_and_install_debs.sh @@ -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 diff --git a/contrib/debian/fwupd-tests.install b/contrib/debian/fwupd-tests.install index 9bdfc6351..9e51b0016 100644 --- a/contrib/debian/fwupd-tests.install +++ b/contrib/debian/fwupd-tests.install @@ -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 diff --git a/contrib/debian/fwupd-tests.postrm b/contrib/debian/fwupd-tests.postrm new file mode 100644 index 000000000..701c8cf21 --- /dev/null +++ b/contrib/debian/fwupd-tests.postrm @@ -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 diff --git a/contrib/debian/fwupd-tests.preinst b/contrib/debian/fwupd-tests.preinst new file mode 100644 index 000000000..f0ef47f1f --- /dev/null +++ b/contrib/debian/fwupd-tests.preinst @@ -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 diff --git a/contrib/debian/rules b/contrib/debian/rules index 8ffedeb67..cd242f2eb 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -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