summaryrefslogtreecommitdiff
path: root/dh-elpa.el
diff options
context:
space:
mode:
Diffstat (limited to 'dh-elpa.el')
-rw-r--r--dh-elpa.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/dh-elpa.el b/dh-elpa.el
index cd28770..2ec58fc 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -119,7 +119,10 @@ 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)))
+ (unless (file-exists-p
+ (expand-file-name (package--description-file elpa-dir) elpa-dir))
+ (dhelpa-generate-pkg-file elpa-dir))
+ (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))
@@ -137,4 +140,22 @@ specifies time to use in generated autoloads files."
(delete-file tar-file)
(delete-directory temp-dir))))))
+(defun dhelpa-generate-pkg-file (pkg-dir)
+ "Generate PKG-DIR/foo-pkg.el by consulting PKG-DIR/foo.el."
+ (let* ((pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir))
+ (root-file (replace-regexp-in-string "-pkg" "" pkg-file))
+ (pkg-desc
+ (condition-case nil
+ (with-temp-buffer
+ (find-file root-file)
+ (package-buffer-info))
+ (error (progn
+ (message "dh_elpa: couldn't generate -pkg file; please write one")
+ (kill-emacs -1))))))
+ ;; although the docstring for `package-generate-description-file'
+ ;; says that it generates a description for single-file packages,
+ ;; there is in fact no difference between the descriptions for
+ ;; single-file and multifile packages
+ (package-generate-description-file pkg-desc pkg-file)))
+
;;; dh-elpa.el ends here