summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-06-24 16:55:50 +0900
committerSean Whitton <spwhitton@spwhitton.name>2016-06-24 16:56:10 +0900
commitbe8316a5a026642103b5e978ca549409d42d525b (patch)
tree54cf4575343eb3c041bd643a48a94d038fd65d2f /lib
parent02025a26bd3ef54cac1685817744eebbe7d4c1f2 (diff)
find_bins fallback
Diffstat (limited to 'lib')
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index 00eef51..b01d6cb 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -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") });
+ };
+
+ 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();
+ }
}
}