[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin 842d54c 056/357: * admin/archive-contents.el (batch-ma
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin 842d54c 056/357: * admin/archive-contents.el (batch-make-site-dir, archive--write-pkg-file): New functions. |
Date: |
Thu, 10 Dec 2020 18:06:14 -0500 (EST) |
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
- [elpa] elpa-admin 5bbab91 030/357: * packages/all-1.0.el: Change version. Address byte-compiler warnings., (continued)
- [elpa] elpa-admin 5bbab91 030/357: * packages/all-1.0.el: Change version. Address byte-compiler warnings., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin ab46aeb 014/357: Relative loads for Emacs Lisp files. Adds functions __FILE__ and, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin d656221 020/357: Track original positions in the face of possible edits. Intended use in debugging where one might edit the file but continue editing., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 015e981 004/357: # Added comment about loading supplied classes separately., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 5bb5972 016/357: load-relative.el: Add provide-me and make GPL v3., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 8b07a20 027/357: * README: Explain how to run the repo build script., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 07ef2ff 033/357: Add README file, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 7b9d56b 038/357: README: Move copyright and license text to the end, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 50b05c8 074/357: Add SML-mode., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 4866cb7 057/357: admin/archive-contents.el (archive--delete-elc-files): Delete backup files too., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 842d54c 056/357: * admin/archive-contents.el (batch-make-site-dir, archive--write-pkg-file): New functions.,
Stefan Monnier <=
- [elpa] elpa-admin becd7be 063/357: * archive-contents.el (archive--make-changelog): New fun., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 33a5782 042/357: Ensure case-fold-search=t in the example email detect function, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin cff4ab8 045/357: Add a note for programmers about wcheck-marked-text-at, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 3afe3ac 060/357: Use org-mode markup in README and rename it to README.org, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin dc8ca2b 072/357: Note availability of Melpa packages, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin e5ad0fa 044/357: Rephrase examples, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 518362a 073/357: Merge pull request #13 from dgutov/master, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin c51af29 058/357: Reorganize repository layout, allowing site installation., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin e148a06 052/357: Put quotes `...' around the example function add-word-to-dictionary, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 6ba7e63 077/357: Try to preserve timestamps. Fix ChangeLog generation., Stefan Monnier, 2020/12/10