GNU bug report logs - #54097
go importer does not honor multi-module repositories

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Björn Höfling <bjoern.hoefling@HIDDEN>; dated Mon, 21 Feb 2022 22:45:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 16 Aug 2023 17:11:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 16 13:11:57 2023
Received: from localhost ([127.0.0.1]:41950 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qWK3p-0005PV-8J
	for submit <at> debbugs.gnu.org; Wed, 16 Aug 2023 13:11:57 -0400
Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40280)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>)
 id 1qWK3i-0005NC-4w; Wed, 16 Aug 2023 13:11:51 -0400
Received: by mail-wm1-x331.google.com with SMTP id
 5b1f17b1804b1-3fe8d816a40so10390875e9.1; 
 Wed, 16 Aug 2023 10:11:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1692205904; x=1692810704;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=mPduG9+ksRVkvzA0Qa/2RSlV1qAxQ2THAGkRputDeZg=;
 b=kf/zrJ6sn6Ce3Oq1u2FvdL+MYum7ZsmvPAkyQHUiLrEjBKympdHsgZynQfGScDOF1o
 2BQN3fnzh1HRd5aoaYx6fyircREuPP8gLC31ioVVkE2SHrQCYUrIz3EfnUcQZgFCTfOU
 W/Y3aGZF9huYCSkRkYqx6mvoQF6bySXdDMOfY2ACbEldc2UDi+q9eMPT79htVNY+gXll
 3ZVxKoslNjhu0CxRLF2h7CVmH6wdTAXRGJHYAExX/B7fHK064983xkbUAQCQU/H9C0jW
 rz9bi0xkre8fRvpLGsZKeLUXkAKkidUp5wBb7pTpW6gQu/2K2y0sNrDOGMmt3LUXh5vR
 q2mg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1692205904; x=1692810704;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=mPduG9+ksRVkvzA0Qa/2RSlV1qAxQ2THAGkRputDeZg=;
 b=VbPNIfHCRrbiXpqYynSpl0ik5yE8GIx7z+1CNuj0/hN6YZc58ajBxNUCkVyNRwaVZW
 MBnYJrkYr/MS65yZiGeImwmxLM+gAftZ04zo2Tx6BfUiHTF/APQaZ7tQIPELMDdZ4T8j
 Vzd5fDpmJ62US3rgA7P8e+a4JJRNOve+ATE0a6o9kQJ8+0g7Z06xfnyyjt+wO/Nn+7ik
 zu3kzGUwNzR5YnjaWlu1Jd/Dh9FVd43Z4ion6/xOPPT/itrYscnsYH+3hi40NCST/SUI
 dGX9TdM+VGd2TpOd/dKSDat7P/xchu+fKQhYUEGH0F7r+BkGCK9fc3+hdnNC6A6RelEi
 Kfrg==
X-Gm-Message-State: AOJu0YyIpJnqhljehCVLaRbnZsK6h/L6ypcU6041Rj8HMugICWyzb1Ph
 2wDUzxu6SM07+1vKGCIctrUhy1hzX7w=
X-Google-Smtp-Source: AGHT+IHmilbFgjYL6fX4qMtQ41+nKvDUIBegmVp8/JhAgr/rcW2U0mhfwGfdJpaohGClqYJCSLltpQ==
X-Received: by 2002:a5d:67cc:0:b0:317:3d36:b2c1 with SMTP id
 n12-20020a5d67cc000000b003173d36b2c1mr1874230wrw.7.1692205904567; 
 Wed, 16 Aug 2023 10:11:44 -0700 (PDT)
Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id
 e15-20020adff34f000000b0031980ae286asm8026512wrp.70.2023.08.16.10.11.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 16 Aug 2023 10:11:44 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: Timo Wilken <guix@HIDDEN>, Ludovic =?utf-8?Q?Court=C3=A8s?=
 <ludo@HIDDEN>
Subject: Re: bug#63001: bug#63631: [PATCH] import: go: Handle subpackage
 versioning correctly.
In-Reply-To: <CTF06XBYWPT0.1MV6QA1B2OB98@HIDDEN>
References: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
 <87pm5xrbsg.fsf@HIDDEN> <CTF06XBYWPT0.1MV6QA1B2OB98@HIDDEN>
Date: Wed, 16 Aug 2023 17:59:53 +0200
Message-ID: <875y5ff05i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 54097
Cc: 63631 <at> debbugs.gnu.org, 64036 <at> debbugs.gnu.org, 63647 <at> debbugs.gnu.org,
 64035 <at> debbugs.gnu.org, 63001 <at> debbugs.gnu.org, 54097 <at> debbugs.gnu.org,
 wolf@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Timo,

On Sat, 17 Jun 2023 at 17:12, "Timo Wilken" <guix@HIDDEN> wrote:

>> What would you suggest?  Simon?
>
> Here's a brief comparison between Simon's patches and mine -- Simon's seem to
> contain fixes for a couple more things than mine currently does:
>
> 1. Simon sorts available versions in an error message; this can presumably be
>    merged independently since it doesn't conflict with other patches.
>
> 2. Simon always prepends a "SUBDIR/" prefix to the tag if found, whereas I try
>    to find the plain "vX" tag first, then fall back to "SUBDIR/vX". Judging by
>    https://go.dev/ref/mod#vcs-version, Simon's approach seems more correct.
>    I'll change my implementation to match and try it out.
>
> 3. For detecting the `module-path-subdirectory' in Simon's patches: that's the
>    same approach I used initially, but I found I have to try `(substring
>    module-path (string-length import-prefix))' first (to handle e.g.
>    cloud.google.com/go/*). This is one of the things I haven't submitted
>    yet...

Sorry if I have missed some patches or overlooked something.  Do you
plan to send another patch series handling all?


Cheers,
simon




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 17 Jun 2023 15:13:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 17 11:13:57 2023
Received: from localhost ([127.0.0.1]:52279 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qAXch-0000El-3O
	for submit <at> debbugs.gnu.org; Sat, 17 Jun 2023 11:13:57 -0400
Received: from mx2.mythic-beasts.com ([46.235.227.24]:35093)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <timo@HIDDEN>)
 id 1qAXcc-0000EB-Cs; Sat, 17 Jun 2023 11:13:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=twilken.net
 ; s=mythic-beasts-k1; h=To:From:Subject:Date;
 bh=pLlAjfqsoe+3U3a73MQeHAaM/uSI+UrqGsrVeSKy1QM=; b=zI4HPa8dV46Hjnio0YDducSSwZ
 M29u2+iSJgjnWkngcWfT9SjYDe9ZLcVAF6i1Ndo75UO/OHkpFsGhXUIm1L8Fz/B5Y6Tg3zjvoVFmy
 d2/oqU7XiJvDOnOICpI3cx5UJO/54X/q5T9ko6ub0/iW9+KHQrST+7gIUbsLEFePPVSChBnKxzIj0
 6vl4AibdV6yP/bGdLIvjcfMXs4yCOg/+eCxfY8y0t1VVKYU/YVdRUrSzYPgPYv7nhW0qOEJZKfPL7
 6rRHFmKh51WiRPEO/oUchLlUi9MFuV/F8pPh+ZAd9D/fTIovUzVWesUglqbjMlC1UubueYwa/EPQC
 NdDeVMug==;
Received: by mailhub-hex-d.mythic-beasts.com with esmtpsa (TLS1.3) tls
 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2)
 (envelope-from <timo@HIDDEN>)
 id 1qAXcS-004VRH-W7; Sat, 17 Jun 2023 16:13:41 +0100
Content-Type: multipart/signed;
 boundary=dc3bfcd0ce40fc9a1a65ded3476be064f73442d113438739c89741eeba4a;
 micalg=pgp-sha256; protocol="application/pgp-signature"
Date: Sat, 17 Jun 2023 17:12:58 +0200
Subject: Re: bug#63631: [PATCH] import: go: Handle subpackage versioning
 correctly.
From: "Timo Wilken" <guix@HIDDEN>
To: =?utf-8?q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
Message-Id: <CTF06XBYWPT0.1MV6QA1B2OB98@HIDDEN>
X-Mailer: aerc 0.14.0
References: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
 <87pm5xrbsg.fsf@HIDDEN>
In-Reply-To: <87pm5xrbsg.fsf@HIDDEN>
X-BlackCat-Spam-Score: 16
X-Spam-Status: No, score=1.6
X-Spam-Score: 0.1 (/)
X-Debbugs-Envelope-To: 54097
Cc: 63631 <at> debbugs.gnu.org, 64036 <at> debbugs.gnu.org,
 Simon Tournier <zimon.toutoune@HIDDEN>, 63647 <at> debbugs.gnu.org,
 64035 <at> debbugs.gnu.org, 63001 <at> debbugs.gnu.org, 54097 <at> debbugs.gnu.org,
 wolf@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.9 (/)

--dc3bfcd0ce40fc9a1a65ded3476be064f73442d113438739c89741eeba4a
Mime-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

Hi Ludo', (hi everyone,)

On Wed Jun 14, 2023 at 11:09 PM CEST, Ludovic Court=C3=A8s wrote:
> Timo Wilken <guix@HIDDEN> skribis:
> > Here's a patch that fixes the reported issue (bug#54097) for me. I've o=
nly
> > tested this on the github.com/googleapis/google-cloud-go/compute packag=
e so
> > far, though it seems to work there. Perhaps others have more testcases?
> >
> > I don't know enough about Go tooling to use it, so I've just patched th=
e Guile
> > logic of the importer. (I don't write Go, I just want to package stuff =
written
> > in it.) In terms of performance, at least the repo contents are apparen=
tly
> > cached by the first `git-checkout-hash' call, even if it fails, so the =
second
> > call doesn't have to redownload them.

I've been testing my patch further this weekend, and I have a couple more
patches in the pipeline; I suppose I ought to clean those up and submit the=
m.

In particular, I've got fixes for the following queued up locally:

1. Finding the `module-path-subdir' needs another case for e.g.
   cloud.google.com/go/*.

2. My patch sometimes generates an unnecessary `go-version->git-ref' call.

3. Go versions need to be parsed from go.mod, since some packages require a
   newer Go compiler than our default. This I've got a patch for, but this =
Go
   version also ought to propagate up the dependency tree. I haven't found =
an
   easy way to do that, since the importer seems to generate top-level
   packages first, before descending the dep tree...

4. `fetch-module-meta-data' ought to ignore 4xx HTTP errors to follow the
   spec; gonum.org/v1/gonum specifically depends on this behaviour.

I've been trying to recursively import github.com/matrix-org/dendrite, whic=
h
has a particularly large and hairy dependency tree. While I can now import =
it
without crashes, I can't build it from the imported package definitions yet=
 --
mainly because of lots of dependency cycles in the generated packages, but
there may be more issues hidden beneath that.

Still, I can recommend it as a test of everyone's importer patches, since
it'll find a lot of edge cases in importing alone!

> What you propose looks similar to part of the work Simon Tournier
> submitted at <https://issues.guix.gnu.org/63647>.

It seems lots of people have been working on the same problem -- in additio=
n
to Simon's patches, I found a patch submitted by Elbek (issues 64035 & 6403=
6;
Cc'd). I also forgot about the issue I submitted months ago (63001)...

> What would you suggest?  Simon?

Here's a brief comparison between Simon's patches and mine -- Simon's seem =
to
contain fixes for a couple more things than mine currently does:

1. Simon sorts available versions in an error message; this can presumably =
be
   merged independently since it doesn't conflict with other patches.

2. Simon always prepends a "SUBDIR/" prefix to the tag if found, whereas I =
try
   to find the plain "vX" tag first, then fall back to "SUBDIR/vX". Judging=
 by
   https://go.dev/ref/mod#vcs-version, Simon's approach seems more correct.
   I'll change my implementation to match and try it out.

3. For detecting the `module-path-subdirectory' in Simon's patches: that's =
the
   same approach I used initially, but I found I have to try `(substring
   module-path (string-length import-prefix))' first (to handle e.g.
   cloud.google.com/go/*). This is one of the things I haven't submitted
   yet...

> Thanks for the patch, Timo!

Thanks for your work in sorting through all of this, Ludo'!

Cheers,
Timo

--dc3bfcd0ce40fc9a1a65ded3476be064f73442d113438739c89741eeba4a
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEU+w8BoVog92SNVvCL8eFBGgfabAFAmSNzaUACgkQL8eFBGgf
abDEaA//Y6k/Uckhvq+wllES0TjACxVG+2bY2E/wLZNoQShXF5Tn3ZQ9o2HOU7Gr
p8er/t/JkPLYm9w2MidUtvTms6qxp8H/YIZ12gzZ+GP/eoKa/iiqt42+KZvLS/Is
B2JWEcaJLFYy0w9nuubeuQpgcWEmxyk7/zb++GovD0tfYgczII3N1Z5fhRmeAj0N
FbKqfkBocxruYvBfcI5KhMV6Q1TjCwuAH+j2iwNmsiSnm7NTKbJxfCyO9+p5UF9w
O/em01p9J+Cg6EEFunwoi1pjoEAkVZCRtgaiP1SMgapq74UKKagvsWqMoW+JHpDf
uuiaVn1sLuTt+u9KGamYqaCj1NRcCfN7SjPxS7oTM4hsytVDmUB/eIHD6t3HntCP
Ev43fJKJwLoybQV0ptajnJggEEaEY1cegQG683jsD0ycrToh4YEhLe5fQsGhaLMA
7MSLjjf0K73BoFyZi+wYyfDPYqXRQmpb3Z6cKJPlF3v4IF13UtSxP0yBRdz930aI
1b1Q5khLQzQBI0fvxMNcZGPeA2RjPyNsXE8pKn9zEkIunzX9VYN8az++EjX928Ox
mmgjEUsLWMPCSMwGcEoZye6R5wJUG34LEkoQTbySf+314hlELPuGcLCatFgZZbXq
1Hn1upt13XYRYVCX/SXIpBJL9gdNbi2sSg8FVm4Aq+sQQqZzAKs=
=fjJn
-----END PGP SIGNATURE-----

--dc3bfcd0ce40fc9a1a65ded3476be064f73442d113438739c89741eeba4a--




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 14 Jun 2023 21:09:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 14 17:09:47 2023
Received: from localhost ([127.0.0.1]:45548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q9XkQ-0004qt-Of
	for submit <at> debbugs.gnu.org; Wed, 14 Jun 2023 17:09:47 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42742)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>)
 id 1q9XkO-0004qY-TB; Wed, 14 Jun 2023 17:09:45 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1q9XkH-0004vN-UY; Wed, 14 Jun 2023 17:09:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=dSdA3DtXQsPoFBK1nu9YIiRoX1fKSVyF3CAiTtvJ3Ag=; b=CSYzUy1OF3nQO6NYSypv
 HM4AwqDmPv33nptVZL1fr7W5XOseD1w1xaNRsa2+4oU7CPI9nCPyU0pAw2znjTXABMLXtxUh7KB8g
 3YvHHDk9o9kCOfw67oScqWX4OvzO6KbdbdBwgXuy2Y+n3MaIvUxg7t/cA5BPmD4GoA+JIiDKzpsZu
 FPXcPxB7WqzRONx0siODTV+zZXwuGnqo7sZudo+QUKX9PggRa2sbxDUfXm7w+bzXUNO61YVCZHVAw
 5WmT8xUC+nNmZf0jDcT4lKabL2lgwg68LEi3RSZL64iwnfgPI4Y4TE4pOZUU2RqYhmklchuOcvk/K
 j36GpFdqYdnThA==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1q9XkH-0001Z1-FY; Wed, 14 Jun 2023 17:09:37 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Timo Wilken <guix@HIDDEN>
Subject: Re: bug#63631: [PATCH] import: go: Handle subpackage versioning
 correctly.
References: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
Date: Wed, 14 Jun 2023 23:09:35 +0200
In-Reply-To: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
 (Timo Wilken's message of "Sun, 21 May 2023 23:18:08 +0200")
Message-ID: <87pm5xrbsg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 54097
Cc: 63647 <at> debbugs.gnu.org, 63631 <at> debbugs.gnu.org,
 Simon Tournier <zimon.toutoune@HIDDEN>, 54097 <at> debbugs.gnu.org,
 wolf@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Timo,

Timo Wilken <guix@HIDDEN> skribis:

> Some Go source repositories (notably the Google Cloud SDK) contain multip=
le
> submodules and use a `refs/tags/<submodule>/<version>' tagging scheme.
>
> Fixes <https://bugs.gnu.org/54097>.
>
> * guix/import/go.scm (vcs->origin): Accept a module-path-suffix.
> (go-module->guix-package): Use the new parameter.
> ---
> Here's a patch that fixes the reported issue (bug#54097) for me. I've only
> tested this on the github.com/googleapis/google-cloud-go/compute package =
so
> far, though it seems to work there. Perhaps others have more testcases?
>
> I don't know enough about Go tooling to use it, so I've just patched the =
Guile
> logic of the importer. (I don't write Go, I just want to package stuff wr=
itten
> in it.) In terms of performance, at least the repo contents are apparently
> cached by the first `git-checkout-hash' call, even if it fails, so the se=
cond
> call doesn't have to redownload them.

What you propose looks similar to part of the work Simon Tournier
submitted at <https://issues.guix.gnu.org/63647>.

What would you suggest?  Simon?

Thanks for the patch, Timo!

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 22 May 2023 19:11:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 22 15:11:52 2023
Received: from localhost ([127.0.0.1]:36630 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1Awh-0005gd-P2
	for submit <at> debbugs.gnu.org; Mon, 22 May 2023 15:11:52 -0400
Received: from mx1.mythic-beasts.com ([46.235.224.141]:48117)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <timo@HIDDEN>) id 1q1Awe-0005gN-W4
 for 54097 <at> debbugs.gnu.org; Mon, 22 May 2023 15:11:50 -0400
Received: by mailhub-cam-d.mythic-beasts.com with esmtpsa (TLS1.3) tls
 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2)
 (envelope-from <timo@HIDDEN>)
 id 1q1AwY-005oCx-W6; Mon, 22 May 2023 20:11:43 +0100
Mime-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Date: Mon, 22 May 2023 21:11:34 +0200
Message-Id: <CST1MCR6Z0PA.2YU25GTLRLRIJ@HIDDEN>
To: "wolf" <wolf@HIDDEN>
Subject: Re: [PATCH] import: go: Handle subpackage versioning correctly.
From: "Timo Wilken" <guix@HIDDEN>
X-Mailer: aerc 0.14.0
References: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
 <ZGqTGVrlJsLi9hxW@ws>
In-Reply-To: <ZGqTGVrlJsLi9hxW@ws>
X-BlackCat-Spam-Score: 7
X-Spam-Status: No, score=0.7
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 54097
Cc: 54097 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi wolf,

On Sun May 21, 2023 at 11:54 PM CEST, wolf wrote:
> Please give the github.com/Azure/go-autorest/tracing@HIDDEN a go.  My cod=
e
> failed on it, and (assuming I applied the patch correctly) your does as w=
ell.
> Here are reproduction steps to make it easier for you (please tell me if =
I did
> something wrong):

I don't think you did anything wrong there.

That's an issue I've run into in the past as well, though it seems to be a =
bug
in the Go build system, not the importer (and in my patch I only touch the
importer).

> I will not pretend to have a full grasp on how (guix build-system go) wor=
ks,
> however my debugging lead me to the observation that it tries to unpack t=
wo
> dependencies into one file system tree overlayed on top of each other.  I=
 think
> the current way (GO111MODULE=3Doff) of building of golang packages does n=
ot play
> very well with well, go modules.

Fair enough! I don't know much about Go -- I don't write software in it, I
just want to package some stuff written in it; in my case, that's
Matrix-related programs.

> Either the build system needs to be smarter about unpacking dependencies =
(and
> doing it in a correct order), or we should start using go modules for the=
 builds
> (it can still be down offline, just the dependencies are in different pat=
hs).
> The second approach is what I wanted to explore, but did not get to it ye=
t (and
> likely will not for a month or two).

Your second approach sounds sensible!

If I can find the time and motivation to dig in to this, I might have a go =
as
well... But if you get anything working, that would be much appreciated! :)

Cheers,
Timo




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 21 May 2023 21:54:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 21 17:54:41 2023
Received: from localhost ([127.0.0.1]:32954 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q0r0i-0002Ik-8A
	for submit <at> debbugs.gnu.org; Sun, 21 May 2023 17:54:41 -0400
Received: from wolfsden.cz ([37.205.8.62]:34778)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ws@HIDDEN>) id 1q0r0f-0002IV-BF
 for 54097 <at> debbugs.gnu.org; Sun, 21 May 2023 17:54:38 -0400
Received: by wolfsden.cz (Postfix, from userid 104)
 id DF9B025BC12; Sun, 21 May 2023 21:54:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1684706074; bh=7jZSQ6kPl4uZBrcrCMjCjeDmk7WiY/3V+1MatjIbtig=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To;
 b=Av1Y3shEepVs1TcQ3YMvzcRZ9vOZQTy4Ib2LT8Vg2a4XBAhSvAJEFaDo+Orga4nbf
 2hEzsxlKbC1UfDirH7Kry2VfN8NrqaFTlY8ujSbp/zhgJiqffKE2ZjLXubOKCVZCW9
 yGFYIKIhI5WpHiAUKNzpKnTTAQpSNycOYKdaZpb3Yao6LuGEi3virJkDDMK06idZMP
 7u0ZEN9fKycaIHnRXF6J2DPbYjMzka/yLyn7tW3wPHhguxImnyp3KU6nzFmEfZSxjv
 y1lhVWkPFEWFwN07HBJuLylQqsUEEey7pyKupxGk0WLFTOwVkBHlCWnxpdIqfM1LHB
 eEmH/7T8nUxR2vmdYrHMLvUnePRWF52NpQjFLoEGaF6FmIDYCX6ODnbR14T7SqDmIe
 ycsUjJK/9spVcP+iJrD3t6G9eJvlNr6VZrpnBUqOYG4VyqDtx1WP3x60zG/0kE7iiq
 Gptw8OBUVZgKVYJi7I/VhL7IP91Y+daMaRW/DI7K56ElPTf7X+mem+hmfbygp0Wg/P
 ipblJjidqrbYsmHRpNZ0o6TEWcNHuy+EnO/PHPVENVBmZKEu0t/c9LGbch7u9UC34e
 8e4Vxc6cN55W7y+VFV6v/2cfTen/aj7JlP7VHcmXw6cN+IlaqspX4qnZayrgKspmw7
 r3TwtDRDdtUzIzVuuTpWsv+c=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
 T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no
 version=3.4.6
Received: from localhost (unknown [128.0.188.242])
 by wolfsden.cz (Postfix) with ESMTPSA id 0EFE125A9EB;
 Sun, 21 May 2023 21:54:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1684706074; bh=7jZSQ6kPl4uZBrcrCMjCjeDmk7WiY/3V+1MatjIbtig=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To;
 b=Av1Y3shEepVs1TcQ3YMvzcRZ9vOZQTy4Ib2LT8Vg2a4XBAhSvAJEFaDo+Orga4nbf
 2hEzsxlKbC1UfDirH7Kry2VfN8NrqaFTlY8ujSbp/zhgJiqffKE2ZjLXubOKCVZCW9
 yGFYIKIhI5WpHiAUKNzpKnTTAQpSNycOYKdaZpb3Yao6LuGEi3virJkDDMK06idZMP
 7u0ZEN9fKycaIHnRXF6J2DPbYjMzka/yLyn7tW3wPHhguxImnyp3KU6nzFmEfZSxjv
 y1lhVWkPFEWFwN07HBJuLylQqsUEEey7pyKupxGk0WLFTOwVkBHlCWnxpdIqfM1LHB
 eEmH/7T8nUxR2vmdYrHMLvUnePRWF52NpQjFLoEGaF6FmIDYCX6ODnbR14T7SqDmIe
 ycsUjJK/9spVcP+iJrD3t6G9eJvlNr6VZrpnBUqOYG4VyqDtx1WP3x60zG/0kE7iiq
 Gptw8OBUVZgKVYJi7I/VhL7IP91Y+daMaRW/DI7K56ElPTf7X+mem+hmfbygp0Wg/P
 ipblJjidqrbYsmHRpNZ0o6TEWcNHuy+EnO/PHPVENVBmZKEu0t/c9LGbch7u9UC34e
 8e4Vxc6cN55W7y+VFV6v/2cfTen/aj7JlP7VHcmXw6cN+IlaqspX4qnZayrgKspmw7
 r3TwtDRDdtUzIzVuuTpWsv+c=
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id b10323c4;
 Sun, 21 May 2023 21:54:33 +0000 (UTC)
Date: Sun, 21 May 2023 23:54:33 +0200
From: wolf <wolf@HIDDEN>
To: Timo Wilken <guix@HIDDEN>
Subject: Re: [PATCH] import: go: Handle subpackage versioning correctly.
Message-ID: <ZGqTGVrlJsLi9hxW@ws>
References: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature"; boundary="iw7hpULjExUreuIc"
Content-Disposition: inline
In-Reply-To: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 54097
Cc: 54097 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)


--iw7hpULjExUreuIc
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

What a coincidence, this week I happened to take a look at this same issue =
(in
my case I wanted to build terraform).  I failed to get it properly working,=
 so
I'm happy someone else took a look at it as well.

On 2023-05-21 23:18:08 +0200, Timo Wilken wrote:
> Some Go source repositories (notably the Google Cloud SDK) contain multip=
le
> submodules and use a `refs/tags/<submodule>/<version>' tagging scheme.
>=20
> Fixes <https://bugs.gnu.org/54097>.
>=20
> * guix/import/go.scm (vcs->origin): Accept a module-path-suffix.
> (go-module->guix-package): Use the new parameter.
> ---
> Here's a patch that fixes the reported issue (bug#54097) for me. I've only
> tested this on the github.com/googleapis/google-cloud-go/compute package =
so
> far, though it seems to work there. Perhaps others have more testcases?

Please give the github.com/Azure/go-autorest/tracing@HIDDEN a go.  My code
failed on it, and (assuming I applied the patch correctly) your does as wel=
l.
Here are reproduction steps to make it easier for you (please tell me if I =
did
something wrong):

    $ echo '(use-modules (guix packages) (guix git-download) (guix build-sy=
stem go) ((guix licenses) #:prefix license:))' >/tmp/x.scm
    $ ./pre-inst-env guix import go -r github.com/Azure/go-autorest/tracing=
@v0.6.0 >>/tmp/x.scm
    $ echo go-github-com-azure-go-autorest-tracing >>/tmp/x.scm
    $ guix build -f /tmp/x.scm
    [..]
    starting phase `unpack'
    `/gnu/store/857z63cfgclsh6g52vj9xnm7iv97yz97-go-github-com-azure-go-aut=
orest-tracing-0.6.0-checkout/.gitignore' -> `/tmp/guix-build-go-github-com-=
azure-go-autorest-tracing-0.6.0.drv-0/src/github.com/Azure/go-autorest/.git=
ignore'
    error: in phase 'unpack': uncaught exception:
    system-error "copy-file" "~A" ("Permission denied") (13)=20
    phase `unpack' failed after 0.0 seconds
    [..]

I will not pretend to have a full grasp on how (guix build-system go) works,
however my debugging lead me to the observation that it tries to unpack two
dependencies into one file system tree overlayed on top of each other.  I t=
hink
the current way (GO111MODULE=3Doff) of building of golang packages does not=
 play
very well with well, go modules.

Either the build system needs to be smarter about unpacking dependencies (a=
nd
doing it in a correct order), or we should start using go modules for the b=
uilds
(it can still be down offline, just the dependencies are in different paths=
).
The second approach is what I wanted to explore, but did not get to it yet =
(and
likely will not for a month or two).

>=20
> I don't know enough about Go tooling to use it, so I've just patched the =
Guile
> logic of the importer. (I don't write Go, I just want to package stuff wr=
itten
> in it.) In terms of performance, at least the repo contents are apparently
> cached by the first `git-checkout-hash' call, even if it fails, so the se=
cond
> call doesn't have to redownload them.
>=20
>  guix/import/go.scm | 56 +++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 43 insertions(+), 13 deletions(-)
>=20
> diff --git a/guix/import/go.scm b/guix/import/go.scm
> index 0357e6a1eb..652ac58b6f 100644
> --- a/guix/import/go.scm
> +++ b/guix/import/go.scm
> @@ -7,6 +7,7 @@
>  ;;; Copyright =A9 2021 Xinglu Chen <public@HIDDEN>
>  ;;; Copyright =A9 2021 Sarah Morgensen <iskarian@HIDDEN>
>  ;;; Copyright =A9 2021 Simon Tournier <zimon.toutoune@HIDDEN>
> +;;; Copyright =A9 2023 Timo Wilken <guix@HIDDEN>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -89,6 +90,7 @@ (define-module (guix import go)
> =20
>  ;;; TODO list
>  ;;; - get correct hash in vcs->origin for Mercurial and Subversion
> +;;; - handle subdir/vX.Y versioning in vcs->origin for Mercurial and Sub=
version
> =20
>  ;;; Code:
> =20
> @@ -513,29 +515,54 @@ (define* (git-checkout-hash url reference algorithm)
>                                            `(tag-or-commit . ,reference))=
)))
>      (file-hash* checkout #:algorithm algorithm #:recursive? #true)))
> =20
> -(define (vcs->origin vcs-type vcs-repo-url version)
> +(define (vcs->origin vcs-type vcs-repo-url module-path-suffix version)
>    "Generate the `origin' block of a package depending on what type of so=
urce
>  control system is being used."
>    (case vcs-type
>      ((git)
> -     (let ((plain-version? (string=3D? version (go-version->git-ref vers=
ion)))
> -           (v-prefixed?    (string-prefix? "v" version)))
> +     (let ((v-prefixed? (string-prefix? "v" version))
> +           (path-prefixed? #f)
> +           (trimmed-path-suffix (string-trim-both module-path-suffix #\/=
))
> +           (checkout-hash (false-if-git-not-found
> +                           (git-checkout-hash
> +                            vcs-repo-url
> +                            (go-version->git-ref version)
> +                            (hash-algorithm sha256)))))
> +       ;; If `checkout-hash' is false, that must mean that a tag named a=
fter
> +       ;; the version doesn't exist.  Some repos that contain submodules=
 use a
> +       ;; <submodule>/<version> tagging scheme instead, so try that.
> +       (unless checkout-hash
> +         (when (string=3D? "" trimmed-path-suffix)
> +           ;; If this isn't a submodule, <submodule>/<version> tagging m=
akes no sense.
> +           ;; Tell the user we couldn't find the original version.
> +           (raise
> +            (formatted-message (G_ "could not find git reference '~a' in=
 repository '~a'")
> +                               (go-version->git-ref version) vcs-repo-ur=
l)))
> +         (set! path-prefixed? #t)
> +         (set! checkout-hash (git-checkout-hash
> +                              vcs-repo-url
> +                              (go-version->git-ref
> +                               (string-append trimmed-path-suffix "/" ve=
rsion))
> +                              (hash-algorithm sha256))))
>         `(origin
>            (method git-fetch)
>            (uri (git-reference
>                  (url ,vcs-repo-url)
> -                ;; This is done because the version field of the package,
> -                ;; which the generated quoted expression refers to, has =
been
> -                ;; stripped of any 'v' prefixed.
> -                (commit ,(if (and plain-version? v-prefixed?)
> -                             '(string-append "v" version)
> -                             '(go-version->git-ref version)))))
> +                ;; The 'v' is prepended again because the version field =
of
> +                ;; the package, which the generated quoted expression re=
fers
> +                ;; to, has been stripped of any 'v' prefixed.
> +                (commit (go-version->git-ref
> +                         ,(cond
> +                           (path-prefixed?
> +                            `(string-append
> +                              ,trimmed-path-suffix "/"
> +                              ,@(if v-prefixed? '("v" version) '(version=
))))
> +                           (v-prefixed? '(string-append "v" version))
> +                           (else 'version))))))
>            (file-name (git-file-name name version))
>            (sha256
>             (base32
> -            ,(bytevector->nix-base32-string
> -              (git-checkout-hash vcs-repo-url (go-version->git-ref versi=
on)
> -                                 (hash-algorithm sha256))))))))
> +            ,(bytevector->nix-base32-string checkout-hash))))))
>      ((hg)
>       `(origin
>          (method hg-fetch)
> @@ -614,6 +641,9 @@ (define* (go-module->guix-package module-path #:key
>            (match:prefix (string-match "([\\./]v[0-9]+)?$" module-path)))
>           (guix-name (go-module->guix-package-name module-path))
>           (root-module-path (module-path->repository-root module-path))
> +         (module-path-suffix  ; subdirectory inside the source repo
> +          (substring module-path-sans-suffix
> +                     (string-prefix-length root-module-path module-path-=
sans-suffix)))
>           ;; The VCS type and URL are not included in goproxy information=
=2E For
>           ;; this we need to fetch it from the official module page.
>           (meta-data (fetch-module-meta-data root-module-path))
> @@ -627,7 +657,7 @@ (define* (go-module->guix-package module-path #:key
>          (name ,guix-name)
>          (version ,(strip-v-prefix version*))
>          (source
> -         ,(vcs->origin vcs-type vcs-repo-url version*))
> +         ,(vcs->origin vcs-type vcs-repo-url module-path-suffix version*=
))
>          (build-system go-build-system)
>          (arguments
>           '(#:import-path ,module-path
>=20
> base-commit: e499cb2c12d7f1c6d2f004364c9cc7bdb7e38cd5
> --=20
> 2.40.1
>

I did not really take a look at the scheme code, I'm still Guix and Scheme
beginner, so I'm very much not up to the task of doing actual code review.
Nevertheless, I hope my mail helps at least a bit.

Have a nice day,
W.

--=20
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

--iw7hpULjExUreuIc
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmRqkxkACgkQL7/ufbZ/
wamucg//aKKPWvermh5Y9aM+7NGoKaq2DqtFlIO+A32wnJcZQupMRWzKyRzfnT77
CXIwMuKwz53Dr6OaB2HP3oiXjREkISg1PdHUBAJ4ziJX+SAywlZihqjlh5698e1K
m0izXVjx3IIMjLqEv6EMCgAKLRG/4HpdGmG7oTtsMN0KGHD2Kufo1Mz3lR0zYUqx
LDciOb10EV7XyJvjeYHUKtzz8EzF4NQO4+S0gCY6kN1PYjFEx9wy9s996W+i7ngY
EZWMZLL1ppbQtmcDzdqjgLebZ5+/P8ZjmuuELBmuBtCaUhtu3ViOSC7ieOkVkD+m
8OWW078xqHYDiTWc9Qz6K/+PsTQUJxFJRro3cHXzPV+Go9gGer921Vr0Ua4r1cCg
K0WIuTjS2wMjIOdsnqPfPVWGiks6zVe07fQFze38OtcbfadVJe2fxCiBXHeq5p7p
kwhZDrtcMrlBE0moNaFjPC061EtW4s9BrsLPy1NszeGp+gW12/NUyUeLv3BK3gbM
8DvAQo7QYGioIB2H0xPewMj4mArMoDhbFlZZ0cnhqGrd3snir3XXZu0Cw4hSJQBt
uPIvS4XsTmCKWV4c11mYKW4T78iFkP7IFHV1JiIcLYP1W5E2fCZhcHMoUB+VFvcF
lU2v6NhJzuQuPeMB/Ngj4Dey1IXrs5SbvFsISpPOboL3nRuRGgQ=
=zjKZ
-----END PGP SIGNATURE-----

--iw7hpULjExUreuIc--




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 21 May 2023 21:19:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 21 17:19:48 2023
Received: from localhost ([127.0.0.1]:32935 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q0qSy-0001HQ-76
	for submit <at> debbugs.gnu.org; Sun, 21 May 2023 17:19:48 -0400
Received: from mx2.mythic-beasts.com ([46.235.227.24]:50255)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <guix@HIDDEN>) id 1q0qSu-0001Gv-Uz
 for 54097 <at> debbugs.gnu.org; Sun, 21 May 2023 17:19:46 -0400
Received: by mailhub-hex-d.mythic-beasts.com with esmtpsa (TLS1.3) tls
 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2)
 (envelope-from <guix@HIDDEN>)
 id 1q0qSo-00C6Wa-E8; Sun, 21 May 2023 22:19:38 +0100
From: Timo Wilken <guix@HIDDEN>
To: guix-patches@HIDDEN,
	54097 <at> debbugs.gnu.org
Subject: [PATCH] import: go: Handle subpackage versioning correctly.
Date: Sun, 21 May 2023 23:18:08 +0200
Message-Id: <6dd1de3dd4d968876fa55f5126056834c77b0244.1684703258.git.guix@HIDDEN>
X-Mailer: git-send-email 2.40.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BlackCat-Spam-Score: 9
X-Spam-Status: No, score=0.9
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 54097
Cc: wolf@HIDDEN, Timo Wilken <guix@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Some Go source repositories (notably the Google Cloud SDK) contain multiple
submodules and use a `refs/tags/<submodule>/<version>' tagging scheme.

Fixes <https://bugs.gnu.org/54097>.

* guix/import/go.scm (vcs->origin): Accept a module-path-suffix.
(go-module->guix-package): Use the new parameter.
---
Here's a patch that fixes the reported issue (bug#54097) for me. I've only
tested this on the github.com/googleapis/google-cloud-go/compute package so
far, though it seems to work there. Perhaps others have more testcases?

I don't know enough about Go tooling to use it, so I've just patched the Guile
logic of the importer. (I don't write Go, I just want to package stuff written
in it.) In terms of performance, at least the repo contents are apparently
cached by the first `git-checkout-hash' call, even if it fails, so the second
call doesn't have to redownload them.

 guix/import/go.scm | 56 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 43 insertions(+), 13 deletions(-)

diff --git a/guix/import/go.scm b/guix/import/go.scm
index 0357e6a1eb..652ac58b6f 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2021 Xinglu Chen <public@HIDDEN>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@HIDDEN>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@HIDDEN>
+;;; Copyright © 2023 Timo Wilken <guix@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -89,6 +90,7 @@ (define-module (guix import go)
 
 ;;; TODO list
 ;;; - get correct hash in vcs->origin for Mercurial and Subversion
+;;; - handle subdir/vX.Y versioning in vcs->origin for Mercurial and Subversion
 
 ;;; Code:
 
@@ -513,29 +515,54 @@ (define* (git-checkout-hash url reference algorithm)
                                           `(tag-or-commit . ,reference)))))
     (file-hash* checkout #:algorithm algorithm #:recursive? #true)))
 
-(define (vcs->origin vcs-type vcs-repo-url version)
+(define (vcs->origin vcs-type vcs-repo-url module-path-suffix version)
   "Generate the `origin' block of a package depending on what type of source
 control system is being used."
   (case vcs-type
     ((git)
-     (let ((plain-version? (string=? version (go-version->git-ref version)))
-           (v-prefixed?    (string-prefix? "v" version)))
+     (let ((v-prefixed? (string-prefix? "v" version))
+           (path-prefixed? #f)
+           (trimmed-path-suffix (string-trim-both module-path-suffix #\/))
+           (checkout-hash (false-if-git-not-found
+                           (git-checkout-hash
+                            vcs-repo-url
+                            (go-version->git-ref version)
+                            (hash-algorithm sha256)))))
+       ;; If `checkout-hash' is false, that must mean that a tag named after
+       ;; the version doesn't exist.  Some repos that contain submodules use a
+       ;; <submodule>/<version> tagging scheme instead, so try that.
+       (unless checkout-hash
+         (when (string=? "" trimmed-path-suffix)
+           ;; If this isn't a submodule, <submodule>/<version> tagging makes no sense.
+           ;; Tell the user we couldn't find the original version.
+           (raise
+            (formatted-message (G_ "could not find git reference '~a' in repository '~a'")
+                               (go-version->git-ref version) vcs-repo-url)))
+         (set! path-prefixed? #t)
+         (set! checkout-hash (git-checkout-hash
+                              vcs-repo-url
+                              (go-version->git-ref
+                               (string-append trimmed-path-suffix "/" version))
+                              (hash-algorithm sha256))))
        `(origin
           (method git-fetch)
           (uri (git-reference
                 (url ,vcs-repo-url)
-                ;; This is done because the version field of the package,
-                ;; which the generated quoted expression refers to, has been
-                ;; stripped of any 'v' prefixed.
-                (commit ,(if (and plain-version? v-prefixed?)
-                             '(string-append "v" version)
-                             '(go-version->git-ref version)))))
+                ;; The 'v' is prepended again because the version field of
+                ;; the package, which the generated quoted expression refers
+                ;; to, has been stripped of any 'v' prefixed.
+                (commit (go-version->git-ref
+                         ,(cond
+                           (path-prefixed?
+                            `(string-append
+                              ,trimmed-path-suffix "/"
+                              ,@(if v-prefixed? '("v" version) '(version))))
+                           (v-prefixed? '(string-append "v" version))
+                           (else 'version))))))
           (file-name (git-file-name name version))
           (sha256
            (base32
-            ,(bytevector->nix-base32-string
-              (git-checkout-hash vcs-repo-url (go-version->git-ref version)
-                                 (hash-algorithm sha256))))))))
+            ,(bytevector->nix-base32-string checkout-hash))))))
     ((hg)
      `(origin
         (method hg-fetch)
@@ -614,6 +641,9 @@ (define* (go-module->guix-package module-path #:key
           (match:prefix (string-match "([\\./]v[0-9]+)?$" module-path)))
          (guix-name (go-module->guix-package-name module-path))
          (root-module-path (module-path->repository-root module-path))
+         (module-path-suffix  ; subdirectory inside the source repo
+          (substring module-path-sans-suffix
+                     (string-prefix-length root-module-path module-path-sans-suffix)))
          ;; The VCS type and URL are not included in goproxy information. For
          ;; this we need to fetch it from the official module page.
          (meta-data (fetch-module-meta-data root-module-path))
@@ -627,7 +657,7 @@ (define* (go-module->guix-package module-path #:key
         (name ,guix-name)
         (version ,(strip-v-prefix version*))
         (source
-         ,(vcs->origin vcs-type vcs-repo-url version*))
+         ,(vcs->origin vcs-type vcs-repo-url module-path-suffix version*))
         (build-system go-build-system)
         (arguments
          '(#:import-path ,module-path

base-commit: e499cb2c12d7f1c6d2f004364c9cc7bdb7e38cd5
-- 
2.40.1





Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 22 Feb 2022 12:59:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 22 07:59:54 2022
Received: from localhost ([127.0.0.1]:40259 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMUlm-00047P-0T
	for submit <at> debbugs.gnu.org; Tue, 22 Feb 2022 07:59:54 -0500
Received: from out0.migadu.com ([94.23.1.103]:28904)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <blake@HIDDEN>) id 1nMUlj-00047E-Gr
 for 54097 <at> debbugs.gnu.org; Tue, 22 Feb 2022 07:59:52 -0500
Date: Tue, 22 Feb 2022 19:59:26 +0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nonconstructivism.com; 
 s=key1; t=1645534790;
 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;
 bh=RfsPx9djjBimtlAzVrVOraQq5TddEdU31P4+A+3Qkik=;
 b=RX5yDmPTXTn8Jygy9l9GY0B9OJct2TeOaNyysFfScb6U5cBe1GI999iuZwl4iPXrL1N1KZ
 F3ApET5o2apEq+FMw+FxpGz2p5uXBN4OE5HSSuh3h+3RrHw6TFPlhitZUfAY05g3lRYxbj
 9S7IES8aRzCvwwZojskZLEE/SntVJJs=
Message-Id: <87k0dn12hd.fsf@HIDDEN>
To: =?utf-8?Q?Bj=C3=B6rn_H=C3=B6fling?= <bjoern.hoefling@HIDDEN>
Subject: Re: bug#54097: go importer does not honor multi-module repositories
Gcc: nnimap+imap.migadu.de:sent.2022
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Blake Shaw <blake@HIDDEN>
MIME-Version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: nonconstructivism.com
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54097
Cc: 54097 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


great investigation, thanks for sharing!
-- 
“In girum imus nocte et consumimur igni”




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at 54097 <at> debbugs.gnu.org:


Received: (at 54097) by debbugs.gnu.org; 22 Feb 2022 00:39:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 21 19:39:02 2022
Received: from localhost ([127.0.0.1]:39499 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMJCo-0007Us-2c
	for submit <at> debbugs.gnu.org; Mon, 21 Feb 2022 19:39:02 -0500
Received: from mx1.riseup.net ([198.252.153.129]:37404)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raingloom@HIDDEN>) id 1nMJCj-0007UO-J6
 for 54097 <at> debbugs.gnu.org; Mon, 21 Feb 2022 19:39:01 -0500
Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "mail.riseup.net", Issuer "R3" (not verified))
 by mx1.riseup.net (Postfix) with ESMTPS id 4K2gJr1N6qzDq8p;
 Mon, 21 Feb 2022 16:38:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak;
 t=1645490332; bh=CwlMcfh7pYHOx7r7h47uFRtUH6Qhovn0SNnQ/XE4Hgs=;
 h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
 b=cAw+35bSI1Fk6A92893lzzaBJjxaugQBdRYJVq6PXeAeT0Xx1d6/RJx+nawwRw3GG
 m3GchXoZlAaYHlRgkKnMNaeC8ORbyFStdxo1G6YFPsd/8NdFWanzbxIaKLdvo9vePp
 cbGW0vyTYRgLKxSfExcw3YF58/kInAQwAHMn7PBE=
X-Riseup-User-ID: 12BA86D0D7F89E57702B035A9849F946AEC51B7110EF00DD2B9DB59CB47FD38F
Received: from [127.0.0.1] (localhost [127.0.0.1])
 by fews1.riseup.net (Postfix) with ESMTPSA id 4K2gJq1fPtz5wC9;
 Mon, 21 Feb 2022 16:38:50 -0800 (PST)
Date: Tue, 22 Feb 2022 01:38:48 +0100
From: raingloom <raingloom@HIDDEN>
To: =?UTF-8?B?QmrDtnJuIEjDtmZsaW5n?= <bjoern.hoefling@HIDDEN>
Subject: Re: bug#54097: go importer does not honor multi-module repositories
Message-ID: <20220222013848.06d515a1@HIDDEN>
In-Reply-To: <20220221234354.7698f141@HIDDEN>
References: <20220221234354.7698f141@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54097
Cc: 54097 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On Mon, 21 Feb 2022 23:43:54 +0100
Bj=C3=B6rn H=C3=B6fling <bjoern.hoefling@HIDDEN> wrote:

> Go usually has the 1 repository=3D1 module convention. However, it
> is also allowed that one repository contains multiple go modules.
>=20
> If repository "foo" contains only one module, then versions are tagged
> "v1.2.3".
>=20
> However, if the repository "foo" contains modules "bar" and "baz",
> each in a sub-directory of "foo", the versions will be tagged with
> their respective prefix, i.e.:
>=20
> foo/v1.2.3
> bar/v4.5.6
>=20
> See here:
>=20
> https://github.com/golang/go/wiki/Modules#publishing-a-release
> https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories
> https://stackoverflow.com/questions/64701064/golang-separate-versioning-o=
f-multiple-modules
>=20
> However, our go-importer does not honor this. The Google Cloud API
> modules are structured into sub-modules, but our importer searches the
> wrong tag and raises an exception:
>=20
> $ ./pre-inst-env guix import go cloud.google.com/go/storage
> URL FOR VERSIONS:
> https://proxy.golang.org/cloud.google.com/go/storage/@v/list
> FETCH_GO_MOD:
> https://proxy.golang.org/cloud.google.com/go/storage/@v/v1.21.0.mod
> Backtrace: In ice-9/boot-9.scm: 1752:10 17 (with-exception-handler _
> _ #:unwind? _ # _) In unknown file:
>           16 (apply-smob/0 #<thunk 7f5b3d24f0c0>)
> In ice-9/boot-9.scm:
>     724:2 15 (call-with-prompt _ _ #<procedure
> default-prompt-handle?>) In ice-9/eval.scm:
>     619:8 14 (_ #(#(#<directory (guile-user) 7f5b3d255c80>)))
> In guix/ui.scm:
>    2209:7 13 (run-guix . _)
>   2172:10 12 (run-guix-command _ . _)
> In guix/scripts/import.scm:
>    124:11 11 (guix-import . _)
> In ice-9/boot-9.scm:
>   1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/scripts/import/go.scm:
>    116:29  9 (_)
> In ice-9/exceptions.scm:
>    406:15  8 (go-module->guix-package* . _)
> In ice-9/boot-9.scm:
>   1752:10  7 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/import/go.scm:
>    525:18  6 (go-module->guix-package "cloud.google.com/go/storage" #
> ?) In guix/git.scm:
>     277:4  5 (update-cached-checkout _ #:ref _ #:recursive? _ # _ # _
> ?) 266:18  4 (resolve _)
> In git/reference.scm:
>      60:8  3 (_ _ _)
> In git/bindings.scm:
>      77:2  2 (raise-git-error _)
> In ice-9/boot-9.scm:
>   1685:16  1 (raise-exception _ #:continuable? _)
>   1683:16  0 (raise-exception _ #:continuable? _)
>=20
> ice-9/boot-9.scm:1683:16: In procedure raise-exception:
> Git error: reference 'refs/tags/v1.21.0' not found
>=20
>=20
> The correct git reference to look for is:
>=20
> refs/tags/storage/v1.21.0
>=20
> Bj=C3=B6rn
>=20

I think this has been mentioned before, but I really think we should
use Go's built-in tooling to extract this info, instead of
reimplementing it in Guile. There is already some massive ineffeciency
introduced by the importer cloning whole repos, whereas `go get` is
smart enough to only download `go.mod` files.
Just my 2c.




Information forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Feb 2022 22:44:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 21 17:44:08 2022
Received: from localhost ([127.0.0.1]:39371 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nMHPc-0004Zr-HF
	for submit <at> debbugs.gnu.org; Mon, 21 Feb 2022 17:44:08 -0500
Received: from lists.gnu.org ([209.51.188.17]:49684)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bjoern.hoefling@HIDDEN>)
 id 1nMHPb-0004Zk-4b
 for submit <at> debbugs.gnu.org; Mon, 21 Feb 2022 17:44:07 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47570)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bjoern.hoefling@HIDDEN>)
 id 1nMHPY-0005zu-K6
 for bug-guix@HIDDEN; Mon, 21 Feb 2022 17:44:06 -0500
Received: from m4s11.vlinux.de ([83.151.27.109]:52508 helo=bjoernhoefling.de)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <bjoern.hoefling@HIDDEN>)
 id 1nMHPV-0001DX-0V
 for bug-guix@HIDDEN; Mon, 21 Feb 2022 17:44:02 -0500
Received: from alma-ubu.fritz.box (p508ac6e4.dip0.t-ipconnect.de
 [80.138.198.228])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by bjoernhoefling.de (Postfix) with ESMTPSA id 5116F3F9B0
 for <bug-guix@HIDDEN>; Mon, 21 Feb 2022 23:43:57 +0100 (CET)
Date: Mon, 21 Feb 2022 23:43:54 +0100
From: =?UTF-8?B?QmrDtnJuIEjDtmZsaW5n?= <bjoern.hoefling@HIDDEN>
To: <bug-guix@HIDDEN>
Subject: go importer does not honor multi-module repositories
Message-ID: <20220221234354.7698f141@HIDDEN>
X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="Sig_/wDeKKh4SGBL=NxJVg=fQze=";
 protocol="application/pgp-signature"; micalg=pgp-sha512
Received-SPF: none client-ip=83.151.27.109;
 envelope-from=bjoern.hoefling@HIDDEN; helo=bjoernhoefling.de
X-Spam_score_int: -16
X-Spam_score: -1.7
X-Spam_bar: -
X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.187,
 SPF_HELO_NONE=0.001, SPF_NONE=0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--Sig_/wDeKKh4SGBL=NxJVg=fQze=
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Go usually has the 1 repository=3D1 module convention. However, it
is also allowed that one repository contains multiple go modules.

If repository "foo" contains only one module, then versions are tagged
"v1.2.3".

However, if the repository "foo" contains modules "bar" and "baz", each
in a sub-directory of "foo", the versions will be tagged with their
respective prefix, i.e.:

foo/v1.2.3
bar/v4.5.6

See here:

https://github.com/golang/go/wiki/Modules#publishing-a-release
https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories
https://stackoverflow.com/questions/64701064/golang-separate-versioning-of-=
multiple-modules

However, our go-importer does not honor this. The Google Cloud API
modules are structured into sub-modules, but our importer searches the
wrong tag and raises an exception:

$ ./pre-inst-env guix import go cloud.google.com/go/storage
URL FOR VERSIONS: https://proxy.golang.org/cloud.google.com/go/storage/@v/l=
ist
FETCH_GO_MOD: https://proxy.golang.org/cloud.google.com/go/storage/@v/v1.21=
.0.mod
Backtrace:
In ice-9/boot-9.scm:
  1752:10 17 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
          16 (apply-smob/0 #<thunk 7f5b3d24f0c0>)
In ice-9/boot-9.scm:
    724:2 15 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
    619:8 14 (_ #(#(#<directory (guile-user) 7f5b3d255c80>)))
In guix/ui.scm:
   2209:7 13 (run-guix . _)
  2172:10 12 (run-guix-command _ . _)
In guix/scripts/import.scm:
   124:11 11 (guix-import . _)
In ice-9/boot-9.scm:
  1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In guix/scripts/import/go.scm:
   116:29  9 (_)
In ice-9/exceptions.scm:
   406:15  8 (go-module->guix-package* . _)
In ice-9/boot-9.scm:
  1752:10  7 (with-exception-handler _ _ #:unwind? _ # _)
In guix/import/go.scm:
   525:18  6 (go-module->guix-package "cloud.google.com/go/storage" # ?)
In guix/git.scm:
    277:4  5 (update-cached-checkout _ #:ref _ #:recursive? _ # _ # _ ?)
   266:18  4 (resolve _)
In git/reference.scm:
     60:8  3 (_ _ _)
In git/bindings.scm:
     77:2  2 (raise-git-error _)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1683:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1683:16: In procedure raise-exception:
Git error: reference 'refs/tags/v1.21.0' not found


The correct git reference to look for is:

refs/tags/storage/v1.21.0

Bj=C3=B6rn


--Sig_/wDeKKh4SGBL=NxJVg=fQze=
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iF0EAREKAB0WIQQiGUP0np8nb5SZM4K/KGy2WT5f/QUCYhQVqgAKCRC/KGy2WT5f
/ZkFAJ95cF6s1cJeWpRDWStaIRt/4l+pqACfYTBZk5zVa/zMVkRtlci2Myuj+bA=
=KgGG
-----END PGP SIGNATURE-----

--Sig_/wDeKKh4SGBL=NxJVg=fQze=--




Acknowledgement sent to Björn Höfling <bjoern.hoefling@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#54097; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 16 Aug 2023 17:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.