#!/bin/sh

set -e

# Get build-dependencies (debhelper and dh-octave excluded)
if [ -f debian/control ]; then
  builddeps=$(
    grep-dctrl -n -s Build-Depends -F Build-Depends -r . debian/control \
    | grep -v '^\s*#' \
    | sed -e 's/,\s*/\n/g; s/^\s*//' \
    | sed -e 's/\s*<[^)]*>\s*$//' \
    | sed '/^\s*$/ d; /debhelper/ d; /dh-octave/ d; s/\n/, /' \
    | tr '\n' ', ')
else
  builddeps=''
fi

cat <<EOF
Test-Command: DH_OCTAVE_TEST_ENV="xvfb-run -a" /usr/bin/dh_octave_check --use-installed-package
Depends: @, $builddeps dh-octave-autopkgtest (>= 0.5.6), xauth, xvfb
Restrictions: allow-stderr
EOF
