summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog16
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm17
-rw-r--r--lib/DhMakeELPA/Command/make.pm23
3 files changed, 50 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog
index fbf4579..c95aa9a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+dh-make-elpa (0.3.0) experimental; urgency=medium
+
+ * Generate standards version 3.9.8.
+ * Binary dependencies on dash-el and s-el detected and added.
+ * find_bins() now never fails to populate the bins hash.
+ Falls back to a single binary package.
+ * find_bins() always populates the values of the bins hash with list
+ references.
+ Previously, in the case of a single binary package, it was inserting a
+ string rather than a list reference.
+ * Use getcwd() rather than relying on the PWD env var.
+ Thanks to Dmitry Bogatov for reporting the problem, which occurs with
+ the rc interactive shell.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Fri, 24 Jun 2016 17:31:04 +0900
+
dh-make-elpa (0.2.0) experimental; urgency=medium
* Fix Vcs-Git: URI.
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index d992ae2..815a19a 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -19,7 +19,7 @@ __PACKAGE__->mk_accessors(
qw( main_dir debian_dir bins control pkgname homepage elpa_version copyright gpl_version )
);
-use constant debstdversion => '3.9.7';
+use constant debstdversion => '3.9.8';
sub extract_basic {
my $self = shift;
@@ -71,9 +71,15 @@ sub find_bins {
my @el_files = glob($self->main_dir . "/*.el");
my @pkg_files = glob($self->main_dir . "/*-pkg.el");
@el_files = array_minus( @el_files, @pkg_files );
- if (@el_files == 1) {
+ # try to ensure that the 'root' .el file is at the front of the list
+ @el_files = sort { length $a cmp length $b } @el_files;
+ my $single_bin = sub {
my $bin = basename($el_files[0]) =~ s/\.el$//r;
- $self->bins({ "$bin" => ("*.el") });
+ $self->bins({ "$bin" => ["*.el"] });
+ };
+
+ if (@el_files == 1) {
+ &$single_bin();
} else {
$self->bins({});
# there could be -pkg.el files that don't have an associated .el
@@ -90,6 +96,11 @@ sub find_bins {
$self->bins->{$name} = \@files;
}
}
+ # fallback: if we failed to figure out the bins, just use a
+ # single one
+ if ( scalar %{$self->bins} eq 0) {
+ &$single_bin();
+ }
}
}
diff --git a/lib/DhMakeELPA/Command/make.pm b/lib/DhMakeELPA/Command/make.pm
index 3f7818d..d22ca0e 100644
--- a/lib/DhMakeELPA/Command/make.pm
+++ b/lib/DhMakeELPA/Command/make.pm
@@ -2,10 +2,13 @@ package DhMakeELPA::Command::make;
use strict;
use warnings;
+no warnings "experimental::smartmatch";
use Debian::Control;
use File::Spec::Functions qw(catfile);
use Email::Date::Format qw(email_date);
+use File::Grep qw(fgrep);
+use Cwd;
use base 'DhMakeELPA::Command::Packaging';
@@ -13,7 +16,7 @@ sub execute {
my $self = shift;
# extract basic information from package
- $self->main_dir($ENV{'PWD'});
+ $self->main_dir(getcwd());
$self->extract_basic;
# initial sanity check
@@ -57,10 +60,24 @@ sub create_control {
$self->fill_vcs();
foreach my $bin (keys %{$self->bins}) {
- my ($short_desc, $long_desc) = $self->extract_description( $self->main_file("$bin.el") );
+ my @files = @{$self->bins->{$bin}};
+ # resolve special case so we can use fgrep
+ @files = glob($self->main_dir . "/*.el")
+ if ( @files ~~ ["*.el"] );
+
+ my ($short_desc, $long_desc) =
+ $self->extract_description( $self->main_file("$bin.el") );
+ my $depends = '${misc:Depends}, emacs, ${elpa:Depends}';
+
+ # append depends that aren't included in ${elpa:Depends}
+ $depends .= ", dash-el"
+ if fgrep { /^;; Package-Requires: .*\(dash \"/ } @files;
+ $depends .= ", s-el"
+ if fgrep { /^;; Package-Requires: .*\(s \"/ } @files;
+
my $stanza = { Package => "elpa-$bin",
Architecture => "all",
- Depends => '${misc:Depends}, emacs, ${elpa:Depends}',
+ Depends => "$depends",
Built_Using => '${misc:Built-Using}',
Recommends => "emacs (>= 46.0)",
Enhances => "emacs, emacs24",