[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin a8b876c 207/357: * admin/archive-contents.el: Make :co
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin a8b876c 207/357: * admin/archive-contents.el: Make :core handling optional |
Date: |
Thu, 10 Dec 2020 18:06:44 -0500 (EST) |
branch: elpa-admin
commit a8b876c933f3dda2fc43353563eac964641e1194
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* admin/archive-contents.el: Make :core handling optional
(archive--sync-emacs-repo): Drop support for $EMACS_CLONE_REFERENCE and
don't auto-use ../emacs/master if present.
(archive--insert-repolinks): Mark arg as unused.
(archive--metadata): Remove unused var `pv'.
---
README | 3 +-
admin/archive-contents.el | 73 +++++++++++++++++++++--------------------------
2 files changed, 35 insertions(+), 41 deletions(-)
diff --git a/README b/README
index b3e2b7b..7c5cd36 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Copyright (C) 2010-2011, 2014 Free Software Foundation, Inc.
+Copyright (C) 2010-2011, 2014, 2015 Free Software Foundation, Inc.
See the end of the file for license conditions.
@@ -237,6 +237,7 @@ packages/ directory. You can then add that directory, e.g.
with:
** To deploy the package repository as a remotely-accessible archive:
git clone .../elpa
+ (cd elpa; git clone .../emacs) #If you want to generate :core packages.
mkdir build
cd build
(cd ../elpa; git log --format=%H | tail -n 1) >.changelog-witness
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index 2181aba..ae46435 100755
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -179,7 +179,6 @@ PKG is the name of the package and DIR is the directory
where it is."
(error "Can't parse first line of %s" mainfile)
;; Grab the other fields, which are not mandatory.
(let* ((description (match-string 1))
- (pv )
(version
(or (lm-header "package-version")
(lm-header "version")
@@ -421,7 +420,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(replace-regexp-in-string "<" "<"
(replace-regexp-in-string "&" "&" txt)))
-(defun archive--insert-repolinks (name srcdir mainsrcfile url)
+(defun archive--insert-repolinks (name srcdir _mainsrcfile url)
(when url
(insert (format "<p>Home page: <a href=%S>%s</a></p>\n"
url (archive--quote url)))
@@ -563,31 +562,21 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(defconst archive--emacs-git-url "git://git.sv.gnu.org/emacs.git")
(defun archive--sync-emacs-repo ()
- "Clone and sync Emacs repository."
- (let ((reference (expand-file-name
- (or (getenv "EMACS_CLONE_REFERENCE") "../emacs/master")))
- (emacs-repo-root (expand-file-name "emacs")))
- (when (and (file-exists-p emacs-repo-root)
- (not (file-exists-p
- (expand-file-name "README" emacs-repo-root))))
- (message "Cleaning stalled Emacs clone: %s" emacs-repo-root)
- (delete-directory emacs-repo-root t))
- (cond ((file-exists-p emacs-repo-root)
- (let ((default-directory emacs-repo-root))
- (message "Running git pull in %S" default-directory)
- (call-process "git" nil t nil "pull")))
- ((file-exists-p reference)
- (message "Emacs repository reference found: %s" reference)
- (call-process
- "git" nil t nil
- "clone" archive--emacs-git-url
- "--reference" reference
- emacs-repo-root))
- (t
- (error
- (concat "Emacs repository not found at: %s\n"
- "Point EMACS_CLONE_REFERENCE environment variable to an "
- "existing checkout.") reference)))))
+ "Sync Emacs repository, if applicable.
+Return non-nil if there's an \"emacs\" repository present."
+ ;; Support for :core packages is important for elpa.gnu.org, but for other
+ ;; cases such as "in-place installation", it's rather secondary since
+ ;; those users can just as well use a development version of Emacs to get
+ ;; those packages.
+ ;; So make the handling of :core packages depend on whether or not the user
+ ;; has setup a clone of Emacs under the "emacs" subdirectory.
+ (let ((emacs-repo-root (expand-file-name "emacs")))
+ (if (not (file-directory-p emacs-repo-root))
+ (message "No \"emacs\" subdir: will skip :core packages")
+ (let ((default-directory emacs-repo-root))
+ (message "Running git pull in %S" default-directory)
+ (call-process "git" nil t nil "pull")
+ t))))
(defun archive--find-non-trivial-file (dir)
(catch 'found-important-file
@@ -600,15 +589,17 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(throw 'found-important-file file)))
nil))
-(defun archive--cleanup-packages (externals-list)
+(defun archive--cleanup-packages (externals-list with-core)
"Remove subdirectories of `packages/' that do not correspond to known
packages.
This is any subdirectory inside `packages/' that's not under
-version control nor listed in EXTERNALS-LIST."
+version control nor listed in EXTERNALS-LIST.
+If WITH-CORE is non-nil, it means we manage :core packages as well."
(let ((default-directory (expand-file-name "packages/")))
(dolist (dir (directory-files "."))
(cond
((or (not (file-directory-p dir)) (file-symlink-p dir))
- ;; We only add/remove plain directories in elpa/packages (not
symlinks).
+ ;; We only add/remove plain directories in elpa/packages (not
+ ;; symlinks).
nil)
((member dir '("." "..")) nil)
((assoc dir externals-list) nil)
@@ -624,8 +615,9 @@ version control nor listed in EXTERNALS-LIST."
(message "Deleted all of %s" dir))
(message "Keeping leftover unclean %s:\n%s" dir status))))
;; Check if `dir' is under version control.
- ((not (zerop (call-process "git" nil nil nil
- "ls-files" "--error-unmatch" dir)))
+ ((and with-core
+ (not (zerop (call-process "git" nil nil nil
+ "ls-files" "--error-unmatch" dir))))
;; Not under version control. Check if it only contains
;; symlinks and generated files, in which case it is probably
;; a leftover :core package that can safely be deleted.
@@ -751,14 +743,15 @@ version control nor listed in EXTERNALS-LIST."
(let ((externals-list
(with-current-buffer (find-file-noselect "externals-list")
(read (buffer-string)))))
- (archive--cleanup-packages externals-list)
- (archive--sync-emacs-repo)
- (pcase-dolist ((and definition `(,name ,kind ,_url)) externals-list)
- (pcase kind
- (`:subtree nil) ;Nothing to do.
- (`:external (archive--external-package-sync name))
- (`:core (archive--core-package-sync definition))
- (_ (message "Unknown external package kind `%S' for %s" kind name))))))
+ (let ((with-core (archive--sync-emacs-repo)))
+ (archive--cleanup-packages externals-list with-core)
+ (pcase-dolist ((and definition `(,name ,kind ,_url)) externals-list)
+ (pcase kind
+ (`:subtree nil) ;Nothing to do.
+ (`:external (archive--external-package-sync name))
+ (`:core (when with-core (archive--core-package-sync definition)))
+ (_ (message "Unknown external package kind `%S' for %s"
+ kind name)))))))
(provide 'archive-contents)
;;; archive-contents.el ends here
- [elpa] elpa-admin e48de90 332/357: * README: Fix typos., (continued)
- [elpa] elpa-admin e48de90 332/357: * README: Fix typos., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 223f7eb 331/357: * README: Clarify deployment process., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin d19a5b8 341/357: * README.org: New file, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin b3e663b 353/357: Rename ELisp files, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 4ade74d 346/357: * README.org: Add license and an introduction., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 4a3a7c2 193/357: * README: Improve subtree instructions, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 54886a6 199/357: Better generated HTML pages, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 5e9fdd4 197/357: * README: Revert change about package.el headers, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 3a394c3 188/357: Merge commit 'd76bcd7c0dcecb33e6955e25963028600c371588', Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 7558d12 206/357: Make externals directory removal safer, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin a8b876c 207/357: * admin/archive-contents.el: Make :core handling optional,
Stefan Monnier <=
- [elpa] elpa-admin 3a129d5 190/357: Add support to build packages from Emacs repo, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 581dd5b 231/357: Fix a typo in the readme, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin f79a619 218/357: * packages/gnome-c-style/gnome-c-tests.el: Add copyright blurb, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 28819e8 192/357: Skip uninteresting elements, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 345dc39 189/357: * GNUmakefile: Use LC_ALL rather than LANG, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 368a212 219/357: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 7edd6ff 205/357: Dereference symlinks when creating tarballs, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 2f122b0 251/357: Merge branch 'master' into new-website, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin da3bd64 263/357: [admin int] Use ‘archive--read-externals-list’ more., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 34ecb5f 257/357: Respect .elpaignore when compiling and optimize compilation., Stefan Monnier, 2020/12/10