From unknown Sat Aug 09 13:13:33 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43458] [PATCH] guix: build: Add a hint for unspecified value Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Sep 2020 21:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43458 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43458@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160029243817897 (code B ref -1); Wed, 16 Sep 2020 21:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Sep 2020 21:40:38 +0000 Received: from localhost ([127.0.0.1]:36703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIfAM-0004eb-4S for submit@debbugs.gnu.org; Wed, 16 Sep 2020 17:40:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:55022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIfAK-0004eT-I4 for submit@debbugs.gnu.org; Wed, 16 Sep 2020 17:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIfAI-0004UV-T7 for guix-patches@gnu.org; Wed, 16 Sep 2020 17:40:36 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:47926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIfAE-00029i-PT for guix-patches@gnu.org; Wed, 16 Sep 2020 17:40:33 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id e69fdad1 for ; Wed, 16 Sep 2020 21:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=iJM SJf+uqbsu9CpkE1K3M9EcqYW571RA2Rtwny41/xo=; b=hD+tJPD2OuNbjidTjpz ov6rrjGKR45J6XA9uRQVkYg19zwoEpb3Vn13PNoks/Gt7bMtw2mlcdsXOBQrNEJD k3po6ZmF1ICREUMkEZ1LCTb2c5g/iNDNEJDPlxq2qnomMecg6jjp3DOhYjUK9dOg GkKE7R+Spuj92q5kPFlsL9xjB433U5tGWckpNpbiG/uMR4FpeaaOd/RSSepULGkY eIFHVS6gqBF+cstCNdHeHKThH8tai9qrgbtleLCe1X+cn9k+MoDVBNDhZdlX2xr4 jMrhCkxZhWdVAh++SO/VEgE0HEIL4mumaAXqehCMnghmKKuSVf8qyPVRjWR0Mdd+ 8gA== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id c5c11e80 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Wed, 16 Sep 2020 21:40:18 +0000 (UTC) Date: Wed, 16 Sep 2020 23:40:03 +0200 From: Julien Lepiller Message-ID: <20200916234003.35f2ac07@tachikoma.lepiller.eu> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/io6FxfIbjSKQo80o8=mk4lB" Received-SPF: none client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=lepiller.eu X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --MP_/io6FxfIbjSKQo80o8=mk4lB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Guix! this patch adds a hint to guix build, when you try to build from a file and it returns #. The most common error is when you copy the structure from other guix modules and use `define-public` for your package. The file returns # and you get this message: > #: not something we can build. Which is not very helpful. Here is what happens with this change: > guix build: error: #: not something we can build > > hint: If you build from a file, make sure the last scheme expression > returns a package value. `define-public' defines a variable, but > returns #. To fix this, add a scheme expression at the > end of the file that consists only of the package's variable name you > defined. ex: > > (define-public my-package > (package > ...)) > > my-package If instead, you return a value that is not understood, the message is simpler (as this is not something that happens out of confusion / being new to guix or guile): > guix build: error: 1: not something we can build > > hint: If you build from a file, make sure the last scheme expression > returns a package, gexp, derivation value or a list of such values. (here the file returned "1" which we can't build :)) --MP_/io6FxfIbjSKQo80o8=mk4lB Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-build-Add-a-hint-for-unspecified-value.patch >From b29a325ef52d402c9618bfe9f02e478134297c0f Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 16 Sep 2020 23:32:00 +0200 Subject: [PATCH] guix: build: Add a hint for unspecified value. * guix/scripts/build.scm (options->things-to-build): Add a hint when we cannot build something. --- guix/scripts/build.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 25418661b9..46d1415a4d 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -38,6 +38,7 @@ #:use-module (guix monads) #:use-module (guix gexp) #:use-module (guix profiles) + #:use-module (guix diagnostics) #:autoload (guix http-client) (http-fetch http-get-error?) #:use-module (ice-9 format) #:use-module (ice-9 match) @@ -46,6 +47,7 @@ #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:use-module (srfi srfi-37) #:use-module (gnu packages) #:autoload (guix download) (download-to-store) @@ -805,7 +807,27 @@ must be one of 'package', 'all', or 'transitive'~%") build---packages, gexps, derivations, and so on." (define (validate-type x) (unless (or (derivation? x) (file-like? x) (gexp? x) (procedure? x)) - (leave (G_ "~s: not something we can build~%") x))) + (raise (make-compound-condition + (formatted-message (G_ "~s: not something we can build~%") x) + (condition + (&fix-hint + (hint + (if (unspecified? x) + (G_ "If you build from a file, make sure the last scheme +expression returns a package value. @code{define-public} defines a variable, +but returns #. To fix this, add a scheme expression at the end of +the file that consists only of the package's variable name you defined. ex: + +@example +(define-public my-package + (package + ...)) + +my-package +@end example") + (G_ "If you build from a file, make sure the last scheme +expression returns a package, gexp, derivation value or a list of such +values."))))))))) (define (ensure-list x) (let ((lst (match x -- 2.28.0 --MP_/io6FxfIbjSKQo80o8=mk4lB-- From unknown Sat Aug 09 13:13:33 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43458] [PATCH] guix: build: Add a hint for unspecified value Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Sep 2020 20:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43458 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Julien Lepiller Cc: 43458@debbugs.gnu.org Received: via spool by 43458-submit@debbugs.gnu.org id=B43458.160046133823858 (code B ref 43458); Fri, 18 Sep 2020 20:36:01 +0000 Received: (at 43458) by debbugs.gnu.org; 18 Sep 2020 20:35:38 +0000 Received: from localhost ([127.0.0.1]:44555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJN6X-0006Cj-Pp for submit@debbugs.gnu.org; Fri, 18 Sep 2020 16:35:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJN6W-0006CT-HJ for 43458@debbugs.gnu.org; Fri, 18 Sep 2020 16:35:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56701) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJN6O-0004hg-FV; Fri, 18 Sep 2020 16:35:29 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45412 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kJN6N-0001r3-Sr; Fri, 18 Sep 2020 16:35:28 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200916234003.35f2ac07@tachikoma.lepiller.eu> Date: Fri, 18 Sep 2020 22:35:26 +0200 In-Reply-To: <20200916234003.35f2ac07@tachikoma.lepiller.eu> (Julien Lepiller's message of "Wed, 16 Sep 2020 23:40:03 +0200") Message-ID: <87lfh6u8kx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Julien Lepiller skribis: >>>From b29a325ef52d402c9618bfe9f02e478134297c0f Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Wed, 16 Sep 2020 23:32:00 +0200 > Subject: [PATCH] guix: build: Add a hint for unspecified value. ^ I tend to use =E2=80=9Cguix build:=E2=80=9D as the prefix for this file. > * guix/scripts/build.scm (options->things-to-build): Add a hint when we > cannot build something. Great idea! > + (raise (make-compound-condition > + (formatted-message (G_ "~s: not something we can build~%"= ) x) > + (condition > + (&fix-hint > + (hint > + (if (unspecified? x) > + (G_ "If you build from a file, make sure the last= scheme > +expression returns a package value. @code{define-public} defines a vari= able, > +but returns #. To fix this, add a scheme expression at the= end of ^ @code > +the file that consists only of the package's variable name you defined. = ex: s/. ex:/as in this example:/ > +@example > +(define-public my-package > + (package > + ...)) > + > +my-package > +@end example") > + (G_ "If you build from a file, make sure the last= scheme > +expression returns a package, gexp, derivation value or a list of such > +values."))))))))) s/derivation value/derivation/ Also s/scheme/Scheme/ throughout. OK with these changes, thank you! Ludo=E2=80=99. From unknown Sat Aug 09 13:13:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Julien Lepiller Subject: bug#43458: closed (Re: [bug#43458] [PATCH] guix: build: Add a hint for unspecified value) Message-ID: References: <20200929151605.64af296c@tachikoma.lepiller.eu> <20200916234003.35f2ac07@tachikoma.lepiller.eu> X-Gnu-PR-Message: they-closed 43458 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 43458@debbugs.gnu.org Date: Tue, 29 Sep 2020 13:17:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1601385423-28441-1" This is a multi-part message in MIME format... ------------=_1601385423-28441-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #43458: [PATCH] guix: build: Add a hint for unspecified value which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 43458@debbugs.gnu.org. --=20 43458: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D43458 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1601385423-28441-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 43458-done) by debbugs.gnu.org; 29 Sep 2020 13:16:32 +0000 Received: from localhost ([127.0.0.1]:55206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNFUd-0007NX-QK for submit@debbugs.gnu.org; Tue, 29 Sep 2020 09:16:31 -0400 Received: from lepiller.eu ([89.234.186.109]:50852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNFUb-0007NO-Lc for 43458-done@debbugs.gnu.org; Tue, 29 Sep 2020 09:16:30 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 90f97f16; Tue, 29 Sep 2020 13:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=dkim; bh=jzHCaMHs3wNK Wue4RFdCqYx7ns3hAbiJYt2cnskFsZw=; b=WX71YhWxfQz95hNsLYA4A0IzhgvX 6jVKQihGOXjCedslk8C+zWJ2yvgN+6MZkay+RzvY/n4p6LBkJzLECWlzbega7CCs ab0629p1Ze/hrWW0Bx50qbRaL3VipgRKjhkcSyF3CpGoqcryA4eylH1KTNRbsFrs flu+lq7TKW6ZkJMHJtbx7n02GGzsfKbINklzhfzfHTGx2tBDLySecUi9NTciLuUb ymR359lk22Aq5GLMLikIIJrklSM1p3tVqZCnmK4UAJAAvBFdhgEokXFD3L60JyY0 9SXgk21dd6mlOHdjvkjAG/NLdEdWiLI/DEfgko7ZrobCX5WqGRfurLKYug== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 138ace05 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 29 Sep 2020 13:16:27 +0000 (UTC) Date: Tue, 29 Sep 2020 15:16:05 +0200 From: Julien Lepiller To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Subject: Re: [bug#43458] [PATCH] guix: build: Add a hint for unspecified value Message-ID: <20200929151605.64af296c@tachikoma.lepiller.eu> In-Reply-To: <87lfh6u8kx.fsf@gnu.org> References: <20200916234003.35f2ac07@tachikoma.lepiller.eu> <87lfh6u8kx.fsf@gnu.org> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 43458-done Cc: 43458-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pushed as e75443d4f28ff1aa97e545f2b47b311c3a5ac32a, thanks for the review! ------------=_1601385423-28441-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 Sep 2020 21:40:38 +0000 Received: from localhost ([127.0.0.1]:36703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIfAM-0004eb-4S for submit@debbugs.gnu.org; Wed, 16 Sep 2020 17:40:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:55022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIfAK-0004eT-I4 for submit@debbugs.gnu.org; Wed, 16 Sep 2020 17:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIfAI-0004UV-T7 for guix-patches@gnu.org; Wed, 16 Sep 2020 17:40:36 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:47926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIfAE-00029i-PT for guix-patches@gnu.org; Wed, 16 Sep 2020 17:40:33 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id e69fdad1 for ; Wed, 16 Sep 2020 21:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=iJM SJf+uqbsu9CpkE1K3M9EcqYW571RA2Rtwny41/xo=; b=hD+tJPD2OuNbjidTjpz ov6rrjGKR45J6XA9uRQVkYg19zwoEpb3Vn13PNoks/Gt7bMtw2mlcdsXOBQrNEJD k3po6ZmF1ICREUMkEZ1LCTb2c5g/iNDNEJDPlxq2qnomMecg6jjp3DOhYjUK9dOg GkKE7R+Spuj92q5kPFlsL9xjB433U5tGWckpNpbiG/uMR4FpeaaOd/RSSepULGkY eIFHVS6gqBF+cstCNdHeHKThH8tai9qrgbtleLCe1X+cn9k+MoDVBNDhZdlX2xr4 jMrhCkxZhWdVAh++SO/VEgE0HEIL4mumaAXqehCMnghmKKuSVf8qyPVRjWR0Mdd+ 8gA== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id c5c11e80 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Wed, 16 Sep 2020 21:40:18 +0000 (UTC) Date: Wed, 16 Sep 2020 23:40:03 +0200 From: Julien Lepiller To: guix-patches@gnu.org Subject: [PATCH] guix: build: Add a hint for unspecified value Message-ID: <20200916234003.35f2ac07@tachikoma.lepiller.eu> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/io6FxfIbjSKQo80o8=mk4lB" Received-SPF: none client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=lepiller.eu X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --MP_/io6FxfIbjSKQo80o8=mk4lB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Guix! this patch adds a hint to guix build, when you try to build from a file and it returns #. The most common error is when you copy the structure from other guix modules and use `define-public` for your package. The file returns # and you get this message: > #: not something we can build. Which is not very helpful. Here is what happens with this change: > guix build: error: #: not something we can build > > hint: If you build from a file, make sure the last scheme expression > returns a package value. `define-public' defines a variable, but > returns #. To fix this, add a scheme expression at the > end of the file that consists only of the package's variable name you > defined. ex: > > (define-public my-package > (package > ...)) > > my-package If instead, you return a value that is not understood, the message is simpler (as this is not something that happens out of confusion / being new to guix or guile): > guix build: error: 1: not something we can build > > hint: If you build from a file, make sure the last scheme expression > returns a package, gexp, derivation value or a list of such values. (here the file returned "1" which we can't build :)) --MP_/io6FxfIbjSKQo80o8=mk4lB Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-build-Add-a-hint-for-unspecified-value.patch >From b29a325ef52d402c9618bfe9f02e478134297c0f Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 16 Sep 2020 23:32:00 +0200 Subject: [PATCH] guix: build: Add a hint for unspecified value. * guix/scripts/build.scm (options->things-to-build): Add a hint when we cannot build something. --- guix/scripts/build.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 25418661b9..46d1415a4d 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -38,6 +38,7 @@ #:use-module (guix monads) #:use-module (guix gexp) #:use-module (guix profiles) + #:use-module (guix diagnostics) #:autoload (guix http-client) (http-fetch http-get-error?) #:use-module (ice-9 format) #:use-module (ice-9 match) @@ -46,6 +47,7 @@ #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:use-module (srfi srfi-37) #:use-module (gnu packages) #:autoload (guix download) (download-to-store) @@ -805,7 +807,27 @@ must be one of 'package', 'all', or 'transitive'~%") build---packages, gexps, derivations, and so on." (define (validate-type x) (unless (or (derivation? x) (file-like? x) (gexp? x) (procedure? x)) - (leave (G_ "~s: not something we can build~%") x))) + (raise (make-compound-condition + (formatted-message (G_ "~s: not something we can build~%") x) + (condition + (&fix-hint + (hint + (if (unspecified? x) + (G_ "If you build from a file, make sure the last scheme +expression returns a package value. @code{define-public} defines a variable, +but returns #. To fix this, add a scheme expression at the end of +the file that consists only of the package's variable name you defined. ex: + +@example +(define-public my-package + (package + ...)) + +my-package +@end example") + (G_ "If you build from a file, make sure the last scheme +expression returns a package, gexp, derivation value or a list of such +values."))))))))) (define (ensure-list x) (let ((lst (match x -- 2.28.0 --MP_/io6FxfIbjSKQo80o8=mk4lB-- ------------=_1601385423-28441-1--