branch: elpa-admin commit 311d8196e7823fad6f82e3b195297f097c07df7f Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
* GNUmakefile: Fix `-l` args to `emacs` which require an actual file name (check/%): Add per-package copyright check. (TOP): Delete variable. ($(1)-test): Use $CURDIR instead, * elpa-admin.el (elpaa--html-make-pkg): Make `srcdir` non-optional. (elpaa-batch-html-make-index): Delete function. (elpaa-ert-package-install): Adjust dir name for new layout. --- GNUmakefile | 52 ++++++++++++++++++++++++++++++++++++---------------- elpa-admin.el | 47 ++--------------------------------------------- 2 files changed, 38 insertions(+), 61 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 7474c71..db1636c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -28,12 +28,31 @@ check_copyrights: done) | sort >$(CR_EXCEPTIONS)~ diff -u "$(CR_EXCEPTIONS)" "$(CR_EXCEPTIONS)~" +.PHONY: check/% +check/%: + @export LC_ALL=C; \ + (cd packages && \ + find ./$* -name '.git' -prune -o \ + -name 'test' -prune -o \ + -name '*.el' -print0 | \ + xargs -0 grep -L 'Free Software Foundation, Inc' | \ + grep -v '\(\.dir-locals\|.-\(pkg\|autoloads\)\)\.el$$'; \ + find ./$* -name '.git' -prune -o -name '*.el' -type f -print | \ + while read f; do \ + fquoted="$$(echo $$f|tr '|' '_')"; \ + sed -n -e '/[Cc]opyright.*, *[1-9][-0-9]*,\?$$/N' \ + -e '/Free Software Foundation/d' \ + -e "s|^\\(.*;.*[Cc]opyright\\)|$$fquoted:\\1|p" \ + "$$f"; \ + done; \ + cat ../$(CR_EXCEPTIONS) ../$(CR_EXCEPTIONS)) | sort | uniq -u + build/%: - $(EMACS) -l $(CURDIR)/admin/elpa-admin \ + $(EMACS) -l $(CURDIR)/admin/elpa-admin.el \ -f elpaa-batch-make-one-package $* build-all: - $(EMACS) -l $(CURDIR)/admin/elpa-admin \ + $(EMACS) -l $(CURDIR)/admin/elpa-admin.el \ -f elpaa-batch-make-all-packages ## Deploy the package archive to archive/, with packages in @@ -58,7 +77,7 @@ process-archive: # rules like "%.tar: ../%/ChangeLog" so we only rebuild the packages # that have indeed changed. cd $(ARCHIVE_TMP)/packages && \ - $(EMACS) -l $(CURDIR)/admin/elpa-admin \ + $(EMACS) -l $(CURDIR)/admin/elpa-admin.el \ -f elpaa-batch-make-archive @cd $(ARCHIVE_TMP)/packages && \ for pt in *; do \ @@ -148,7 +167,7 @@ $(foreach al, $(autoloads), $(eval $(call RULE-srcdeps, $(al)))) %-autoloads.el: @#echo 'Generating autoloads for $@' @cd $(dir $@) && \ - $(EMACS) -l $(CURDIR)/admin/elpa-admin \ + $(EMACS) -l $(CURDIR)/admin/elpa-admin.el \ --eval "(require 'package)" \ --eval "(load (expand-file-name \"../names/names-autoloads.el\") t t)" \ --eval "(package-generate-autoloads \"$$(basename $$(pwd))\" \ @@ -200,7 +219,7 @@ pkg_descs:=$(foreach pkg, $(pkgs), $(pkg)/$(notdir $(pkg))-pkg.el) #$(foreach al, $(single_pkgs), $(eval $(call RULE-srcdeps, $(al)))) %-pkg.el: %.el @echo 'Generating description file $@' - @$(EMACS) -l admin/elpa-admin \ + @$(EMACS) -l admin/elpa-admin.el \ -f elpaa-batch-generate-description-file "$@" .PHONY: all-in-place @@ -210,6 +229,9 @@ all-in-place: | $(extra_elcs) $(autoloads) $(pkg_descs) elcs #### `make package/<pkgname>` to compile the files of a single package #### +# FIXME: `make` spends a lot of time at startup now, apparently +# building all those singlepkg rules! + define RULE-singlepkg $(filter $(1)/%, $(elcs)): $1/$(notdir $(1))-pkg.el \ $1/$(notdir $(1))-autoloads.el @@ -226,7 +248,7 @@ MISSING_script := (sed -ne 's|^.("\([^"]*\)".*|packages/\1|p' externals-list; \ MISSING_PKGS := $(shell $(MISSING_script)) $(MISSING_PKGS): - $(EMACS) -l admin/elpa-admin \ + $(EMACS) -l admin/elpa-admin.el \ -f elpaa-batch-archive-update-worktrees "$(@F)" @@ -234,19 +256,19 @@ $(MISSING_PKGS): .PHONY: fetch/% fetch/%: - $(EMACS) -l admin/elpa-admin -f elpaa-batch-fetch-and-show "$*" + $(EMACS) -l admin/elpa-admin.el -f elpaa-batch-fetch-and-show "$*" .PHONY: fetch-all fetch-all: - $(EMACS) -l admin/elpa-admin -f elpaa-batch-fetch-and-show "-" + $(EMACS) -l admin/elpa-admin.el -f elpaa-batch-fetch-and-show "-" .PHONY: sync/% sync/%: - $(EMACS) -l admin/elpa-admin -f elpaa-batch-fetch-and-push "$*" + $(EMACS) -l admin/elpa-admin.el -f elpaa-batch-fetch-and-push "$*" .PHONY: sync-all sync-all: - $(EMACS) -l admin/elpa-admin -f elpaa-batch-fetch-and-push "-" + $(EMACS) -l admin/elpa-admin.el -f elpaa-batch-fetch-and-push "-" @@ -254,7 +276,7 @@ sync-all: .PHONY: externals: - $(EMACS) -l admin/elpa-admin \ + $(EMACS) -l admin/elpa-admin.el \ -f elpaa-add/remove/update-externals @@ -263,13 +285,11 @@ externals: PACKAGE_DIRS = $(shell find packages -maxdepth 1 -type d) PACKAGES=$(subst /,,$(subst packages,,$(PACKAGE_DIRS))) -TOP =$(shell pwd) - define test_template $(1)-test: - cd packages/$(1); \ - $(EMACS) -l $(TOP)/admin/elpa-admin.el \ - --eval "(elpaa-ert-test-package \"$(TOP)\" '$(1))" \ + cd packages/$(1); \ + $(EMACS) -l $(CURDIR)/admin/elpa-admin.el.el \ + --eval "(elpaa-ert-test-package \"$(CURDIR)\" '$(1))" \ $(1)-test-log: $(MAKE) $(1)-test > packages/$(1)/$(1).log 2>&1 || { stat=ERROR; } diff --git a/elpa-admin.el b/elpa-admin.el index b4b5e34..97cbe12 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -28,7 +28,6 @@ ;; - Fix archive name and URL ;; TODO: -;; - Eliminate hardcoded `build/packages' directory structure ;; - support for rebuilding index.html, archive-contents, and <pkg>.html ;; - support for building the Info files ;; - support for README.md for some packages @@ -788,11 +787,9 @@ Rename DIR/ to PKG-VERS/, and return the descriptor." (concat git-sv (nth 1 urls)) 'Gitweb)))) -(defun elpaa--html-make-pkg (pkg pkg-spec files &optional srcdir) +(defun elpaa--html-make-pkg (pkg pkg-spec files srcdir) (let* ((name (symbol-name (car pkg))) (latest (package-version-join (aref (cdr pkg) 0))) - (srcdir (or srcdir - (expand-file-name name "../../build/packages"))) (mainsrcfile (expand-file-name (format "%s.el" name) srcdir)) (desc (aref (cdr pkg) 2))) (cl-assert (equal name (car pkg-spec))) @@ -892,46 +889,6 @@ Rename DIR/ to PKG-VERS/, and return the descriptor." </body>\n") (write-region (point-min) (point-max) "index.html"))) -(defun elpaa-batch-html-make-index () - (let ((packages (make-hash-table :test #'equal)) - (specs (elpaa--form-from-file-contents "externals-list")) - (archive-contents - ;; Skip the first element which is a version number. - (cdr (elpaa--form-from-file-contents "archive-contents")))) - (dolist (subdir (directory-files "../../build/packages" nil)) - (cond - ((member subdir '("." ".." "elpa.rss" "index.html" "archive-contents"))) - (t (puthash subdir nil packages)))) - (dolist (file (directory-files default-directory nil)) - (cond - ((member file '("." ".." "elpa.rss" "index.html" "archive-contents"))) - ((string-match "\\.html\\'" file)) - ((string-match "\\.sig\\'" file)) - ((string-match "-readme\\.txt\\'" file) - (let ((name (substring file 0 (match-beginning 0)))) - (puthash name (gethash name packages) packages))) - ((string-match "-\\([0-9][^-]*\\)\\.\\(tar\\|el\\)\\'" file) - (let ((name (substring file 0 (match-beginning 0))) - (version (match-string 1 file))) - (push (cons version file) (gethash name packages)))) - (t (message "Unknown file %S" file)))) - (maphash (lambda (pkg-name files) - (elpaa--html-make-pkg - (let ((pkg (intern pkg-name))) - (or (assq pkg archive-contents) - ;; Add entries for packages that are either not yet - ;; released or not released any more. - ;; FIXME: Get actual description! - (let ((entry (cons pkg (vector nil nil "" nil nil)))) - (setq archive-contents - ;; Add entry at the end. - (nconc archive-contents (list entry))) - entry))) - (assoc pkg-name specs) - files)) - packages) - (elpaa--html-make-index archive-contents))) - (defun elpaa--pull (dirname) (let ((default-directory (elpaa--dirname dirname))) (with-temp-buffer @@ -1281,7 +1238,7 @@ If WITH-CORE is non-nil, it means we manage :core packages as well." ;; blitz default value and set up from elpa. (setq package-archives `(("local-elpa" - . ,(expand-file-name "archive/packages" top-directory))) + . ,(expand-file-name "packages" top-directory))) package-user-dir (make-temp-file "elpa-test" t)) (package-initialize) (package-refresh-contents)