From b72e08e1b156722f3149255394d7b8a9f04da685 Mon Sep 17 00:00:00 2001
From: Stefan Monnier
Date: Sat, 10 Aug 2013 09:56:31 -0400
Subject: [PATCH] Get "make -k" to go through
---
.bzrignore | 9 +-
GNUmakefile | 26 ++----
admin/archive-contents.el | 151 ++++++++++++++++++++++++++++------
admin/update-archive.sh | 15 +++-
packages/auctex/auctex-pkg.el | 2 +-
packages/auctex/tex.el | 18 ++--
6 files changed, 165 insertions(+), 56 deletions(-)
diff --git a/.bzrignore b/.bzrignore
index 9c9e22e17..74d917440 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1,8 +1,11 @@
*.elc
+*~
+ChangeLog
archive
-site
+core
+externals-list
packages/*/*-autoloads.el
packages/*/*-pkg.el
-core
-ChangeLog
packages/.changelog-witness
+packages/dismal
+site
diff --git a/GNUmakefile b/GNUmakefile
index 7f2061d12..3199fcc7f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -9,34 +9,16 @@ SITE_DIR=site
all: all-in-place
-## Set up the source files for direct usage, by pointing
-## `package-directory-list' to the site/ directory.
-site: packages
- mkdir -p $(SITE_DIR)
- $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
- --eval "(batch-make-site-dir \"packages\" \"$(SITE_DIR)\")"
-
-site/%: do-it
- $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
- --eval "(progn (setq debug-on-error t) (batch-make-site-package \"$@\"))"
-
## Deploy the package archive to archive/, with packages in
## archive/packages/:
archive: archive-tmp
$(MAKE) $(MFLAGS) process-archive
-archive-tmp: packages changelogs
+archive-tmp: packages
-rm -r $(ARCHIVE_TMP)
mkdir -p $(ARCHIVE_TMP)
cp -a packages/. $(ARCHIVE_TMP)/packages
-# Refresh the ChangeLog files. This needs to be done in
-# the source tree, because it needs the Bzr data!
-changelogs:
- cd packages; \
- $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el \
- -f batch-prepare-packages
-
process-archive:
# FIXME, we could probably speed this up significantly with
# rules like "%.tar: ../%/ChangeLog" so we only rebuild the packages
@@ -75,7 +57,7 @@ org-fetch: archive-tmp
clean:
rm -rf archive $(ARCHIVE_TMP) $(SITE_DIR)
-########## Rules for in-place installation ##########
+########## Rules for in-place installation ####################################
pkgs := $(foreach pkg, $(wildcard packages/*), \
$(if $(shell [ -d "$(pkg)" ] && echo true), $(pkg)))
@@ -152,3 +134,7 @@ $(extra_elcs):; rm $@
all-in-place: $(extra_elcs) $(autoloads) # $(single_pkgs)
# Do them in a sub-make, so that autoloads are done first.
$(MAKE) elcs
+
+
+############### Rules to prepare the externals ################################
+
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index 56daa8edb..5a5462ae8 100644
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -1,4 +1,4 @@
-;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive.
+;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive. -*- lexical-binding:t -*-
;; Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc
@@ -24,6 +24,7 @@
(eval-when-compile (require 'cl))
(require 'lisp-mnt)
(require 'package)
+(require 'pcase)
(defconst archive-contents-subdirectory-regexp
"\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)")
@@ -86,7 +87,7 @@ Delete backup files also."
(write-region nil nil "archive-contents"))))
(defun batch-prepare-packages ()
- "Prepare the `packages' directory inside the Bzr checkout.
+ "Prepare the `packages' directory inside the Git checkout.
Expects to be called from within the `packages' directory.
\"Prepare\" here is for subsequent construction of the packages and archive,
so it is meant to refresh any generated files we may need.
@@ -218,6 +219,7 @@ package commentary to PKG-readme.txt. Return the descriptor."
(if (file-readable-p "ChangeLog") (insert-file-contents "ChangeLog"))
(let ((old-md5 (md5 (current-buffer))))
(erase-buffer)
+ ;; git --no-pager log --date=short --format="%cd %aN <%ae>%n%n%w(80,8,8)%B%n" | sed 's/^ /\t/'
(call-process "bzr" nil (current-buffer) nil
"log" "--gnu-changelog" ".")
(if (equal old-md5 (md5 (current-buffer)))
@@ -355,40 +357,95 @@ PKG-readme.txt. Return the descriptor."
((>= bytes 10) (format "%4.1f%s" bytes (car units)))
(t (format "%4.2f%s" bytes (car units))))))
+(defun archive--get-prop (prop name srcdir mainsrcfile)
+ (let ((kprop (intern (format ":%s" (downcase prop)))))
+ (or
+ (let ((pkgdescfile (expand-file-name (format "%s-pkg.el" name)
+ srcdir)))
+ (when (file-readable-p pkgdescfile)
+ (with-temp-buffer
+ (insert-file-contents pkgdescfile)
+ (let ((desc (read (current-buffer))))
+ (plist-get (cdr desc) kprop)))))
+ (when (file-readable-p mainsrcfile)
+ (with-temp-buffer
+ (insert-file-contents mainsrcfile)
+ (lm-header prop))))))
+
+(defun archive--get-section (hsection fsection srcdir mainsrcfile)
+ (cond
+ ((file-readable-p (expand-file-name fsection srcdir))
+ (with-temp-buffer
+ (insert-file-contents (expand-file-name fsection srcdir))
+ (buffer-string)))
+ ((file-readable-p mainsrcfile)
+ (with-temp-buffer
+ (insert-file-contents mainsrcfile)
+ (let ((start (lm-section-start hsection)))
+ (when start
+ (insert
+ (prog1
+ (buffer-substring start (lm-section-end hsection))
+ (erase-buffer)))
+ (emacs-lisp-mode)
+ (goto-char (point-min))
+ (delete-region (point) (line-beginning-position 2))
+ (uncomment-region (point-min) (point-max))
+ (when (looking-at "^\\([ \t]*\n\\)+")
+ (replace-match ""))
+ (goto-char (point-max))
+ (skip-chars-backward " \t\n")
+ (delete-region (point) (point-max))
+ (buffer-string)))))))
+
+(defun archive--quote (txt)
+ (replace-regexp-in-string "<" "<"
+ (replace-regexp-in-string "&" "&" txt)))
+
(defun archive--html-make-pkg (pkg files)
- (let ((name (symbol-name (car pkg)))
- (latest (package-version-join (aref (cdr pkg) 0)))
- (desc (aref (cdr pkg) 2)))
- ;; FIXME: Add maintainer info.
+ (let* ((name (symbol-name (car pkg)))
+ (latest (package-version-join (aref (cdr pkg) 0)))
+ (srcdir (expand-file-name name "../../build/packages"))
+ (mainsrcfile (expand-file-name (format "%s.el" name) srcdir))
+ (desc (aref (cdr pkg) 2)))
(with-temp-buffer
(insert (archive--html-header (format "GNU ELPA - %s" name)))
- (insert (format "Description: %s
\n" desc))
+ (insert (format "Description: %s
\n" (archive--quote desc)))
(let* ((file (cdr (assoc latest files)))
(attrs (file-attributes file)))
(insert (format "Latest: %s, %s, %s
\n"
- file file
+ file (archive--quote file)
(format-time-string "%Y-%b-%d" (nth 5 attrs))
(archive--html-bytes-format (nth 7 attrs)))))
- ;; FIXME: This URL is wrong for Org.
- (let ((repurl (concat "http://bzr.sv.gnu.org/lh/emacs/elpa/files/head:/packages/" name)))
- (insert (format "Repository: %s
" repurl repurl)))
- (let ((readme (concat name "-readme.txt"))
- (end (copy-marker (point) t)))
- (when (file-readable-p readme)
- (insert "Full description:
\n")
- (insert-file-contents readme)
- (goto-char end)
- (insert "\n
")))
+ (let ((maint (archive--get-prop "Maintainer" name srcdir mainsrcfile)))
+ (when maint
+ (insert (format "Maintainer: %s
\n" (archive--quote maint)))))
+ (let* ((urlkind "Origin")
+ (url
+ (or (archive--get-prop "URL" name srcdir mainsrcfile)
+ (progn
+ (setq urlkind "Repository")
+ (concat "http://bzr.sv.gnu.org/lh/emacs/elpa/files/head:/packages/" name)))))
+ (insert (format "%s: %s
"
+ urlkind url (archive--quote url))))
+ (let ((readme (archive--get-section "Commentary" "README" srcdir mainsrcfile)))
+ (when readme
+ (insert "Full description
\n" (archive--quote readme)
+ "\n
\n")))
(unless (< (length files) 2)
- (insert (format "Old versions:
\n"))
+ (insert (format "Old versions
\n"))
(dolist (file files)
(unless (equal (pop file) latest)
(let ((attrs (file-attributes file)))
(insert (format "%s | %s | %s | \n"
- file file
+ file (archive--quote file)
(format-time-string "%Y-%b-%d" (nth 5 attrs))
(archive--html-bytes-format (nth 7 attrs)))))))
- (insert "