From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id IClKDXyGYl+tEAAA0tVLHw (envelope-from ) for ; Wed, 16 Sep 2020 21:41:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6IEyCXyGYl8EQgAA1q6Kng (envelope-from ) for ; Wed, 16 Sep 2020 21:41:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E191940606 for ; Wed, 16 Sep 2020 21:41:15 +0000 (UTC) Received: from localhost ([::1]:60382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIfAv-0004YB-Ut for larch@yhetil.org; Wed, 16 Sep 2020 17:41:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIfAk-0004X8-DK for guix-patches@gnu.org; Wed, 16 Sep 2020 17:41:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53390) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIfAj-0002Kh-Ul for guix-patches@gnu.org; Wed, 16 Sep 2020 17:41:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kIfAj-0004fL-PR for guix-patches@gnu.org; Wed, 16 Sep 2020 17:41:01 -0400 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 X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=lepiller.eu header.s=dkim header.b=hD+tJPD2; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: CIT78vaNTiWL --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--