summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-06-13 22:12:47 +0900
committerSean Whitton <spwhitton@spwhitton.name>2016-06-13 22:12:47 +0900
commitafcc9d9914bf9a779a95a0fb8520848e54729926 (patch)
treedfb5c3e643142bd14ef832b96de0c0a2cc918dba
parenta8a5936aafb711489d6420404b559c7b353bda40 (diff)
fix DH_ELPA_TEST_ERT_EXCLUDE bug
-rw-r--r--debian/changelog11
-rw-r--r--debian/control1
-rwxr-xr-xdh_elpa_test26
3 files changed, 37 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index cf47386..006e26e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+dh-elpa (0.0.22) UNRELEASED; urgency=medium
+
+ * Globs in DH_ELPA_TEST_ERT_EXCLUDE will now be matched against the full
+ paths to files (relative to the root of the source package).
+ Previously, only the basename was matched, so it was not possible to
+ use a glob like "broken-tests/*.el".
+ * New dependency on libtext-glob-perl.
+ * Add example usage of DH_ELPA_TEST_ERT_EXCLUDE to dh_elpa_test(1).
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Mon, 13 Jun 2016 22:04:21 +0900
+
dh-elpa (0.0.21) unstable; urgency=medium
* Actually exclude .pc/ and debian/ directories from ERT tests.
diff --git a/debian/control b/debian/control
index f88664f..8d67dab 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Depends:
emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~),
libarray-utils-perl,
libfile-find-rule-perl,
+ libtext-glob-perl,
${misc:Depends},
${perl:Depends},
Description: Debian helper tools for packaging emacs lisp extensions
diff --git a/dh_elpa_test b/dh_elpa_test
index b46875e..766cf81 100755
--- a/dh_elpa_test
+++ b/dh_elpa_test
@@ -95,10 +95,33 @@ B<dh_elpa_test> invokes Emacs to run ERT tests.
use File::Find::Rule;
use Array::Utils qw{ array_minus };
+use Text::Glob qw{ glob_to_regex };
use Debian::Debhelper::Dh_Lib;
use Debian::Control;
+# ---- Subroutines
+
+# like Find::File::Rule::name, but matches the whole path of the file
+# (relative to cwd when search was started) against the glob, rather
+# than just the basename (also, unlike Find::File::Rule::name, accepts
+# a single glob and no regexps since that's all we need here)
+sub long_name {
+ my $glob = shift;
+
+ return sub {
+ ( undef, undef, my $fullname ) = @_;
+
+ if ( $fullname =~ glob_to_regex($glob) ) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+}
+
+# ---- Script setup
+
# This checks whether the debhelper compat is 10 or above. With
# debhelper compat below 9, dh_elpa_test will get run more in more
# than one sequence, including inside fakeroot, which can cause tests
@@ -146,7 +169,7 @@ $rule
->grep( "ert-deftest" );
if (defined $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'}) {
foreach my $glob (split(',', $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'})) {
- $rule->not_name($glob);
+ $rule->not_exec( long_name($glob) );
}
}
my @ert_files = $rule->in('.');
@@ -202,6 +225,7 @@ Here is an example of using the helper in a dh(1) style debian/rules
#!/usr/bin/make -f
export DH_ELPA_TEST_BUTTERCUP_LOAD_PATH=lib,other_lib
+ export DH_ELPA_TEST_ERT_EXCLUDE=broken-tests/*.el
%:
dh $@ --with elpa