diff options
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/control | 10 | ||||
-rw-r--r-- | debian/copyright | 1 | ||||
-rw-r--r-- | debian/install | 1 | ||||
-rwxr-xr-x | debian/rules | 6 | ||||
-rwxr-xr-x | dh_elpa_test | 174 | ||||
-rwxr-xr-x | elpa_plus_test.pm | 13 |
7 files changed, 203 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog index 3690c07..fef0560 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,11 @@ dh-elpa (0.0.20) UNRELEASED; urgency=medium [ Sean Whitton ] * Add yasnippet to list of packages maintained outside of the elpa-* binary package namespace. + * Add dh_elpa_test helper and elpa_plus_test.pm sequencer script, plus + documentation, new dependencies and installation code. dh_elpa can + now automatically detect and run Buttercup and ERT test suites. + * Use https for Vcs-* control file fields. + * Add myself as an uploader. -- Sean Whitton <spwhitton@spwhitton.name> Wed, 16 Mar 2016 19:16:15 -0700 diff --git a/debian/control b/debian/control index 94b57f4..de7bfa5 100644 --- a/debian/control +++ b/debian/control @@ -2,17 +2,17 @@ Source: dh-elpa Section: devel Priority: optional Maintainer: Debian Emacs addons team <pkg-emacsen-addons@lists.alioth.debian.org> -Uploaders: David Bremner <bremner@debian.org> -Build-Depends: debhelper (>=9.20151004), +Uploaders: David Bremner <bremner@debian.org>, Sean Whitton <spwhitton@spwhitton.name> +Build-Depends: debhelper (>=9.20151004), emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~) Standards-Version: 3.9.6 -Vcs-Git: git://anonscm.debian.org/pkg-emacsen/pkg/dh-elpa.git -Vcs-Browser: http://anonscm.debian.org/cgit/pkg-emacsen/pkg/dh-elpa.git/ +Vcs-Git: https://anonscm.debian.org/pkg-emacsen/pkg/dh-elpa.git +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-emacsen/pkg/dh-elpa.git/ Package: dh-elpa Architecture: all Built-Using: ${misc:Built-Using} -Depends: ${misc:Depends}, ${perl:Depends}, emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~) +Depends: ${misc:Depends}, ${perl:Depends}, emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~), dh-make-perl (>= 0.90), libarray-utils-perl, libtext-glob-perl Description: Debian helper tools for packaging emacs lisp extensions This package provides a helper for packaging emacs lisp extensions in a way compatible with the GNU Emacs 'elpa' package repository. diff --git a/debian/copyright b/debian/copyright index 4f236de..47c7357 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,6 +3,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: © 2007-2015 Free Software Foundation Inc, © 2015 David Bremner <bremner@debian.org> + © 2016 Sean Whitton <spwhitton@spwhitton.name> License: GPL-3+ dh-elpa is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/debian/install b/debian/install index 7730e3d..35b1239 100644 --- a/debian/install +++ b/debian/install @@ -1,3 +1,4 @@ usr/bin emacsen-common usr/share/debhelper/dh_elpa elpa.pm usr/share/perl5/Debian/Debhelper/Sequence +elpa_plus_test.pm usr/share/perl5/Debian/Debhelper/Sequence diff --git a/debian/rules b/debian/rules index ccb9394..ecdc57e 100755 --- a/debian/rules +++ b/debian/rules @@ -7,13 +7,15 @@ VERSION=$(shell dpkg-parsechangelog | sed -n 's/^Version: //p') override_dh_auto_build: pod2man -c Debhelper --section=1 dh_elpa.in > dh_elpa.1 + pod2man -c Debhelper --section=1 dh_elpa_test > dh_elpa_test.1 sed s/@HELPER_VERSION@/${VERSION}/ < dh_elpa.in > dh_elpa - chmod 755 dh_elpa + chmod 755 dh_elpa dh_elpa_test override_dh_install: dh_install - dh_installman dh_elpa.1 + dh_installman dh_elpa.1 dh_elpa_test.1 ./dh_elpa --no-byte-compile override_dh_auto_install: install -m 755 -D dh_elpa $(DESTDIR)/usr/bin/dh_elpa + install -m 755 -D dh_elpa_test $(DESTDIR)/usr/bin/dh_elpa_test diff --git a/dh_elpa_test b/dh_elpa_test new file mode 100755 index 0000000..b06c485 --- /dev/null +++ b/dh_elpa_test @@ -0,0 +1,174 @@ +#!/usr/bin/perl + +=head1 NAME + +dh_elpa_test - run ELPA package testsuites + +=cut + +use strict; +use warnings; + +=head1 SYNOPSIS + +B<dh_elpa_test> [S<I<debhelper options>>] [S<I<pkg-file>>] + +=head1 DESCRIPTION + +B<dh_elpa_test> is a debhelper program that is responsible for running +the testsuites of ELPA packages, when those test suites use ERT or +buttercup(1). dh_auto_test is rarely suitable. + +Testing with buttercup(1) will be activated if the package +build-depends on elpa-buttercup. Testing with ERT will be activated +if ERT test files can be found or are supplied by an environment +variable (see below). + +=head1 ENVIRONMENT VARIABLES + +B<dh_elpa_test> will respond to the following variables set, for +example, at the top of your debian/rules file. Do not surround +variable values with double-quotation marks. E.g. + +=over 4 + + export DH_ELPA_TEST_BUTTERCUP_LOAD_PATH=lib,other_lib + +=back + +=over 4 + +=item B<DH_ELPA_TEST_BUTTERCUP_LOAD_PATH> + +A comma-separated list of directories to add to the load-path when +buttercup(1) invokes Emacs. Will be passed to buttercup(1) with its +B<-L> command line argument. + +=item B<DH_ELPA_TEST_BUTTERCUP_PATTERNS> + +A comma-separated list of Emacs regular expressions (not containing +any commas) jointly matching all and only the files containing +Buttercup tests that you wish to run. If this variable is not +defined, all tests that can be found will be run. Will be passed to +buttercup(1) with its B<-p> command line argument. + +=item B<DH_ELPA_TEST_ERT_EXCLUDE> + +A comma-separated list of file globs matching files containing ERT +tests that should not be run. + +=item B<DH_ELPA_TEST_ERT_HELPER> + +The name of a *.el file containing Emacs Lisp code that will run the +ERT test suite. When this variable is not defined, B<dh_elpa_test> +calls the function B<(ert-run-tests-batch-and-exit)>. + +=item B<DH_ELPA_TEST_ERT_EVAL> + +Emacs Lisp code to be run prior to running ERT tests by the Emacs +instance spawned by B<dh_elpa_test> to run those tests. + +=item B<DH_ELPA_TEST_ERT_LOAD_PATH> + +A comma-separated list of directories to add to the load-path when +B<dh_elpa_test> invokes Emacs to run ERT tests. + +=back + +=cut + +use Text::Glob qw{ match_glob }; +use Array::Utils qw{ array_minus }; + +use Debian::Debhelper::Dh_Lib; +use Debian::Control; + +if (get_buildoption("nocheck")) { + exit 0; +} + +my $control = Debian::Control->new(); +$control->read("debian/control"); + +# 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"; +my $elpadir="/usr/share/emacs/site-lisp/elpa-src"; + +# ---- Buttercup + +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'})) { + push @args, ('-L', "$dir"); + } + } + if (defined $ENV{'DH_ELPA_TEST_BUTTERCUP_PATTERNS'}) { + foreach my $pattern (split(',', $ENV{'DH_ELPA_TEST_BUTTERCUP_PATTERNS'})) { + push @args, ('-p', "$pattern"); + } + } + print_and_doit(@args); +} + +# ---- ERT + +$Text::Glob::strict_wildcard_slash = 0; +my @ert_files = map { s|^\./||r } split("\n", `grep -lr "ert-deftest" .`); +if (defined $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'}) { + foreach my $glob (split(',', $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'})) { + if ( my @matches = match_glob( $glob, @ert_files ) ) { + @ert_files = array_minus( @ert_files, @matches ); + } + } +} + +if (@ert_files) { + my @args = qw{ emacs -batch -Q -l package }; + push @args, ("--eval", "(add-to-list 'package-directory-list \"$dhelpadir\")"); + push @args, ("--eval", "(add-to-list 'package-directory-list \"$elpadir\")"); + push @args, ("-f", "package-initialize"); + + # work around the fact that s-el and dash-el are not packages with + # dh_elpa so aren't in $dhelpadir + push @args, ("-L", "/usr/share/emacs/site-lisp/s-el") + if ($control->source->Build_Depends->has( "s-el" )); + push @args, ("-L", "/usr/share/emacs/site-lisp/dash-el") + if ($control->source->Build_Depends->has( "dash-el" )); + + push @args, ("--eval", "$ENV{'DH_ELPA_TEST_ERT_EVAL'}") + if (defined $ENV{'DH_ELPA_TEST_ERT_EVAL'}); + foreach my $ert_file (@ert_files) { + push @args, ("-l", "$ert_file"); + } + if (defined $ENV{'DH_ELPA_TEST_ERT_LOAD_PATH'}) { + foreach my $dir (split(',', $ENV{'DH_ELPA_TEST_ERT_LOAD_PATH'})) { + push @args, ('-L', "$dir"); + } + } + if (defined $ENV{'DH_ELPA_TEST_ERT_HELPER'}) { + push @args, ("-l", "$ENV{'DH_ELPA_TEST_ERT_HELPER'}"); + } else { + push @args, ("--eval", "(ert-run-tests-batch-and-exit)"); + } + + print_and_doit(@args); +} + +=head1 EXAMPLES + +Here is an example of using the helper in a dh(1) style debian/rules + +=over 4 + + #!/usr/bin/make -f + + export DH_ELPA_TEST_BUTTERCUP_LOAD_PATH=lib,other_lib + + %: + dh $@ --with elpa_plus_test + +=back + +=cut diff --git a/elpa_plus_test.pm b/elpa_plus_test.pm new file mode 100755 index 0000000..f56d60d --- /dev/null +++ b/elpa_plus_test.pm @@ -0,0 +1,13 @@ +#!/usr/bin/perl +# debhelper sequence file for dh_elpa_test script + +use warnings; +use strict; +use Debian::Debhelper::Dh_Lib; + +insert_after("dh_install", "dh_elpa"); +# insert_after("dh_auto_test", "dh_elpa_test"); # test suite gets run more than once +add_command("dh_elpa_test", "build"); +remove_command("dh_auto_test"); + +1; |