path: root/dh-elpa.el
diff options
authorDavid Bremner <>2015-09-22 08:00:57 -0300
committerDavid Bremner <>2015-09-22 08:18:38 -0300
commit568f88f1a78d762880d89b0a65988d9f75ad9257 (patch)
tree4b44a23397921d4e5ef05bce8f1a0e565120c504 /dh-elpa.el
parentb48dba8223834d0f077370798609968a98ff972d (diff)
replace writing of version file with call dhelpa-write-desc
This also writes the metadata from both the single file package and the multi-file package code-path
Diffstat (limited to 'dh-elpa.el')
1 files changed, 13 insertions, 15 deletions
diff --git a/dh-elpa.el b/dh-elpa.el
index 5f799b9..a0385c9 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -69,28 +69,31 @@ packaging guidelines; see info node `(elisp)Packaging'."
(defun dhelpa-batch-install-file ()
- "Install third command line argument (an emacs lisp file or
-tar file) into second command line argument (a directory)"
- (let ((dest (car command-line-args-left))
- (el-file (cadr command-line-args-left)))
- (dhelpa-install-file dest el-file)))
+ "Install third command line argument (an emacs lisp file or tar
+file) into second command line argument (a directory). The
+optional fourth argument specifies a destination for a package
+description file."
+ (apply #'dhelpa-install-file command-line-args-left))
(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."
+where to make temporary files and write a descriptor file."
(apply #'dhelpa-install-directory command-line-args-left))
-(defun dhelpa-install-file (dest el-file)
+(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)"
+first command line argument (a directory). The optional third
+argument specifies where to write a simplified package description file."
(insert-file-contents-literally el-file)
(when (string-match "\\.tar\\'" el-file) (tar-mode))
- (dhelpa-install-from-buffer (expand-file-name dest))))
+ (let ((desc (dhelpa-install-from-buffer (expand-file-name dest))))
+ (when desc-dir
+ (dhelpa-write-desc desc desc-dir)))))
(defun dhelpa-install-directory (dest elpa-dir &optional work-dir)
@@ -102,21 +105,16 @@ specified, cleaning up is the caller's responsibility."
(if (not desc)
(message "Could not compute version from directory %s" elpa-dir)
(let* ((canonical-dir (package-desc-full-name desc))
- (elpa-name (package-desc-name desc))
- (elpa-version (package-version-join (package-desc-version 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)))
- (version-file (expand-file-name (format "%s.version" elpa-name) temp-dir))
(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)
- (when work-dir
- (with-temp-file version-file (insert elpa-version)))
- (dhelpa-install-file dest tar-file)
+ (dhelpa-install-file dest tar-file work-dir)
(unless work-dir
(delete-file tar-file)
(delete-directory temp-dir))))))