From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args Date: Sun, 07 May 2023 09:03:43 +0000 Message-ID: <87jzxkecnk.fsf@posteo.net> References: <874joprxmx.fsf@breatheoutbreathe.in> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29695"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63336@debbugs.gnu.org To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 07 11:04:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pvaJY-0007Te-Kq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 May 2023 11:04:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvaJI-0006CN-8w; Sun, 07 May 2023 05:04:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pvaJG-0006C7-Fv for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 05:04:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pvaJG-0002X0-7F for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 05:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pvaJG-0003jk-1k for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 05:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2023 09:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63336 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63336-submit@debbugs.gnu.org id=B63336.168345023314348 (code B ref 63336); Sun, 07 May 2023 09:04:02 +0000 Original-Received: (at 63336) by debbugs.gnu.org; 7 May 2023 09:03:53 +0000 Original-Received: from localhost ([127.0.0.1]:36418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvaJ7-0003jL-67 for submit@debbugs.gnu.org; Sun, 07 May 2023 05:03:53 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:34693) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvaJ4-0003j7-0m for 63336@debbugs.gnu.org; Sun, 07 May 2023 05:03:51 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5DC002400D6 for <63336@debbugs.gnu.org>; Sun, 7 May 2023 11:03:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683450224; bh=8ROilfBreDwUIF5VZGJu1p9wUPpiK7066zU+csvDjic=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=XG4MFRcT+LobQpjqkr940bzYJgRN475h/zhzMNVIaEAEt8XfbM+IcdRjOovgtBq0P MCrStgdfyhCi+U8g4/DgmgXZCTSdz1bmbOWUSMen2eLQvJbJkSk/p6hz0r/L1xbPzp qPxclg6JTHuNRLAN7iKloGSI7vbnHxW4kmun0T2b/nXAS8Bvqb80fWfCQD//ftwhYc Dcmv0+vzw4zpK2lrfv4rRHlhbC9LAPQ85zxaKoA58mpG424UJp9KqBkjvzMwNVy5cM FQvKGx1f6D01YCmYd46qEEnMuqWT7qpQkqLGGx78EwSJoT+riXZ98Fnu0dWvl+LGKs cJowVXwcM4hWA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QDdkl61jPz6tn4; Sun, 7 May 2023 11:03:43 +0200 (CEST) In-Reply-To: <874joprxmx.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Sat, 06 May 2023 13:39:52 -0700") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261241 Archived-At: Joseph Turner 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 > 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)))) >=20=20 > +(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 =E2=80=98call-process=E2=80=99 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 > + (/=3D 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 > + (/=3D 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)) >=20=20 > (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) >=20=20 > + ;; Process :make and :shell-command arguments before building docu= mentation > + (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. --=20 Philip Kaludercic