[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa-admin 842d54c 056/439: * admin/archive-contents.el (batch-
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa-admin 842d54c 056/439: * admin/archive-contents.el (batch-make-site-dir, archive--write-pkg-file): New functions. |
Date: |
Sun, 17 Oct 2021 15:47:33 -0400 (EDT) |
branch: elpa-admin
commit 842d54cdda580f138c44db06a468e32d1f5923cc
Author: Chong Yidong <cyd@stupidchicken.com>
Commit: Chong Yidong <cyd@stupidchicken.com>
* admin/archive-contents.el (batch-make-site-dir, archive--write-pkg-file):
New functions.
---
admin/archive-contents.el | 81 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 71 insertions(+), 10 deletions(-)
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index 1c4d1a1..21e5733 100644
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -1,4 +1,4 @@
-;;; archive-contents.el --- Auto-generate the `archive-contents' file
+;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive.
;; Copyright (C) 2011 Free Software Foundation, Inc
@@ -59,10 +59,10 @@ Otherwise return nil."
(dolist (dir (directory-files default-directory nil archive-re-no-dot))
(condition-case v
(if (not (file-directory-p dir))
- 1;(error "Skipping non-package file %s" dir)
+ (error "Skipping non-package file %s" dir)
(let* ((pkg (file-name-nondirectory dir))
(autoloads-file (expand-file-name (concat pkg
"-autoloads.el") dir))
- simple-p version)
+ simple-p)
;; Omit autoloads and .elc files from the package.
(if (file-exists-p autoloads-file)
(delete-file autoloads-file))
@@ -143,13 +143,7 @@ package commentary to PKG-readme.txt. Return the
descriptor."
"Deploy the contents of DIR into the archive as a multi-file package.
Rename DIR/ to PKG-VERS/, and write the package commentary to
PKG-readme.txt. Return the descriptor."
- (let* ((pkg-file (expand-file-name (concat pkg "-pkg.el") dir))
- (exp
- (with-temp-buffer
- (unless pkg-file (error "File not found: %s" pkg-file))
- (insert-file-contents pkg-file)
- (goto-char (point-min))
- (read (current-buffer))))
+ (let* ((exp (archive--multi-file-package-def dir pkg))
(vers (nth 2 exp))
(req (mapcar 'archive--convert-require (nth 4 exp)))
(readme (expand-file-name "README" dir)))
@@ -162,6 +156,73 @@ PKG-readme.txt. Return the descriptor."
(rename-file dir (concat pkg "-" vers))
(cons (intern pkg) (vector (version-to-list vers) req (nth 3 exp) 'tar))))
+(defun archive--multi-file-package-def (dir pkg)
+ "Reurn the `define-package' form in the file DIR/PKG-pkg.el."
+ (let ((pkg-file (expand-file-name (concat pkg "-pkg.el") dir)))
+ (with-temp-buffer
+ (unless (file-exists-p pkg-file)
+ (error "File not found: %s" pkg-file))
+ (insert-file-contents pkg-file)
+ (goto-char (point-min))
+ (read (current-buffer)))))
+
+(defun batch-make-site-dir (package-dir site-dir)
+ (require 'package)
+ (setq package-dir (expand-file-name package-dir default-directory))
+ (setq site-dir (expand-file-name site-dir default-directory))
+ (dolist (dir (directory-files package-dir t archive-re-no-dot))
+ (condition-case v
+ (if (not (file-directory-p dir))
+ (error "Skipping non-package file %s" dir)
+ (let* ((pkg (file-name-nondirectory dir))
+ (autoloads-file (expand-file-name (concat pkg "-autoloads.el")
dir))
+ simple-p version)
+ ;; Omit autoloads and .elc files from the package.
+ (if (file-exists-p autoloads-file)
+ (delete-file autoloads-file))
+ (archive--delete-elc-files dir)
+ ;; Test whether this is a simple or multi-file package.
+ (setq simple-p (archive--simple-package-p dir pkg))
+ (if simple-p
+ (progn
+ (apply 'archive--write-pkg-file dir pkg simple-p)
+ (setq version (car simple-p)))
+ (setq version
+ (nth 2 (archive--multi-file-package-def dir pkg))))
+ (make-symbolic-link (expand-file-name dir package-dir)
+ (expand-file-name (concat pkg "-" version)
+ site-dir)
+ t)
+ (package-generate-autoloads pkg dir)
+ (let ((load-path (cons dir load-path)))
+ (byte-recompile-directory dir 0 t))))
+ ;; Error handler
+ (error (message "%s" (cadr v))))))
+
+(defun archive--write-pkg-file (pkg-dir name version desc requires &rest
ignored)
+ (let ((pkg-file (expand-file-name (concat name "-pkg.el") pkg-dir))
+ (print-level nil)
+ (print-length nil))
+ (write-region
+ (concat (format ";; Generated package description from %s.el\n"
+ name)
+ (prin1-to-string
+ (list 'define-package
+ name
+ version
+ desc
+ (list 'quote
+ ;; Turn version lists into string form.
+ (mapcar
+ (lambda (elt)
+ (list (car elt)
+ (package-version-join (cadr elt))))
+ requires))))
+ "\n")
+ nil
+ pkg-file)))
+
+
;; Local Variables:
;; no-byte-compile: t
;; lexical-binding: t
- [nongnu] elpa-admin f08292f 152/439: * admin/archive-contents.el: Don't stop at the first incorrect version string., (continued)
- [nongnu] elpa-admin f08292f 152/439: * admin/archive-contents.el: Don't stop at the first incorrect version string., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin faf7826 158/439: publish ada-mode 5.1.6, wisi 1.0.6, new package ada-ref-man, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 6ab28f9 156/439: drop Emacs dependency to 24.3, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 79849d3 167/439: Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 779c1d2 165/439: Add 'packages/loc-changes/' from commit '8447baff7cb4839ef8d1d747a14e5da85d0cee5b', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 345dc39 189/439: * GNUmakefile: Use LC_ALL rather than LANG, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin d079afa 187/439: Squashed 'packages/pinentry/' changes from 075deb6..b3a45a5, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 97cad46 171/439: Merge commit '3fa56d7925d5b24c5cd11c61bd6b3235e753a055', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 4a3a7c2 193/439: * README: Improve subtree instructions, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 2307841 196/439: * README: Expand instructions, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 842d54c 056/439: * admin/archive-contents.el (batch-make-site-dir, archive--write-pkg-file): New functions.,
Philip Kaludercic <=
- [nongnu] elpa-admin 3afe3ac 060/439: Use org-mode markup in README and rename it to README.org, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 49382d4 067/439: Some tweaks to README, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 49fce77 070/439: Rename README to README.rst, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 303f2c9 075/439: * admin/archive-contents.el (batch-make-site-package): New function., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin febff3e 079/439: Make README more up-to-date, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 6ba7e63 077/439: Try to preserve timestamps. Fix ChangeLog generation., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin bffc4a6 090/439: Don't create local branches, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 480283a 089/439: Move check_copyright to the makefile, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 81a6a01 088/439: Fix up scripts to build archive from Git, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 90851ae 086/439: Get "make -k" to go through, Philip Kaludercic, 2021/10/17