emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] elpa-admin 2f122b0 251/357: Merge branch 'master' into new-websit


From: Stefan Monnier
Subject: [elpa] elpa-admin 2f122b0 251/357: Merge branch 'master' into new-website
Date: Thu, 10 Dec 2020 18:06:53 -0500 (EST)

branch: elpa-admin
commit 2f122b050613520d0caedda2aba0ea633ddde830
Merge: a3dcbb3 858666e
Author: Nicolas Petton <nicolas@petton.fr>
Commit: Nicolas Petton <nicolas@petton.fr>

    Merge branch 'master' into new-website
---
 GNUmakefile               |  6 ++++-
 README                    |  2 +-
 admin/archive-contents.el | 64 ++++++++++++++++++++++++++++++++++-------------
 3 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index d23d523..7d6d100 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -8,7 +8,7 @@ SITE_DIR=site
 
 .PHONY: archive-tmp changelogs process-archive archive-full org-fetch clean 
all do-it
 
-all: all-in-place
+all: all-in-place .gitignore
 
 CR_EXCEPTIONS=copyright_exceptions
 .PHONY: check_copyrights
@@ -81,6 +81,10 @@ archive-full: archive-tmp org-fetch
        #mkdir -p archive/admin
        #cp admin/* archive/admin/
 
+.gitignore: externals-list
+       $(EMACS) -l $(CURDIR)/admin/archive-contents.el \
+                --eval '(archive-gitignore-externals "$<" "$@")'
+
 # FIXME: Turn it into an `external', which will require adding the notion of
 # "snapshot" packages.
 org-fetch: archive-tmp
diff --git a/README b/README
index 7c5cd36..57d9ca9 100644
--- a/README
+++ b/README
@@ -37,7 +37,7 @@ release the new code.
 ** To add a package: (submission, submit)
 
 Adding a basic package is very simple. There are thorough
-instructional, but the gist is that you:
+instructions below, but the gist of it is that you:
 
 1. Notify emacs-devel@gnu.org.
 2. Place all files inside `packages/<pkg-name>/'.
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index f3b4db8..7af9b3c 100755
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -1,6 +1,6 @@
 ;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2011-2015  Free Software Foundation, Inc
+;; Copyright (C) 2011-2016  Free Software Foundation, Inc
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
@@ -21,7 +21,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'lisp-mnt)
 (require 'package)
 (require 'pcase)
@@ -36,8 +36,8 @@
   (when vers
     (let ((l (version-to-list vers)))
       ;; Signal an error for things like "1.02" which is parsed as "1.2".
-      (assert (equal vers (package-version-join l)) nil
-              "Unsupported version syntax %S" vers)
+      (cl-assert (equal vers (package-version-join l)) nil
+                 "Unsupported version syntax %S" vers)
       l)))
 
 (defun archive--convert-require (elt)
@@ -585,6 +585,14 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
              packages)
     (archive--html-make-index archive-contents)))
 
+(defun archive--pull (dirname)
+  (let ((default-directory (file-name-as-directory
+                            (expand-file-name dirname))))
+    (with-temp-buffer
+      (message "Running git pull in %S" default-directory)
+      (call-process "git" nil t nil "pull")
+      (message "Updated %s:\n%s" dirname (buffer-string)))))
+
 ;;; Maintain external packages.
 
 (defconst archive--elpa-git-url "git://git.sv.gnu.org/emacs/elpa")
@@ -603,10 +611,8 @@ Return non-nil if there's an \"emacs\" repository present."
     (if (not (file-directory-p emacs-repo-root))
         (progn (message "No \"emacs\" subdir: will skip :core packages")
                nil)
-      (let ((default-directory emacs-repo-root))
-        (message "Running git pull in %S" default-directory)
-        (call-process "git" nil t nil "pull")
-        t))))
+      (archive--pull emacs-repo-root)
+      t)))
 
 (defun archive--find-non-trivial-file (dir)
   (catch 'found-important-file
@@ -627,7 +633,13 @@ 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))
+       ((file-symlink-p dir)
+        ;; There are normally no such thing, but the user may elect to
+        ;; add symlinks to other projects.  If so, update them, as if they
+        ;; were "externals".
+        (when (file-directory-p (expand-file-name ".git" dir))
+          (archive--pull dir)))
+       ((or (not (file-directory-p dir)) )
         ;; We only add/remove plain directories in elpa/packages (not
         ;; symlinks).
         nil)
@@ -666,7 +678,7 @@ If WITH-CORE is non-nil, it means we manage :core packages 
as well."
            (let* ((branch (concat "externals/" name))
                   (output
                    (with-temp-buffer
-                     ;; FIXME: Use git-new-workdir!
+                     ;; FIXME: Use `git worktree'!
                      (call-process "git" nil t nil "clone"
                                    "--reference" ".." "--single-branch"
                                    "--branch" branch
@@ -675,13 +687,7 @@ If WITH-CORE is non-nil, it means we manage :core packages 
as well."
              (message "Cloning branch %s:\n%s" name output)))
           ((not (file-directory-p (concat name "/.git")))
            (message "%s is in the way of an external, please remove!" name))
-          (t
-           (let ((default-directory (file-name-as-directory
-                                     (expand-file-name name))))
-             (with-temp-buffer
-               (message "Running git pull in %S" default-directory)
-               (call-process "git" nil t nil "pull")
-               (message "Updated %s:%s" name (buffer-string))))))))
+          (t (archive--pull name)))))
 
 (defun archive--core-package-empty-dest-p (dest)
   "Return non-nil if DEST is an empty variant."
@@ -784,5 +790,29 @@ If WITH-CORE is non-nil, it means we manage :core packages 
as well."
           (_ (message "Unknown external package kind `%S' for %s"
                       kind name)))))))
 
+;;; Manage .gitignore
+
+(defun archive-gitignore-externals (elf gf)
+  (let* ((el (read (find-file-noselect elf)))
+         (exts (delq nil
+                     (mapcar (lambda (x)
+                               (if (eq :external (nth 1 x)) (car x)))
+                             el)))
+         (core (delq nil
+                     (mapcar (lambda (x)
+                               (if (eq :core (nth 1 x)) (car x)))
+                             el))))
+    (with-current-buffer (find-file-noselect gf)
+      (goto-char (point-min))
+      (when (re-search-forward
+             "#.*External.*git.*\n\\(packages/[^*/\n]+/?\n\\)+"
+             nil 'move)
+        (replace-match ""))
+      (insert "# External packages with their own .git tree [autogenerated].\n"
+              (mapconcat (lambda (p) (format "packages/%s/\n" p))
+                         (sort (append exts core) #'string<)
+                         ""))
+      (save-buffer))))
+      
 (provide 'archive-contents)
 ;;; archive-contents.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]