From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cP1VI6cmK2HsfwEAgWs5BA (envelope-from ) for ; Sun, 29 Aug 2021 08:18:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id eLDMHqcmK2GoZQAAbx9fmQ (envelope-from ) for ; Sun, 29 Aug 2021 06:18:15 +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 EA8E320AF for ; Sun, 29 Aug 2021 08:18:14 +0200 (CEST) Received: from localhost ([::1]:34042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKE90-0007nW-4J for larch@yhetil.org; Sun, 29 Aug 2021 02:18:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKE8p-0007nI-Dc for guix-patches@gnu.org; Sun, 29 Aug 2021 02:18:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKE8p-0005vc-5T for guix-patches@gnu.org; Sun, 29 Aug 2021 02:18:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKE8p-0006C5-1Z for guix-patches@gnu.org; Sun, 29 Aug 2021 02:18:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50227] [PATCH 3/3] gnu: go-gotest-tools-assert: Provide internal inputs with the source. References: <20210827151052.12611-1-marius@gnu.org> Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Aug 2021 06:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50227 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Marius Bakke Cc: 50227@debbugs.gnu.org Received: via spool by 50227-submit@debbugs.gnu.org id=B50227.163021785723761 (code B ref 50227); Sun, 29 Aug 2021 06:18:02 +0000 Received: (at 50227) by debbugs.gnu.org; 29 Aug 2021 06:17:37 +0000 Received: from localhost ([127.0.0.1]:55390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKE8K-0006B7-7A for submit@debbugs.gnu.org; Sun, 29 Aug 2021 02:17:37 -0400 Received: from out1.migadu.com ([91.121.223.63]:51373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKE8D-0006Am-8U for 50227@debbugs.gnu.org; Sun, 29 Aug 2021 02:17:30 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1630217843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to; bh=JbeddNd+BPQPP8D/ILI269DySsSuuM/b9jGNWJdZBAk=; b=fntenSRiZzSFEHLCvtJPdV3Dj1sb8dLP1H3Hz/NZJC+4rbUaW9H043zxOZwj1F5EwPXsD8 yPZA92+a1921DdwGEkNX4dVfuQVS5gx5pb3qjn9TfrGCCa1Z5Em66ew8otT1j319g2Yc1Z bFRllTJBsdqsqbxLjZPQDpUw51GqcpI= From: Sarah Morgensen Date: Sat, 28 Aug 2021 23:17:21 -0700 In-Reply-To: Marius Bakke's message of "Fri, 27 Aug 2021 17:13:30 +0200 (1 day, 8 hours, 16 minutes ago)" Message-ID: <8635qs3hce.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Auth-User: iskarian@mgsn.dev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630217895; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=JbeddNd+BPQPP8D/ILI269DySsSuuM/b9jGNWJdZBAk=; b=Bvyaii7TrlqM8gt7TNRMoppSbxT9L4MS0FgRVA8iykiN37snzN3pejD6c/IbyvrS1Nio+P 2YFEa/JT0+eJv5QetMKtB1zJrkBx/afXN9GnuybzNPrn43s6DxeFzPsjeyjtbE9YTFkaJN RWoS0QKxz2A+unVpbOV5piTeLo6Z/ZTTctubzSL4aE4nDincxXp0a0rxrhUW97dO2vCFa+ 0+DRrpxPBre/BuLRefyGoyW/MNkeIPLEGtQG62ZkO7EYkICw95UkN2hykxKHM6TTjzdTDH cGyFkXISXpAksK9QWp9ThIUfg40mVULpwXT2BZf3bDmz6LsnUrwAt6CN3rxjVA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630217895; a=rsa-sha256; cv=none; b=HYPNfD7XBtrnBrFtK4ft4ss2JRpYQZYuX67Md2bcy+wHlERM9JS7tY2aInooGbLFsTzbxT QA9GlGFOjLNi3okfyJIm/GqMUY8Dui7quiLvoj3p55Um/KC4XjY9BsBPMrmAQXEjcLXGNd FiwDVnuLKtbGZTsgUlhkZmk6uCLJ5F1WWSOxadFho4Gwv0PpCWIHt4Xml1oOHBVYcpxL+2 S6uvTZ3ZrxtFPCAVd5Rw6Q86kmWjA+vqQa7B2RV+LsOEceTMZoYbKNGL1IUKDTp8F6+AAx us4WzCHA7EcedBCV4as0vIPw/vCOYTNvGPdD9viBFv34bGU3DbGe1dK6Ng8Tzw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=fntenSRi; 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-Migadu-Spam-Score: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=fntenSRi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (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-Migadu-Queue-Id: EA8E320AF X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: LfkNDWvsm9/J Hello, Marius Bakke writes: > * gnu/packages/golang.scm (go-gotest-tools-assert)[inputs]: Add > GO-GOTEST-TOOLS-INTERNAL-FORMAT, GO-GOTEST-TOOLS-INTERNAL-DIFFLIB, and > GO-GOTEST-TOOLS-INTERNAL-SOURCE. > [arguments]: Add phase to install a union of the above inputs. > * gnu/packages/golang.scm (gotestsum)[native-inputs]: Don't add the above > mentioned inputs. > --- > gnu/packages/golang.scm | 45 +++++++++++++++++++++++++++-------------- > 1 file changed, 30 insertions(+), 15 deletions(-) > > diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm > index 3a5c6ddc3f..295b442a2a 100644 > --- a/gnu/packages/golang.scm > +++ b/gnu/packages/golang.scm > @@ -20,7 +20,7 @@ > ;;; Copyright =C2=A9 2020 Jakub K=C4=85dzio=C5=82ka > ;;; Copyright =C2=A9 2020 Nicolas Goaziou > ;;; Copyright =C2=A9 2020 Ryan Prior > -;;; Copyright =C2=A9 2020 Marius Bakke > +;;; Copyright =C2=A9 2020, 2021 Marius Bakke > ;;; Copyright =C2=A9 2020 raingloom > ;;; Copyright =C2=A9 2020 Martin Becze > ;;; Copyright =C2=A9 2021 Ricardo Wurmus > @@ -5945,9 +5945,35 @@ gotest-tools."))) > (arguments > `(#:tests? #f ; Test failure concerning message formatting (FIXME) > #:import-path "gotest.tools/assert" > - #:unpack-path "gotest.tools")) > - ;(propagated-inputs > - ; `(("go-gotest-tools-internal-format" ,go-gotest-tools-internal-for= mat))) > + #:unpack-path "gotest.tools" > + #:modules ((ice-9 match) > + (srfi srfi-26) > + ,@%go-build-system-modules) > + #:phases > + (modify-phases (@ (guix build go-build-system) %standard-phases) > + (add-before 'install 'install-internal-inputs > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (let ((out (assoc-ref outputs "out"))) > + ;; The Go compiler does not permit importing libraries wi= th > + ;; "internal" in the path from anywhere except below the > + ;; package that uses them. Thus, install these inputs > + ;; alongside this package. > + (union-build > + out > + (match (filter (lambda (input) > + (string-prefix? "go-gotest-tools-intern= al" > + (car input))) > + inputs) > + (((names . directories) ...) directories)) > + #:create-all-directories? #t > + #:log-port (%make-void-port "w")))))))) > + (inputs > + `(("go-gotest-tools-internal-format" > + ,go-gotest-tools-internal-format) > + ("go-gotest-tools-internal-difflib" > + ,go-gotest-tools-internal-difflib) > + ("go-gotest-tools-internal-source" > + ,go-gotest-tools-internal-source))) > (native-inputs > `(("go-github-com-pkg-errors" ,go-github-com-pkg-errors) > ("go-github-com-google-go-cmp-cmp" > @@ -5985,17 +6011,6 @@ test when a comparison fails.") > ,go-github-com-jonboulle-clockwork) > ("go-golang-org-x-crypto" ,go-golang-org-x-crypto) > ("go-gotest-tools-assert" ,go-gotest-tools-assert) > - ("go-github-com-google-go-cmp-cmp" > - ,go-github-com-google-go-cmp-cmp) > - ;; TODO: This would be better as a propagated-input of > - ;; go-gotest-tools-assert, but that does not work for > - ;; some reason. > - ("go-gotest-tools-internal-format" > - ,go-gotest-tools-internal-format) > - ("go-gotest-tools-internal-difflib" > - ,go-gotest-tools-internal-difflib) > - ("go-gotest-tools-internal-source" > - ,go-gotest-tools-internal-source) > ("go-github-com-google-go-cmp-cmp" > ,go-github-com-google-go-cmp-cmp))) > (synopsis "Go test runner with output optimized for humans") Just piggybacking off this to add that I believe the "correct" way forward to handle packages like these is to put all of them in a single go-gotest-tools package, and modify the build system to build them all. I've tested a proof-of-concept of this, based off of what Debian does [0]. Essentially: 1. Add two arguments to the build system, GO-PACKAGES-INCLUDE and GO-PACKAGES-EXCLUDE. GO-PACKAGES-INCLUDE defaults to something like '("IMPORT-PATH/...") and GO-PACKAGES-EXCLUDE defaults to the empty list. 2. Run "go list GO-PACKAGES-INCLUDE", which lists all packages matching GO-PACKAGES-INCLUDE. 3. Remove any packages matching GO-PACKAGES-EXCLUDE (should this be a regex? I'm not sure), leaving us with GO-PACKAGES. 4. Run "go install ... GO-PACKAGES" >From my testing, this causes a LOT of packages to need edits, because it surfaces a lot of hidden bugs. For example, suppose we have a Guix package "go-B-tool" with import path "B/tool" and another Guix package "go-use-B" which imports "B/tool/extra". If "B/tool/extra" is not imported by "B/tool", we will not have actually built or tested "B/tool/extra" so we will only encounter issues when building "go-use-B", even those the actual issue should be addressed in "go-B-tool". In the case of the above package, we would merge all go-gotest-tools packages into a go-gotest-tools-v3 package, with the import path "gotest.tools/v3", which is what its go.mod states. (Note that none of the sub-packages have their own go.mod, so it would cause issues down the road with the module system to have each of those sub-packages be a Guix package.) With the above build-system changes, all of the previously-separate packages would be built and tested together. (If we wanted to exclude a problematic package which we didn't need, we could remove the directory in a snippet.) Depending on how many packages are affected, perhaps this part will warrant a wip-go-build-system branch? [0] https://manpages.debian.org/testing/dh-golang/Debian::Debhelper::Builds= ystem::golang.3pm.en.html -- Sarah