diff options
author | David Bremner <bremner@debian.org> | 2015-09-19 10:50:40 -0300 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2015-09-19 10:50:40 -0300 |
commit | f5e8269e142b76f8c3053db88ac8d3ef15aa16ba (patch) | |
tree | e1bfeeb96829ccfabe963e94389c0fb5c8e7b0cc | |
parent | bba12d529c40cf88e4cb3780c082da61f01e1eda (diff) |
version 0.0.10: compute version number from lisp source.
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | dh-elpa.el | 32 | ||||
-rwxr-xr-x | dh_elpa | 38 |
3 files changed, 60 insertions, 17 deletions
diff --git a/debian/changelog b/debian/changelog index 8408d67..aed44ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +dh-elpa (0.0.10) unstable; urgency=medium + + * Take elpa version from lisp source (Closes: #799032). + Thanks to Thomas Koch for the report. + + -- David Bremner <bremner@debian.org> Sat, 19 Sep 2015 10:49:28 -0300 + dh-elpa (0.0.9) unstable; urgency=medium * Bug fix: "dh-elpa should provide substvar for depends field", thanks @@ -66,6 +66,14 @@ tar file) into second command line argument (a directory)" (dhelpa-install-file dest el-file))) ;;;###autoload +(defun dhelpa-batch-install-directory () + "Install third command line argument (a directory containing a +multifile elpa package) into second command line argument (a +directory). An optional third command line argument specifies +where to make temporary files." + (apply #'dhelpa-install-directory command-line-args-left)) + +;;;###autoload (defun dhelpa-install-file (dest el-file) "Install second argument (an emacs lisp file or tar file) into first command line argument (a directory)" @@ -74,4 +82,28 @@ first command line argument (a directory)" (when (string-match "\\.tar\\'" el-file) (tar-mode)) (dhelpa-install-from-buffer (expand-file-name dest)))) +;;;###autoload +(defun dhelpa-install-directory (dest elpa-dir &optional work-dir) + "Install second argument (an unpacked elpa tarball) into first +command line argument (a directory). The directory must either be +named `package' or `package-version'. If a working directory is +specified, cleaning up is the caller's responsibility." + (let* ((desc (package-load-descriptor elpa-dir))) + (if (not desc) + (message "Could not compute version from directory %s" elpa-dir) + (let* ((canonical-dir (package-desc-full-name desc)) + (base-dir (file-name-nondirectory elpa-dir)) + (parent-dir (file-name-directory elpa-dir)) + (temp-dir (or work-dir (make-temp-file nil t))) + (tar-file (concat (expand-file-name canonical-dir temp-dir) ".tar")) + ;; this relies on GNU tar features. + (transform-command (concat "--transform=s/" + (regexp-quote base-dir) "/" canonical-dir "/"))) + (call-process "tar" nil nil nil "--create" "-C" parent-dir transform-command + "--file" tar-file base-dir) + (dhelpa-install-file dest tar-file) + (unless work-dir + (delete-file tar-file) + (delete-directory temp-dir)))))) + ;;; dh-elpa.el ends here @@ -152,10 +152,18 @@ foreach my $package (@{$dh{DOPACKAGES}}) { my $pkg_file; if (scalar(@files) == 1) { - $pkg_file=$files[0]; + my $pkg_file=$files[0]; + + doit_quietly(qw{emacs -batch -Q -l package}, + '--eval',"(add-to-list 'package-directory-list \"$dhelpadir\")", + '--eval',"(add-to-list 'package-directory-list \"$elpadir\")", + qw{-f package-initialize -l dh-elpa.el}, + qw{-f dhelpa-batch-install-file}, "$tmp/$elpadir", $pkg_file); + } else { my $cwd = getcwd(); my $tempdir = "${cwd}/debian/.debhelper/elpa"; + my $stagedir = "$tempdir/$elpapkg"; { require File::Path; File::Path::rmtree $tempdir || @@ -163,30 +171,26 @@ foreach my $package (@{$dh{DOPACKAGES}}) { File::Path::make_path $tempdir || error "creating $tempdir"; - } - my $version = $dh{VERSION} or error "version not found!"; - $version =~ s/-[^-]+//; # strip Debian version - my $pkg_dir = "$elpapkg-$version"; - $pkg_file = "$tempdir/$pkg_dir.tar"; - mkdir "$tempdir/$pkg_dir" or error "$!"; + File::Path::make_path $stagedir || + error "creating $stagedir"; + } - # copy files into tempdir, flattening hierarchy + # copy files into stagedir, flattening hierarchy # TODO: do this more correctly foreach my $el_file (@files) { - doit("cp", "-a", $el_file, "$tempdir/$pkg_dir"); + doit("cp", "-a", $el_file, "$stagedir"); } - chdir $tempdir or die "$!"; - doit("tar","cf",$pkg_file,$pkg_dir); - chdir $cwd or die "$!"; + doit_quietly(qw{emacs -batch -Q -l package}, + '--eval',"(add-to-list 'package-directory-list \"$dhelpadir\")", + '--eval',"(add-to-list 'package-directory-list \"$elpadir\")", + qw{-f package-initialize -l dh-elpa.el}, + qw{-f dhelpa-batch-install-directory}, + "$tmp/$elpadir", $stagedir, $tempdir); + } - doit_quietly(qw{emacs -batch -Q -l package}, - '--eval',"(add-to-list 'package-directory-list \"$dhelpadir\")", - '--eval',"(add-to-list 'package-directory-list \"$elpadir\")", - qw{-f package-initialize -l dh-elpa.el}, - qw{-f dhelpa-batch-install-file}, "$tmp/$elpadir", $pkg_file); } =head1 EXAMPLES |