summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <bremner@debian.org>2018-09-21 22:23:03 -0300
committerDavid Bremner <bremner@debian.org>2018-09-23 16:38:52 -0300
commitd688f395fc4a47bbd2c30761138b0b56a2d8d796 (patch)
tree83cd7e57c7e6bad947209e9e89c61046b4cdbc52
parentfd160606fdf7e316d6ad776f0d00909fc1514593 (diff)
Support optional preservation of relative paths in debian/elpa
This is mainly intended to support non-emacs-lisp support files needed by elpa packages.
-rw-r--r--debian/changelog6
-rwxr-xr-xdh_elpa.in51
2 files changed, 46 insertions, 11 deletions
diff --git a/debian/changelog b/debian/changelog
index d19c16c..a652b86 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+dh-elpa (1.15) UNRELEASED; urgency=medium
+
+ * Support optional destination subdirectory in d/elpa (Closes: #909307).
+
+ -- David Bremner <bremner@debian.org> Sun, 23 Sep 2018 14:30:31 -0300
+
dh-elpa (1.14) unstable; urgency=medium
[ Nicholas D Steeves ]
diff --git a/dh_elpa.in b/dh_elpa.in
index df0cbe7..652dfda 100755
--- a/dh_elpa.in
+++ b/dh_elpa.in
@@ -38,7 +38,16 @@ detailed in dh_elpa_test(1).
=item debian/elpa
List of files to be installed into I<package> (respectively into the
-first binary package) as an elpa package.
+first binary package) as an elpa package. The format is a set of
+lines, where each line lists a file or files to install, and at the
+end of the line tells the subdirectory it should be installed in. You
+may use wildcards in the names of the files to install.
+
+If you list exactly one filename or wildcard-pattern on a line by
+itself, with no explicit destination, then B<dh_elpa> will install the
+file into the top level elpa package directory. Only elisp files in
+the top level elpa package directory will be automatically
+byte-compiled.
=item I<elpa-package>-pkg.el
@@ -213,13 +222,26 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
verbose_print("Using elpa package name $elpapkg");
my @files;
+ my @dests;
+ my $is_single_file;
# Call isnative because it sets $dh{VERSION}
# as a side effect.
isnative($package);
if ($file) {
- @files=filearray($file, ".");
- scalar(@files) == 1 || grep { m/\b${elpapkg}-pkg.el$/ } @files or
+ # Don't glob yet, we need to count the words first.
+ @files=filedoublearray($file);
+
+ # On lines with more than one word, the last word is the
+ # destination (sub)directory
+ @dests=map { (@$_ > 1) ? (pop @$_) : undef; } @files;
+
+ # Globexpand any remaining words, leaving them grouped as one array per line.
+ @files=map { map { [ glob_expand(["."], \&glob_expand_error_handler_warn_and_discard, $_) ] } @$_ } @files;
+
+ $is_single_file = (scalar(@files) == 1 && scalar(@{$files[0]}) == 1);
+
+ $is_single_file || grep { $_[0] =~ m/\b${elpapkg}-pkg.el$/ } @files or
warning "missing ${elpapkg}-pkg.el; will try to generate it";
}
if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL})
@@ -251,8 +273,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
File::Path::make_path $tempdir ||
error "creating $tempdir";
- if (scalar(@files) == 1) {
- my $pkg_file=$files[0];
+ if ($is_single_file) {
+ my $pkg_file=$files[0][0];
doit_quietly(qw{emacs -batch -Q -l package},
'--eval',"(add-to-list 'package-directory-list \"$dhelpadir\")",
@@ -261,13 +283,20 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
qw{-f dhelpa-batch-install-file}, "$tmp/$elpadir", $pkg_file, @extra_args);
} else {
my $stagedir = "$tempdir/$elpapkg";
- File::Path::make_path $stagedir ||
- error "creating $stagedir";
+ for (my $i=0; $i<scalar(@files); $i++) {
+ my $targetdir = $stagedir;
+
+ if (defined ($dests[$i])) {
+ verbose_print("dest=$dests[$i]");
+ $targetdir = $stagedir . "/" . $dests[$i];
+ }
+
+ File::Path::make_path $targetdir ||
+ error "creating $targetdir";
- # copy files into stagedir, flattening hierarchy
- # TODO: do this more correctly
- foreach my $el_file (@files) {
- doit("cp", "-a", $el_file, "$stagedir");
+ foreach my $file (@{$files[$i]}) {
+ doit("cp", "-a", $file, "$targetdir");
+ }
}
doit_quietly(qw{emacs -batch -Q -l package},