[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin 911fbf6: * GNUmakefile: Try and unbreak "make packages
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin 911fbf6: * GNUmakefile: Try and unbreak "make packages/foo". Still not perfect |
Date: |
Wed, 16 Dec 2020 19:02:44 -0500 (EST) |
branch: elpa-admin
commit 911fbf63e07acfe17ad765f5014c135015063455
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* GNUmakefile: Try and unbreak "make packages/foo". Still not perfect
(packages/%-autoloads.el, packages/%-pkg.el): Add `packages/` prefix to the
rule, so it's more specific than the generic `package/%`.
(included_els, els, naive_elcs): Comment out vars.
(packages/%.elc): Mark as precious.
(elcs): Comment out.
(FILE-deps): New define.
(dummy): New goal.
(packages/%): Use them.
* elpa-admin.el (elpaa--form-from-file-contents): Move before first use.
(elpaa-read-config): Make arg mandatory. Call it from top-level.
(elpaa--copyright-filter): Silence "same file" warning.
(elpaa--fetch): Use a single line per commit in the log.
---
GNUmakefile | 99 ++++++++++++++++++++++++++++++++++-------------------------
elpa-admin.el | 41 ++++++++++++-------------
2 files changed, 77 insertions(+), 63 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 31e39aa..04a4ea6 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -68,8 +68,7 @@ autoloads := $(foreach pkg, $(pkgs), $(pkg)/$(notdir
$(pkg))-autoloads.el)
# packages/aggressive-indent/aggressive-indent-autoloads.el: \
# packages/names/names-autoloads.el
-$(foreach al, $(autoloads), $(eval $(call RULE-srcdeps, $(al))))
-%-autoloads.el:
+packages/%-autoloads.el:
@#echo 'Generating autoloads for $@'
@cd $(dir $@) && \
$(EMACS) -l $(CURDIR)/admin/elpa-admin.el \
@@ -82,8 +81,8 @@ $(foreach al, $(autoloads), $(eval $(call RULE-srcdeps,
$(al))))
# I.e. one for each .el file in each package root, except for the -pkg.el,
# the -autoloads.el, the .el files that are marked "no-byte-compile", and
# files matching patterns in packages' .elpaignore files.
-included_els := $(shell tar -cvhf /dev/null --exclude-ignore=.elpaignore \
- --exclude-vcs packages 2>&1 | grep '\.el$$')
+# included_els := $(shell tar -cvhf /dev/null --exclude-ignore=.elpaignore \
+# --exclude-vcs packages 2>&1 | grep '\.el$$')
# included_els := $(wildcard packages/*/*.el)
@@ -91,8 +90,8 @@ included_els := $(shell tar -cvhf /dev/null
--exclude-ignore=.elpaignore \
# packages/*/*/*.el \
# packages/*/*/*/*.el \
# packages/*/*/*/*/*.el))
-els := $(call FILTER-nonsrc, $(included_els))
-naive_elcs := $(patsubst %.el, %.elc, $(els))
+# els := $(call FILTER-nonsrc, $(included_els))
+# naive_elcs := $(patsubst %.el, %.elc, $(els))
current_elcs := $(shell find packages -name '*.elc' -print)
extra_els := $(call SET-diff, $(els), $(patsubst %.elc, %.el, $(current_elcs)))
@@ -101,28 +100,30 @@ nbc_els := $(foreach el, $(extra_els), \
elcs := $(call SET-diff, $(naive_elcs), $(patsubst %.el, %.elc, $(nbc_els)))
# '(dolist (al (quote ($(patsubst %, "%", $(autoloads))))) (load
(expand-file-name al) nil t))'
+.PRECIOUS: packages/%.elc
packages/%.elc: packages/%.el
@echo 'Byte compiling $<'
- @$(EMACS) \
- --eval "(setq package-directory-list nil \
+ @$(EMACS) \
+ --eval "(setq package-directory-list nil \
load-prefer-newer t \
- package-user-dir \"$(abspath packages)\")" \
- -f package-initialize \
+ package-user-dir \"$(abspath packages)\")" \
+ -f package-initialize \
-L $(dir $@) -f batch-byte-compile $<
-.PHONY: elcs
-elcs: $(elcs)
+# .PHONY: elcs
+# elcs: $(elcs)
# Remove .elc files that don't have a corresponding .el file any more.
-extra_elcs := $(call SET-diff, $(current_elcs), $(naive_elcs))
+# FIXME
+# extra_elcs := $(call SET-diff, $(current_elcs), $(naive_elcs))
.PHONY: $(extra_elcs)
-$(extra_elcs):; rm $@
+# $(extra_elcs):; rm $@
# # Put into single_pkgs the set of -pkg.el files we need to keep up-to-date.
# # I.e. all the -pkg.el files for the single-file packages.
pkg_descs:=$(foreach pkg, $(pkgs), $(pkg)/$(notdir $(pkg))-pkg.el)
#$(foreach al, $(single_pkgs), $(eval $(call RULE-srcdeps, $(al))))
-%-pkg.el: %.el
+packages/%-pkg.el: packages/%.el
@echo 'Generating description file $@'
@$(EMACS) -l admin/elpa-admin.el \
-f elpaa-batch-generate-description-file "$@"
@@ -131,38 +132,54 @@ pkg_descs:=$(foreach pkg, $(pkgs), $(pkg)/$(notdir
$(pkg))-pkg.el)
# Use order-only prerequisites, so that autoloads are done first.
all-in-place: | $(extra_elcs) $(autoloads) $(pkg_descs) elcs
+define FILE-deps
+$(if $(findstring /, $(1)), \
+ $(if $(patsubst %.elc,,$(1)), \
+ $(patsubst %.elc, %.el, $(1))), \
+ $(shell [ -d packages/$(1) ] && { \
+ echo packages/$(1)/$(1)-pkg.el; \
+ echo packages/$(1)/$(1)-autoloads.el; \
+ tar -cvhf /dev/null \
+ --exclude-ignore=.elpaignore \
+ --exclude='*-pkg.el' \
+ --exclude='*-autoloads.el' \
+ --exclude-vcs packages/$(1) 2>&1 \
+ | sed -ne 's/\.el$$/.elc/p';}))
+endef
-#### `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
-# $(1): $(filter $(1)/%, $(elcs))
+# define FILE-cmd
+# $(if $(findstring /, $(1)), \
+# $(if $(patsubst %.elc,,$(1)), \
+# $(EMACS) \
+# --eval "(setq package-directory-list nil \
+# load-prefer-newer t \
+# package-user-dir \"$(abspath packages)\")" \
+# -f package-initialize \
+# -L $(dir $@) -f batch-byte-compile $<, \
+# echo YUP: $(1)), \
+# [ -d packages/$(1) ] || \
+# $(EMACS) -l admin/elpa-admin.el \
+# -f elpaa-batch-archive-update-worktrees "$(@F)")
# endef
-# $(foreach pkg, $(pkgs), $(eval $(call RULE-singlepkg, $(pkg))))
-
-# #### `make package/<pkgname>` to populate one package's subdirectory
####
-
-# MISSING_script := (sed -ne 's|^.("\([^"]*\)".*|packages/\1|p'
externals-list; \
-# ls -1d packages/*; ls -1d packages/*) \
-# | sort | uniq -u
-# MISSING_PKGS := $(shell $(MISSING_script))
+# define EMACS-update-tree-cmd
+# $(EMACS) -l admin/elpa-admin.el \
+# -f elpaa-batch-archive-update-worktrees "$(@F)"
+# endef
+# define EMACS-update-tree-cmd
+# $(shell echo $(call EMACS-update-tree-cmd,$(1))) \
+# $(call EMACS-update-tree-cmd,$(1))
+# endef
-# $(MISSING_PKGS):
-# $(EMACS) -l admin/elpa-admin.el \
-# -f elpaa-batch-archive-update-worktrees "$(@F)"
+.PHONY: dummy
+dummy:
+# # echo Making dummies
.SECONDEXPANSION:
-packages/% : $$(shell tar -cvhf /dev/null --exclude-ignore=.elpaignore \
- --exclude-vcs packages/$$* 2>&1 | \
- sed -ne 's/\.el$$$$/.elc/p')
- [ -d packages/$* ] || \
- $(EMACS) -l admin/elpa-admin.el \
- -f elpaa-batch-archive-update-worktrees "$(@F)"
+packages/% : dummy $$(call FILE-deps,$$*)
+ [ -d packages/$* ] || \
+ $(EMACS) -l admin/elpa-admin.el \
+ -f elpaa-batch-archive-update-worktrees "$(@F)"
#### Fetching updates from upstream ####
diff --git a/elpa-admin.el b/elpa-admin.el
index 0153446..a370c07 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -57,8 +57,17 @@ on some Debian systems.")
(defvar elpaa--debug nil)
-(defun elpaa-read-config (&optional file)
- (let ((config (elpaa--form-from-file-contents (or file "elpa-config"))))
+(defun elpaa--form-from-file-contents (filename)
+ (with-temp-buffer
+ (insert-file-contents filename)
+ ;; This is unnecessary because ‘with-temp-buffer’ generates a new
+ ;; (empty) buffer, and ‘insert-file-contents’ inserts after point.
+ ;; In other words, point is alraedy at bob.
+ ;;- (goto-char (point-min))
+ (read (current-buffer))))
+
+(defun elpaa-read-config (file)
+ (let ((config (elpaa--form-from-file-contents file)))
(pcase-dolist (`(,var ,val) config)
(cl-assert (or (stringp val) (booleanp val)) t)
(setf (pcase-exhaustive var
@@ -76,6 +85,8 @@ on some Debian systems.")
('debug elpaa--debug))
val))))
+(when (file-readable-p "elpa-config") (elpaa-read-config "elpa-config"))
+
(defun elpaa--message (&rest args)
(when elpaa--debug (apply #'message args)))
@@ -433,7 +444,6 @@ Return non-nil if a new tarball was created."
(defun elpaa-batch-make-all-packages (&rest _)
"Check all the packages and build the relevant new tarballs."
- (elpaa-read-config)
(let* ((specs (elpaa--get-specs)))
(dolist (spec specs)
(condition-case err
@@ -442,7 +452,6 @@ Return non-nil if a new tarball was created."
(defun elpaa-batch-make-one-package (&rest _)
"Build the new tarballs (if needed) for one particular package."
- (elpaa-read-config)
(while command-line-args-left
(elpaa--make-one-package (elpaa--get-package-spec
(pop command-line-args-left)))))
@@ -675,15 +684,6 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(cons (intern pkg) (vector (elpaa--version-to-list vers)
req (nth 3 exp) 'tar extras))))
-(defun elpaa--form-from-file-contents (filename)
- (with-temp-buffer
- (insert-file-contents filename)
- ;; This is unnecessary because ‘with-temp-buffer’ generates a new
- ;; (empty) buffer, and ‘insert-file-contents’ inserts after point.
- ;; In other words, point is alraedy at bob.
- ;;- (goto-char (point-min))
- (read (current-buffer))))
-
(defun elpaa--multi-file-package-def (dir pkg)
"Return the `define-package' form in the file DIR/PKG-pkg.el."
(let ((pkg-file (expand-file-name (concat pkg "-pkg.el") dir)))
@@ -1229,12 +1229,10 @@ If WITH-CORE is non-nil, it means we manage :core
packages as well."
(defun elpaa-add/remove/update-externals ()
"Remove non-package directories and fetch external packages."
- (elpaa-read-config)
(let ((command-line-args-left '("-")))
(elpaa-batch-archive-update-worktrees)))
(defun elpaa-batch-archive-update-worktrees (&rest _)
- (elpaa-read-config)
(let ((specs (elpaa--get-specs))
(pkgs command-line-args-left)
(with-core (elpaa--sync-emacs-repo)))
@@ -1303,7 +1301,8 @@ If WITH-CORE is non-nil, it means we manage :core
packages as well."
(buffer-string)))
(defun elpaa--copyright-filter (collected)
- (let ((res '()))
+ (let ((res '())
+ (find-file-suppress-same-file-warnings t))
(with-current-buffer (find-file-noselect elpaa--copyright-file)
(dolist (line (split-string collected "\n" t))
(goto-char (point-min))
@@ -1325,7 +1324,6 @@ If WITH-CORE is non-nil, it means we manage :core
packages as well."
(error "Abort")))))
(defun elpaa-batch-copyright-check (&rest _)
- (elpaa-read-config)
(let ((specs (elpaa--get-specs))
(pkgs command-line-args-left))
(setq command-line-args-left nil)
@@ -1481,9 +1479,10 @@ More at " (elpaa--default-url pkgname))
((let* ((ortb (elpaa--ortb pkg-spec))
(exists (elpaa--git-branch-p ortb)))
(not (equal 0 (elpaa--call t "git" "log"
- (if exists
- (format "%s...%s" ortb urtb)
- urtb)))))
+ "--format=%h %<(16,trunc)%ae %s"
+ (if exists
+ (format "%s...%s" ortb urtb)
+ urtb)))))
(message "Log error for %s:\n%s" pkg (buffer-string)))
((eq (point-min) (point-max))
(message "No pending upstream changes for %s" pkg))
@@ -1535,11 +1534,9 @@ More at " (elpaa--default-url pkgname))
(elpaa--fetch pkg-spec k))))))
(defun elpaa-batch-fetch-and-show (&rest _)
- (elpaa-read-config)
(elpaa--batch-fetch-and #'ignore))
(defun elpaa-batch-fetch-and-push (&rest _)
- (elpaa-read-config)
(elpaa--batch-fetch-and #'elpaa--push))
;;; ERT test support
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] elpa-admin 911fbf6: * GNUmakefile: Try and unbreak "make packages/foo". Still not perfect,
Stefan Monnier <=