From dcb8bc6ba68834da94cef9006e6889c75e89f67a Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Ihor Radchenko Date: Sun, 2 Apr 2023 15:11:06 +0200 Subject: [PATCH 6/6] mk: Do not run `package-refresh-packages' unless necessary * mk/default.mk (package-install): (package-define-refresh-mark): (package-need-refresh-mark): (package-refresh-maybe): (package-install-maybe): (INSTALL_PACKAGES): Update the command avoiding `package-refresh-packages' when all the required third-party packages are already present in the `load-path'. --- mk/default.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mk/default.mk b/mk/default.mk index b43a9b3ac..67bf96c2e 100644 --- a/mk/default.mk +++ b/mk/default.mk @@ -81,7 +81,10 @@ REPRO_ARGS ?= req-ob-lang = --eval '(require '"'"'ob-$(ob-lang))' lst-ob-lang = ($(ob-lang) . t) req-extra = --eval '(require '"'"'$(req))' -package-install = --eval '(unless (require '"'"'$(package) nil t) (message "%s" load-path) (package-install '"'"'$(package)))' +package-define-refresh-mark = --eval '(setq org--compile-packages-missing nil)' +package-need-refresh-mark = --eval '(unless (require '"'"'$(package) nil t) (setq org--compile-packages-missing t))' +package-refresh-maybe = --eval '(if org--compile-packages-missing (package-refresh-contents) (message "No third-party packages need to be installed"))' +package-install-maybe = --eval '(unless (require '"'"'$(package) nil t) (package-install '"'"'$(package)))' BTEST_RE ?= \\(org\\|ob\\|ox\\) BTEST_LOAD = \ --eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' \ @@ -93,8 +96,8 @@ INSTALL_PACKAGES = else INSTALL_PACKAGES = \ $(BATCH) \ - --eval '(package-refresh-contents)' \ - $(foreach package,$(EPACKAGES),$(package-install)) + $(package-define-refresh-mark) $(foreach package,$(EPACKAGES),$(package-need-refresh-mark)) $(package-refresh-maybe) \ + $(foreach package,$(EPACKAGES),$(package-install-maybe)) endif BTEST = $(BATCH) $(BTEST_INIT) \ -- 2.39.1