From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e37ha-0002W5-1P for guix-patches@gnu.org; Fri, 13 Oct 2017 17:41:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e37hW-00018W-0h for guix-patches@gnu.org; Fri, 13 Oct 2017 17:41:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:58089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e37hV-00018N-SY for guix-patches@gnu.org; Fri, 13 Oct 2017 17:41:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e37hV-0007dU-M0 for guix-patches@gnu.org; Fri, 13 Oct 2017 17:41:01 -0400 Subject: [bug#28787] [PATCH 1/2] emacs-build-system: Handle missing programs when patching. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20171011154029.16fe9aa4@cbaines.net> <20171011144218.26718-1-mail@cbaines.net> Date: Fri, 13 Oct 2017 23:40:02 +0200 In-Reply-To: <20171011144218.26718-1-mail@cbaines.net> (Christopher Baines's message of "Wed, 11 Oct 2017 15:42:17 +0100") Message-ID: <871sm6zpzh.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Christopher Baines Cc: 28787@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! Christopher Baines skribis: > Previously the string-append here would error, which isn't useful as it > doesn't tell you which command couldn't be found. To make the error > actionable, catch it earlier, and explicitly error. > > * guix/build/emacs-build-system.scm (patch-el-files): Handle (which cmd) > returning #f. > --- > guix/build/emacs-build-system.scm | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-s= ystem.scm > index 2404dbddb..0260f15bb 100644 > --- a/guix/build/emacs-build-system.scm > +++ b/guix/build/emacs-build-system.scm > @@ -93,7 +93,12 @@ store in '.el' files." > (substitute-cmd (lambda () > (substitute* (find-files "." "\\.el$") > (("\"/bin/([^.].*)\"" _ cmd) > - (string-append "\"" (which cmd) "\"")))))) > + (string-append > + "\"" > + (or > + (which cmd) > + (error "patch-el-files: unable to locate= " cmd)) > + "\"")))))) For clarity I=E2=80=99d move the =E2=80=98error=E2=80=99 call out of the wa= y: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 2404dbddb..bafb1060b 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -93,7 +93,10 @@ store in '.el' files." (substitute-cmd (lambda () (substitute* (find-files "." "\\.el$") (("\"/bin/([^.].*)\"" _ cmd) - (string-append "\"" (which cmd) "\"")))))) + (let ((cmd (which cmd))) + (unless cmd + (error "...")) + (string-append "\"" cmd "\""))))))) (with-directory-excursion el-dir ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still encoded ;; with the "ISO-8859-1" locale. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Otherwise LGTM! Thanks, Ludo=E2=80=99. --=-=-=--