summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dh-elpa.el40
1 files changed, 23 insertions, 17 deletions
diff --git a/dh-elpa.el b/dh-elpa.el
index 0d31a99..5ffa6f5 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -28,7 +28,9 @@
;; Originally package-unpack from package.el in Emacs 24.5
(defun dhelpa-unpack (pkg-desc destdir &optional epoch-time)
- "Install the contents of the current buffer as a package."
+ "Install the contents of the current buffer into DESTDIR as a package.
+Optional argument EPOCH-TIME specifies time to use in autoload
+files; if unspecifed or nil the current time is used."
(let* ((name (package-desc-name pkg-desc))
(dirname (package-desc-full-name pkg-desc))
(pkg-dir (expand-file-name dirname destdir))
@@ -63,15 +65,18 @@
(insert (format "ELPA-Version: %s\n" version)))))
;;;###autoload
-(defun dhelpa-install-from-buffer (destdir)
- "Install a package from the current buffer.
-The current buffer is assumed to be a single .el or .tar file that follows the
-packaging guidelines; see info node `(elisp)Packaging'."
+(defun dhelpa-install-from-buffer (destdir &optional epoch-time)
+ "Install a package from the current buffer into DESTDIR.
+The current buffer is assumed to be a single .el or .tar file
+that follows the packaging guidelines; see info
+node `(elisp)Packaging'. If EPOCH-TIME is non-nil, it specifies
+the time (in seconds since the epoch to be used in the generated
+autoload files."
(interactive "D")
(let ((pkg-desc (if (derived-mode-p 'tar-mode)
(package-tar-file-info)
(package-buffer-info))))
- (dhelpa-unpack pkg-desc destdir)
+ (dhelpa-unpack pkg-desc destdir epoch-time)
pkg-desc))
;;;###autoload
@@ -91,23 +96,24 @@ where to make temporary files and write a descriptor file."
(apply #'dhelpa-install-directory command-line-args-left))
;;;###autoload
-(defun dhelpa-install-file (dest el-file &optional desc-dir)
- "Install second argument (an emacs lisp file or tar file) into
-first command line argument (a directory). The optional third
-argument specifies where to write a simplified package description file."
+(defun dhelpa-install-file (dest el-file &optional desc-dir epoch-time)
+ "Install EL-FILE (an emacs lisp file or tar file) into DEST (a directory).
+Optional DESC-DIR specifies where to write a simplified package description file.
+Optional EPOCH-TIME specifies time to use in the generated autoload files."
(with-temp-buffer
(insert-file-contents-literally el-file)
(when (string-match "\\.tar\\'" el-file) (tar-mode))
- (let ((desc (dhelpa-install-from-buffer (expand-file-name dest))))
+ (let ((desc (dhelpa-install-from-buffer (expand-file-name dest) epoch-time)))
(when desc-dir
(dhelpa-write-desc desc desc-dir)))))
;;;###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."
+(defun dhelpa-install-directory (dest elpa-dir &optional work-dir epoch-time)
+ "Install ELPA-DIR (an unpacked elpa tarball) into DEST (a directory).
+The directory must either be named `package' or
+`package-version'. If a working directory WORK-DIR is specified,
+cleaning up is the caller's responsibility. Optional EPOCH-TIME
+specifies time to use in generated autoloads files."
(let* ((desc (package-load-descriptor elpa-dir)))
(if (not desc)
(message "Could not compute version from directory %s" elpa-dir)
@@ -121,7 +127,7 @@ specified, cleaning up is the caller's responsibility."
(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 work-dir)
+ (dhelpa-install-file dest tar-file work-dir epoch-time)
(unless work-dir
(delete-file tar-file)
(delete-directory temp-dir))))))