diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2016-04-03 14:15:11 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-04-03 14:15:11 -0700 |
commit | 8298882c7bc847892dd3044cf06fad54e5d020aa (patch) | |
tree | cf0978a57427e99173cb843db7deff2b1c545a93 /lib | |
parent | 6097497e420f6567319e9a8bf8b92d74c615edfd (diff) |
fix find_bins & create_elpa
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DhMakeELPA/Command/Packaging.pm | 14 | ||||
-rw-r--r-- | lib/DhMakeELPA/MELPA.pm | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm index 77898af..c98334c 100644 --- a/lib/DhMakeELPA/Command/Packaging.pm +++ b/lib/DhMakeELPA/Command/Packaging.pm @@ -7,6 +7,7 @@ use Cwd; use File::Basename qw{basename}; use File::Grep qw{fgrep}; use Array::Utils qw{array_minus}; +use DhMakeELPA::MELPA; use base 'DhMakePerl::Command::Packaging'; @@ -37,25 +38,26 @@ EOF sub find_bins { my $self = shift; - my @el_files = glob("$self->main_dir/*.el"); - my @pkg_files = glob("$self->main_dir/*-pkg.el"); + 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) { my $bin = $el_files[0] =~ s/\.el$//r; $self->bins({ "$bin" => ("*.el") }); } else { + $self->bins({}); # there could be -pkg.el files that don't have an associated .el # file (e.g. helm-core-pkg.el) so add those back in to the list # we're going to check @el_files = (@el_files, grep { $_ =~ s/-pkg//; ! -f $_} @pkg_files); foreach my $el (@el_files) { my $pkg = $el =~ s/\.el$/-pkg.el/r; - my $name = $el =~ s/\.el$//; + my $name = basename($el) =~ s/\.el$//r; # see if this package is a root package file: either it has an # accompanying -pkg.el, or it contains a Package-Version: line if (-f "$pkg" || fgrep { /^;; Package-Version:/ } $el) { - my $files = DhMakeELPA::MELPA::package_files_list($name); - $self->bins->{"$name"} = \$files; + my @files = package_files_list($name); + $self->bins->{$name} = \@files; } } } @@ -70,7 +72,7 @@ sub create_elpa { } else { foreach my $bin ( keys %{$self->bins} ) { my @files = @{$self->bins->{$bin}}; - my $fh = $self->_file_w( $self->debian_file('elpa-$bin.elpa') ); + my $fh = $self->_file_w( $self->debian_file("elpa-$bin.elpa") ); foreach my $file (@files) { $fh->print("$file\n"); } diff --git a/lib/DhMakeELPA/MELPA.pm b/lib/DhMakeELPA/MELPA.pm index 4f4bde6..ab70568 100644 --- a/lib/DhMakeELPA/MELPA.pm +++ b/lib/DhMakeELPA/MELPA.pm @@ -12,6 +12,9 @@ DhMakeELPA::MELPA - functions to interact with MELPA use Array::Utils qw{array_minus}; use LWP::Simple qw{get}; +use Exporter qw(import); +our @EXPORT = qw(package_files_list); + =head1 METHODS =over |