From b806f6d23d828b2e08ba46ee985e02ac16d7ee09 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Thu, 5 Sep 2024 21:53:58 +0200 Subject: [PATCH] Support specifying arbitrary shell command in recipes --- package-build.el | 11 +++++++++++ package-recipe.el | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package-build.el b/package-build.el index 08bd745..9fc757b 100644 --- a/package-build.el +++ b/package-build.el @@ -195,6 +195,12 @@ Note that Melpa leaves this disabled." :group 'package-build :type 'boolean) +(defcustom package-build-run-recipe-shell-command nil + "Whether to run the shell command from the `:shell-command' recipe slot. +Note that Melpa leaves this disabled." + :group 'package-build + :type 'boolean) + (defcustom package-build-run-recipe-make-targets nil "Whether to run the make targets from the `:make-targets' recipe slot. Note that Melpa leaves this disabled." @@ -1478,6 +1484,11 @@ in `package-build-archive-dir'." (unwind-protect (progn (funcall package-build-checkout-function rcp) + (when-let* ((package-build-run-recipe-shell-command) + (command (oref rcp shell-command))) + (package-build--message "Running %s" command) + (package-build--call-sandboxed + rcp shell-file-name shell-command-switch command)) (when-let ((package-build-run-recipe-make-targets) (targets (oref rcp make-targets))) (package-build--message "Running make %s" (string-join targets " ")) diff --git a/package-recipe.el b/package-recipe.el index 864d529..ce3b2f8 100644 --- a/package-recipe.el +++ b/package-recipe.el @@ -52,6 +52,7 @@ (time :initform nil) (version :initform nil) (version-regexp :initarg :version-regexp :initform nil) + (shell-command :initarg :shell-command :initform nil) (make-targets :initarg :make-targets :initform nil) (org-exports :initarg :org-exports :initform nil) (old-names :initarg :old-names :initform nil)) @@ -171,7 +172,8 @@ file is invalid, then raise an error." name ident) (cl-assert plist) (let* ((symbol-keys '(:fetcher)) - (string-keys '(:url :repo :commit :branch :version-regexp)) + (string-keys '( :url :repo :commit :branch + :version-regexp :shell-command)) (list-keys '(:files :make-targets :org-exports :old-names)) (all-keys (append symbol-keys string-keys list-keys))) (dolist (thing plist)