GNU bug report logs -
#63336
[PATCH] package-vc: Process :make and :shell-command spec args
Previous Next
Full log
View this message in rfc822 format
Joseph Turner <joseph <at> breatheoutbreathe.in> writes:
> Hello!
>
> Here's a patch to support :make and :shell-command args as discussed:
>
> https://lists.gnu.org/archive/html/help-gnu-emacs/2023-04/msg00263.html
Thanks!
> Best,
>
> Joseph
>
> From c51161c51f11e6ffcba17758424596fe44f9d42a Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Date: Sat, 6 May 2023 13:44:32 -0700
> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>
> ---
> lisp/emacs-lisp/package-vc.el | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 421947b528d..489610e2a1e 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -344,6 +344,35 @@ asynchronously."
> "\n")
> nil pkg-file nil 'silent))))
>
> +(defcustom package-vc-process-make nil
> + "If non-nil, process :make and :shell-command spec arguments.
> +Package specs are loaded from trusted package archives."
> + :type 'boolean)
As this patch is going to be added to Emacs 30, we should add
:version "30.1"
tags to this user option.
> +(defun package-vc--call (destination program &rest args)
> + "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
^
You should replace these quotation marks with regular ASCII `marks', so
avoid byte-compiler warnings.
> +The INFILE and DISPLAY arguments are fixed as nil."
> + (apply #'call-process program nil destination nil (delq nil args)))
What is the motivation for this function? Is this where
process-isolation would be added in the future?
> +(defun package-vc--make (pkg-spec dir)
> + "Process :make and :shell-command spec arguments."
> + (let ((target (plist-get pkg-spec :make))
> + (cmd (plist-get pkg-spec :shell-command)))
> + (when (or cmd target)
> + (with-current-buffer (get-buffer-create " *package-vc make*")
^
should the package name
be mentioned here?
> + (erase-buffer)
> + (when (and cmd
> + (/= 0 (package-vc--call t shell-file-name
> + shell-command-switch
> + cmd)))
> + (message "Failed to run %s, see buffer %S"
Could `warn' be a better candidate here, instead of `message'?
> + cmd (buffer-name)))
> + (when (and target
> + (/= 0 (apply #'package-vc--call t "make"
> + (if (consp target) target (list target)))))
> + (message "Failed to make %s, see buffer %S"
> + target (buffer-name)))))))
> +
> (declare-function org-export-to-file "ox" (backend file))
>
> (defun package-vc--build-documentation (pkg-desc file)
> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
> ;; Generate package file
> (package-vc--generate-description-file pkg-desc pkg-file)
>
> + ;; Process :make and :shell-command arguments before building documentation
> + (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
Wasn't the plan to allow `package-vc-process-make' to either be a
generic "build-anything" or a selective listing of packages where we
allow :make and :shell-command to be executed?
> +
> ;; Detect a manual
> (when (executable-find "install-info")
> (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
Otherwise this looks good, but I haven't tried it out yet.
--
Philip Kaludercic
This bug report was last modified 2 years and 65 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.