Package: autodep8
Version: 0.17
Tags: patch

Hello,

autodep8 will not generate a d/tests/control for ELPA packages unless
the debhelper compat is at least 10 (see dh_elpa_test(1)).  I noticed,
however, that support/elpa/detect examines only d/compat, not
considering use of the magic debhelper-compat build dependency.  This
patch fixes it.  Possibly other support/*/detect also need updating in
this way.

Thanks.

-- 
Sean Whitton
From 2627d9bd95ad10927ccaa563e7098f4d4bf2ae43 Mon Sep 17 00:00:00 2001
From: Sean Whitton <[email protected]>
Date: Sun, 30 Dec 2018 14:05:25 +0000
Subject: [PATCH] Update support/elpa/detect for 'debhelper-compat' build-dep

---
 support/elpa/detect | 13 +++++++++----
 test/elpa_test.sh   | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/support/elpa/detect b/support/elpa/detect
index b0daadf..4d41f49 100755
--- a/support/elpa/detect
+++ b/support/elpa/detect
@@ -8,10 +8,15 @@
 
 set -e
 
-# check that the file exists first, so that if it doesn't cat doesn't
-# produce stderr output which disrupts other test/*_test.sh
-test -e debian/compat
-test "$(cat debian/compat)" -ge 10
+if test -e debian/compat; then
+    # ^ check that the file exists first, so that if it doesn't the
+    # following cat doesn't produce stderr which disrupts other
+    # test/*_test.sh
+    test "$(cat debian/compat)" -ge 10
+elif (! grep-dctrl -q -F Build-Depends debhelper-compat debian/control) 2>/dev/null; then
+    # ^ mere presence of debhelper-compat build-dep implies compat >10
+    exit 1
+fi
 (! grep -q ".*DH_ELPA_TEST_DISABLE.*" debian/rules) 2>/dev/null
 (! grep -q "^disabled[ ]*=" debian/elpa-test) 2>/dev/null
 grep-dctrl -q -F Build-Depends dh-elpa debian/control
diff --git a/test/elpa_test.sh b/test/elpa_test.sh
index ddd734a..896c17a 100644
--- a/test/elpa_test.sh
+++ b/test/elpa_test.sh
@@ -18,6 +18,13 @@ test_elpa_test_ert() {
   check_run autodep8
 }
 
+test_elpa_test_debhelper_compat() {
+  has debian/control 'Build-Depends: dh-elpa, debhelper-compat (= 12)'
+  has debian/rules 'foo'
+  has test.el '(ert-deftest foo)'
+  check_run autodep8
+}
+
 test_elpa_test_buttercup() {
   has debian/control 'Build-Depends: dh-elpa, elpa-buttercup'
   has debian/rules 'foo'
@@ -61,4 +68,12 @@ test_elpa_test_bad_compat() {
   assertEquals "" "$(cat stdout stderr)"
 }
 
+test_elpa_test_no_compat() {
+  has debian/control 'Build-Depends: dh-elpa, elpa-buttercup'
+  has debian/rules 'foo'
+  run autodep8
+  assertEquals 1 "$exitstatus"
+  assertEquals "" "$(cat stdout stderr)"
+}
+
 . shunit2
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

Reply via email to