diff options
author | David Bremner <bremner@debian.org> | 2015-12-19 13:01:18 -0400 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2015-12-19 13:20:25 -0400 |
commit | 97993eabb761c12dbe3448c17bce28a8f6c84e8b (patch) | |
tree | b81bc47c25c478a4c35942aa1bdc28e9e94649d8 | |
parent | 5dc6e1ab317985839dfe57b97b59650d415a02a7 (diff) |
add optional epoch-time argument up the call chain.
Most of this change is docstring updates.
-rw-r--r-- | dh-elpa.el | 40 |
1 files changed, 23 insertions, 17 deletions
@@ -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)))))) |