[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa-admin bcacdba 361/439: * elpa-admin.el: Add `:readme` and
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa-admin bcacdba 361/439: * elpa-admin.el: Add `:readme` and `:news` properties to specifications |
Date: |
Sun, 17 Oct 2021 15:48:36 -0400 (EDT) |
branch: elpa-admin
commit bcacdba842b8c37fed6767bfe8bf5202c0b0f6be
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* elpa-admin.el: Add `:readme` and `:news` properties to specifications
(elpaa--get-section): Take a `pkg-spec` rather than the
name of the main file.
(elpaa--get-README, elpaa--get-NEWS): New functions.
(elpaa--html-make-pkg): Use them.
(elpaa--release-email): Take additional arg `dir`. Append the News.
---
README | 12 ++++++++++++
elpa-admin.el | 56 +++++++++++++++++++++++++++++++++++---------------------
2 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/README b/README
index 0cc8fd9..3a83b70 100644
--- a/README
+++ b/README
@@ -93,6 +93,18 @@ Mapping from the source layout to the layout used in the
tarball.
RENAMES is a list of element (FROM TO) where FROM should terminate with =/=
if it's a directory.
+** =:readme FILE=
+Name of the file to use as the description of the package. By default
+we try to use README, README.rst, README.org, or the Commentary section
+in the main file.
+
+** =:news FILE=
+Name of the file that contains the list of changes in recent versions
+(listed from more recent to least recent).
+By default we try to use NEWS, NEWS.rst, NEWS.md, NEWS.org, the News section
+in the main file.
+
+
* Text below this marker is OUTDATED and still needs to be reviewed/rewritten!!
* Packages
diff --git a/elpa-admin.el b/elpa-admin.el
index dd67eac..058cba5 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -30,8 +30,8 @@
;; Missing more generally:
;; - support for rebuilding index.html, archive-contents, and <pkg>.html
;; - support for building the Info files
-;; - support for README.md for some packages
-;; - support for Tramp as core
+;; - render the README and News in the HTML rather than as <pre> block!
+;; - support for Tramp as core?
;;; Code:
@@ -421,7 +421,7 @@ Return non-nil if a new tarball was created."
(elpaa--make-one-tarball
tarball dir pkg-spec metadata
(lambda () (cdr last-rel)))
- (elpaa--release-email pkg-spec metadata))))))
+ (elpaa--release-email pkg-spec metadata dir))))))
(t
(let ((tarball (concat elpaa--release-subdir
(format "%s-%s.tar" pkgname vers))))
@@ -431,7 +431,7 @@ Return non-nil if a new tarball was created."
(elpaa--get-release-revision
dir pkgname vers
(plist-get (cdr pkg-spec) :version-map))))
- (elpaa--release-email pkg-spec metadata))))))))
+ (elpaa--release-email pkg-spec metadata dir))))))))
(defun elpaa--call (destination program &rest args)
"Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
@@ -696,7 +696,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(insert-file-contents mainsrcfile)
(lm-header prop))))))
-(defun elpaa--get-section (hsection fsection srcdir mainsrcfile)
+(defun elpaa--get-section (hsection fsection srcdir pkg-spec)
(when (consp fsection)
(while (cdr-safe fsection)
(setq fsection
@@ -709,9 +709,9 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(with-temp-buffer
(insert-file-contents (expand-file-name fsection srcdir))
(buffer-string)))
- ((file-readable-p mainsrcfile)
+ ((file-readable-p (elpaa--main-file pkg-spec))
(with-temp-buffer
- (insert-file-contents mainsrcfile)
+ (insert-file-contents (elpaa--main-file pkg-spec))
(emacs-lisp-mode) ;lm-section-start needs the outline-mode setting.
(let ((start (lm-section-start hsection)))
(when start
@@ -730,6 +730,27 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(delete-region (point) (point-max))
(buffer-string)))))))
+(defun elpaa--get-README (pkg-spec dir)
+ (elpaa--get-section
+ "Commentary" (elpaa--spec-get pkg-spec :readme
+ '("README" "README.rst"
+ ;; Most README.md files seem to be currently
+ ;; worse than the Commentary: section :-(
+ ;; "README.md"
+ "README.org"))
+ dir pkg-spec))
+
+(defun elpaa--get-NEWS (pkg-spec dir)
+ (let ((text
+ (elpaa--get-section
+ "News" (elpaa--spec-get pkg-spec :news
+ '("NEWS" "NEWS.rst" "NEWS.md" "NEWS.org"))
+ dir pkg-spec)))
+ (if (< (length text) 4000)
+ text
+ (concat (substring text 0 4000) "...\n...\n"))))
+
+
(defun elpaa--quote (txt)
(replace-regexp-in-string "<" "<"
(replace-regexp-in-string "&" "&" txt)))
@@ -771,7 +792,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(defun elpaa--html-make-pkg (pkg pkg-spec files srcdir)
(let* ((name (symbol-name (car pkg)))
(latest (package-version-join (aref (cdr pkg) 0)))
- (mainsrcfile (expand-file-name (format "%s.el" name) srcdir))
+ (mainsrcfile (expand-file-name (elpaa--main-file pkg-spec) srcdir))
(desc (aref (cdr pkg) 2)))
(cl-assert (equal name (car pkg-spec)))
(with-temp-buffer
@@ -808,14 +829,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(insert (format "<p>To install this package, run in Emacs:</p>
<pre>M-x <span class=\"kw\">package-install</span> RET
<span class=\"kw\">%s</span> RET</pre>"
name))
- ;; FIXME: Use README.md for some packages (such as markdown-mode).
- (let ((rm (elpaa--get-section
- "Commentary" '("README" "README.rst"
- ;; Most README.md files seem to be currently
- ;; worse than the Commentary: section :-(
- ;; "README.md"
- "README.org")
- srcdir mainsrcfile)))
+ (let ((rm (elpaa--get-README pkg-spec srcdir)))
(when rm
(write-region rm nil (concat name "-readme.txt"))
(insert "<h2>Full description</h2><pre>\n" (elpaa--quote rm)
@@ -832,9 +846,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(format-time-string "%Y-%b-%d" (nth 5 attrs))
(elpaa--html-bytes-format (nth 7 attrs)))))))
(insert "</table>\n"))
- (let ((news (elpaa--get-section
- "News" '("NEWS" "NEWS.rst" "NEWS.md" "NEWS.org")
- srcdir mainsrcfile)))
+ (let ((news (elpaa--get-NEWS pkg-spec srcdir)))
(when news
(insert "<h2>News</h2><pre>\n" (elpaa--quote news) "\n</pre>\n")))
(insert "</body>\n")
@@ -1216,7 +1228,7 @@ If WITH-CORE is non-nil, it means we manage :core
packages as well."
;;; Announcement emails
-(defun elpaa--release-email (pkg-spec metadata)
+(defun elpaa--release-email (pkg-spec metadata dir)
(when elpaa--email-to
(with-temp-buffer
(message-mode)
@@ -1227,7 +1239,6 @@ If WITH-CORE is non-nil, it means we manage :core
packages as well."
(To . ,elpaa--email-to)
(Subject . ,(format "[%s ELPA] %s version %s"
elpaa--name name version))))
- ;; FIXME: This message needs to be improved, e.g. with the "NEWS".
(insert "Version " version
" of package " name
" has just been released in " elpaa--name " ELPA.
@@ -1237,6 +1248,9 @@ You can now find it in M-x package-list RET.
" (nth 2 metadata) "
More at " elpaa--url pkgname ".html")
+ (let ((news (elpaa--get-NEWS pkg-spec dir)))
+ (when news
+ (insert "\n\nRecent NEWS:\n\n" news)))
;; (pop-to-buffer (current-buffer)) (debug t)
(message-send)
))))
- [nongnu] elpa-admin e22c225 395/439: * elpa-admin.el (elpaa--fetch): Only show upstream commits, (continued)
- [nongnu] elpa-admin e22c225 395/439: * elpa-admin.el (elpaa--fetch): Only show upstream commits, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 2658af9 345/439: * admin/archive-contents.el: Add preliminary code to fetch upstream updates, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 0b84023 372/439: * elpa-admin.el: Fix confusing uses of word "external", Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 3926bbc 381/439: * elpa-admin.el (elpaa--release-email): Improve the Cc address, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 913bb04 376/439: * GNUmakefile: Rewrite the all-in-place code, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin ceb7580 390/439: * elpa-admin.el (elpaa--sandboxed-ro-binds): Add `/bin`, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 995404d 401/439: * elpa-admin.el: Allow generating autoloads for "unlisted" packages, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 7d65683 356/439: * admin/archive-contents.el: Fix wrong cgit links and support :core somewhat, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 4ade74d 346/439: * README.org: Add license and an introduction., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 922d625 389/439: * GNUmakefile (EMACS): Split out EMACSBIN for convenience, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin bcacdba 361/439: * elpa-admin.el: Add `:readme` and `:news` properties to specifications,
Philip Kaludercic <=
- [nongnu] elpa-admin 311d819 357/439: * GNUmakefile: Fix `-l` args to `emacs` which require an actual file name, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 802b866 394/439: * GNUmakefile (sync-some): New target, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin b3e663b 353/439: Rename ELisp files, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 4b508ad 364/439: * elpa-admin.el: Allow site-local config, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 48e4ccf 388/439: * elpa-admin.el: Don't pass non-existing dirs to `bwrap`, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 12cd68f 386/439: * README.org: Update according to comments from RMS., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin d56a357 416/439: * elpa-admin.el: Don't hide the log of diverged packages in `fetch/<pkg>`, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin e79cce6 382/439: * elpa-admin.el (elpaa--get-section): Fix fetching from main file, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 2b93ca3 363/439: * elpa-admin.el: Add support for building Texi from Org., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin b776ff9 408/439: * elpa-admin.el (elpaa--prune-old-tarballs): Move the .sig files as well, Philip Kaludercic, 2021/10/17