summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-08-01 10:28:56 -0700
committerSean Whitton <spwhitton@spwhitton.name>2016-08-01 10:28:56 -0700
commit741f2a63c83b2767ca1a1e3d8d2d7cbefed41092 (patch)
tree583d7b82bd4f5593b178a2b2990061d1f50fe586
parentc6476fea4d117ddf9eb4684a0bf19980493538f8 (diff)
dh_elpa_test: read config from debian/elpa-test
-rw-r--r--debian/control1
-rwxr-xr-xdh_elpa_test49
2 files changed, 38 insertions, 12 deletions
diff --git a/debian/control b/debian/control
index e0a8912..7ebab63 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Depends:
libdebian-source-perl | dh-make-perl (>= 0.90),
emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~),
libarray-utils-perl,
+ libconfig-tiny-perl,
libfile-find-rule-perl,
libdpkg-perl,
libtext-glob-perl,
diff --git a/dh_elpa_test b/dh_elpa_test
index 766cf81..254cfb9 100755
--- a/dh_elpa_test
+++ b/dh_elpa_test
@@ -96,6 +96,7 @@ 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 Config::Tiny;
use Debian::Debhelper::Dh_Lib;
use Debian::Control;
@@ -133,6 +134,30 @@ if ( get_buildoption("nocheck") || compat(9) ) {
my $control = Debian::Control->new();
$control->read("debian/control");
+# note that we don't need package.elpa-test since we are testing all
+# lisp we can find in the *source* package
+my $options = Config::Tiny->new;
+if ( -f "debian/elpa-test") {
+ verbose_print("I: Ignoring DH_ELPA_TEST_* envvars since debian/elpa-test exists");
+ $options = Config::Tiny->read( "debian/elpa-test" );
+} else {
+ my @envvars = ("DH_ELPA_TEST_DISABLE",
+ "DH_ELPA_TEST_BUTTERCUP_LOAD_PATH",
+ "DH_ELPA_TEST_BUTTERCUP_PATTERNS",
+ "DH_ELPA_TEST_ERT_EXCLUDE",
+ "DH_ELPA_TEST_ERT_HELPER",
+ "DH_ELPA_TEST_ERT_EVAL",
+ "DH_ELPA_TEST_ERT_LOAD_PATH"
+ );
+ foreach my $envvar ( @envvars ) {
+ if (defined $ENV{$envvar}) {
+ my $short = lc(substr($envvar, 13));
+ print "W: environment variable $envvar is deprecated; see dh_elpa_test(1)\n";
+ $options->{_}->{$short} = $ENV{$envvar};
+ }
+ }
+}
+
# these are from dh_elpa
# TODO have dh_elpa export them so we can import them, instead of copy/paste
my $dhelpadir="/usr/share/emacs/site-lisp/elpa";
@@ -142,13 +167,13 @@ my $elpadir="/usr/share/emacs/site-lisp/elpa-src";
if ($control->source->Build_Depends->has( "elpa-buttercup" )) {
my @args = qw{ buttercup -L . };
- if (defined $ENV{'DH_ELPA_TEST_BUTTERCUP_LOAD_PATH'}) {
- foreach my $dir (split(',', $ENV{'DH_ELPA_TEST_BUTTERCUP_LOAD_PATH'})) {
+ if (defined $options->{_}->{'buttercup_load_path'}) {
+ foreach my $dir (split(',', $options->{_}->{'buttercup_load_path'})) {
push @args, ('-L', "$dir");
}
}
- if (defined $ENV{'DH_ELPA_TEST_BUTTERCUP_PATTERNS'}) {
- foreach my $pattern (split(',', $ENV{'DH_ELPA_TEST_BUTTERCUP_PATTERNS'})) {
+ if (defined $options->{_}->{'buttercup_patterns'}) {
+ foreach my $pattern (split(',', $options->{_}->{'buttercup_patterns'})) {
push @args, ('-p', "$pattern");
}
}
@@ -167,8 +192,8 @@ $rule
->file()
->name( '*.el' )
->grep( "ert-deftest" );
-if (defined $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'}) {
- foreach my $glob (split(',', $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'})) {
+if (defined $options->{_}->{'ert_exclude'}) {
+ foreach my $glob (split(',', $options->{_}->{'ert_exclude'})) {
$rule->not_exec( long_name($glob) );
}
}
@@ -188,8 +213,8 @@ if (@ert_files) {
if ($control->source->Build_Depends->has( "dash-el" ));
# add the user's load-path entries
- if (defined $ENV{'DH_ELPA_TEST_ERT_LOAD_PATH'}) {
- foreach my $dir (split(',', $ENV{'DH_ELPA_TEST_ERT_LOAD_PATH'})) {
+ if (defined $options->{_}->{'ert_load_path'}) {
+ foreach my $dir (split(',', $options->{_}->{'ert_load_path'})) {
push @args, ('-L', "$dir");
}
}
@@ -202,13 +227,13 @@ if (@ert_files) {
# TODO maybe we should just add all dirs containing files in @ert_files?
# now finish adding the user's stuff
- push @args, ("--eval", "$ENV{'DH_ELPA_TEST_ERT_EVAL'}")
- if (defined $ENV{'DH_ELPA_TEST_ERT_EVAL'});
+ push @args, ("--eval", $options->{_}->{'ert_eval'})
+ if (defined $options->{_}->{'ert_eval'});
foreach my $ert_file (@ert_files) {
push @args, ("-l", "$ert_file");
}
- if (defined $ENV{'DH_ELPA_TEST_ERT_HELPER'}) {
- push @args, ("-l", "$ENV{'DH_ELPA_TEST_ERT_HELPER'}");
+ if (defined $options->{_}->{'ert_helper'}) {
+ push @args, ("-l", $options->{_}->{'ert_helper'});
} else {
push @args, ("--eval", "(ert-run-tests-batch-and-exit)");
}