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 "\n" - file file + file (archive--quote file) (format-time-string "%Y-%b-%d" (nth 5 attrs)) (archive--html-bytes-format (nth 7 attrs))))))) - (insert "
%s%s%s
\n")) + (insert "\n")) + (let ((news (archive--get-section "News" "NEWS" srcdir mainsrcfile))) + (when news + (insert "

News

\n" (archive--quote news) "\n
\n"))) + (insert "\n") (write-region (point-min) (point-max) (concat name ".html"))))) (defun archive--html-make-index (pkgs) @@ -429,11 +486,55 @@ PKG-readme.txt. Return the descriptor." ;; FIXME: Add (old?) packages that are in `packages' but not in ;; archive-contents. (archive--html-make-index archive-contents))) - -;; Local Variables: -;; lexical-binding: t -;; End: +;;; Maintain external packages. + +(defun archive-add/remove-externals () + (let ((exts (with-current-buffer (find-file-noselect "externals-list") + (goto-char (point-min)) + (read (current-buffer))))) + (let ((default-directory (expand-file-name "packages/"))) + ;; Remove "old/odd" externals. + (dolist (dir (directory-files ".")) + (cond + ((member dir '("." "..")) nil) + ((assoc dir exts) nil) + ((file-directory-p (expand-file-name (format "%s/.git" dir))) + (let ((status + (with-temp-buffer + (let ((default-directory (file-name-as-directory + (expand-file-name dir)))) + (call-process "git" nil t nil "status" "--porcelain") + (buffer-string))))) + (if (zerop (length status)) + (progn (delete-directory dir 'recursive t) + (message "Deleted all of %s" dir)) + (message "Keeping leftover unclean %s:\n%s" dir status)))))) + (pcase-dolist (`(,dir ,kind ,url) exts) + (cond + ((not (file-exists-p dir)) + (let* ((branch (concat "externals/" dir)) + (output + (with-temp-buffer + ;; FIXME: Use git-new-workdir! + (call-process "git" nil t nil "branch" "--track" + branch (concat "origin/" branch)) + (call-process "git" nil t nil "clone" + "--shared" "--branch" branch "../" dir) + ;; (let ((default-directory (file-name-as-directory + ;; (expand-file-name dir)))) + ;; (call-process "git" nil t nil "branch" + ;; "-m" branch "master")) + (buffer-string)))) + (message "Cloning branch %s:\n%s" dir output))) + ((not (file-directory-p (concat dir "/.git"))) + (message "%s is in the way of an external, please remove!" dir)) + (t + (let ((default-directory (expand-file-name dir))) + (with-temp-buffer + (call-process "git" nil t nil "pull") + (message "Updated %s:%s" dir (buffer-string)))) + )))))) (provide 'archive-contents) ;;; archive-contents.el ends here diff --git a/admin/update-archive.sh b/admin/update-archive.sh index 091d7c07b..9a37eda34 100755 --- a/admin/update-archive.sh +++ b/admin/update-archive.sh @@ -62,9 +62,20 @@ check_copyright () { cd ~elpa/build -(cd ~elpa/elpa; bzr up) +(cd ~elpa/elpa; -check_copyright + # Fetch changes. + git pull || signal_error "git pull failed"; + + # Refresh the ChangeLog files. This needs to be done in + # the source tree, because it needs the Bzr data! + (cd packages; + emacs -batch -l ../admin/archive-contents.el -f batch-prepare-packages); + + emacs --batch -l admin/archive-contents.el -f archive-add/remove-externals; + + check_copyright + ) rm -rf archive # In case there's one left over! make archive-full >make.log 2>&1 || { diff --git a/packages/auctex/auctex-pkg.el b/packages/auctex/auctex-pkg.el index 8b4ff49f1..6b3dca3f2 100644 --- a/packages/auctex/auctex-pkg.el +++ b/packages/auctex/auctex-pkg.el @@ -1 +1 @@ -(define-package "auctex" "11.86.1" "Integrated environment for *TeX*") +(define-package "auctex" "11.86.1" "Integrated environment for *TeX*" nil :url "http://www.gnu.org/software/auctex/") diff --git a/packages/auctex/tex.el b/packages/auctex/tex.el index e11f16b3a..0ff821ce0 100644 --- a/packages/auctex/tex.el +++ b/packages/auctex/tex.el @@ -1,6 +1,6 @@ ;;; tex.el --- Support for TeX documents. -;; Copyright (C) 1985-1987, 1991, 1993, 1994, 1996, 1997, 1999-2012 +;; Copyright (C) 1985-1987, 1991, 1993, 1994, 1996, 1997, 1999-2013 ;; Free Software Foundation, Inc. ;; Maintainer: auctex-devel@gnu.org @@ -39,6 +39,11 @@ (eval-when-compile (require 'cl)) +(defun TeX--call-3/2 (f arg1 arg2 arg3) + (condition-case nil + (funcall f arg1 arg2 arg3) + (wrong-number-of-arguments (funcall f arg1 arg2)))) + (defgroup TeX-file nil "Files used by AUCTeX." :group 'AUCTeX) @@ -121,7 +126,8 @@ If nil, none is specified." :type '(choice (const :tag "Unspecified" nil) string)) ;; At least in TeXLive 2009 ConTeXt does not support an omega option anymore. -(make-obsolete-variable 'ConTeXt-Omega-engine 'TeX-engine-alist) +(TeX--call-3/2 #'make-obsolete-variable 'ConTeXt-Omega-engine + 'TeX-engine-alist "before 11.86") (defcustom TeX-queue-command "lpq -P%p" "*Command used to show the status of a printer queue. @@ -1285,8 +1291,9 @@ TYPE can be one of the following symbols:\n" :group 'TeX-command (TeX-engine-set (if TeX-Omega-mode 'omega 'default))) (defalias 'tex-omega-mode 'TeX-Omega-mode) -(make-obsolete 'TeX-Omega-mode 'TeX-engine-set) -(make-obsolete-variable 'TeX-Omega-mode 'TeX-engine) +(TeX--call-3/2 #'make-obsolete 'TeX-Omega-mode 'TeX-engine-set "before 11.86") +(TeX--call-3/2 #'make-obsolete-variable 'TeX-Omega-mode + 'TeX-engine "before 11.86") ;;; Forward and inverse search @@ -1434,7 +1441,8 @@ SyncTeX are recognized." (when TeX-source-correlate-mode 'TeX-synctex-output-page)))) (defalias 'TeX-source-specials-mode 'TeX-source-correlate-mode) -(make-obsolete 'TeX-source-specials-mode 'TeX-source-correlate-mode) +(TeX--call-3/2 #'make-obsolete 'TeX-source-specials-mode + 'TeX-source-correlate-mode "before 11.86") (defalias 'tex-source-correlate-mode 'TeX-source-correlate-mode) (put 'TeX-source-correlate-mode 'safe-local-variable 'TeX-booleanp) ;; We do not want the custom variable to require tex.el. This is only -- 2.39.2