unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 49591@debbugs.gnu.org
Cc: Sarah Morgensen <iskarian@mgsn.dev>, 49591-done@debbugs.gnu.org
Subject: [bug#49591] [PATCH] import: go: Handle multiple go-import meta tags.
Date: Sat, 17 Jul 2021 23:31:31 -0400	[thread overview]
Message-ID: <87zgukjo18.fsf@gmail.com> (raw)
In-Reply-To: <e62cad4f0afd4f20d372be5c3b2c9bdabfbd2746.1626399943.git.iskarian@mgsn.dev> (Sarah Morgensen via Guix-patches via's message of "Thu, 15 Jul 2021 19:01:52 -0700")

Hello again,

Sarah Morgensen via Guix-patches via <guix-patches@gnu.org> writes:

> * guix/import/go.scm (fetch-module-meta-data): Parse all go-import meta
> tags and return the first 'module-meta' with a matching import prefix.
> [go-import->module-meta]: Extract parsing into new procedure.
> ---
> Hello Guix,
>
> It seems sometimes a module's go-get page contains multiple
>
>   <meta name="go-import" ...>
>
> tags, for example the 'bazil.org/fuse' module. This causes a backtrace when
> attempting to import such a module:
>
> $ guix import go bazil.org/fuse
> following redirection to `https://bazil.org/fuse/?go-get=1'...
> Backtrace:
>            5 (primitive-load "/home/sarah/.config/guix/current/bin/g…")
> In guix/ui.scm:
>    2182:7  4 (run-guix . _)
>   2145:10  3 (run-guix-command _ . _)
> In guix/scripts/import.scm:
>    120:11  2 (guix-import . _)
> In guix/scripts/import/go.scm:
>    118:27  1 (guix-import-go . _)
> In guix/import/go.scm:
>     467:4  0 (go-module->guix-package _ #:goproxy _ #:version _ # _)
>
> guix/import/go.scm:467:4: In procedure go-module->guix-package:
> Throw to key `match-error' with args `("match" "no matching pattern" ((content "bazil.org/bazil git https://github.com/bazil/bazil") (content "bazil.org/fuse git https://github.com/bazil/fuse") (content "bazil.org/bolt-mount git https://github.com/bazil/bolt-mount") (content "bazil.org/zipfs git https://github.com/bazil/zipfs") (content "bazil.org/plop git https://github.com/bazil/plop")))'.
>
>
> This patch makes the importer parse all such tags and search for one with an
> import prefix that is a prefix of the module-path we are looking for.

Good catch, LGTM!

> (I attempted to add a unit test but could not figure out how to make the
> record type accessible to the test script.)

I started adding a new fixture for fixtures-go-bazil-org-fuse-test, but
but I'm rusty as to where all these bits are pulled from.  Perhaps it
could be nice to add it, but otherwise it seems better in the mean time
to fix apply this fix as-is.

Committed with 5eba9c0960.

Thank you!

Closing.

Maxim




      reply	other threads:[~2021-07-18  3:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  2:01 [bug#49591] [PATCH] import: go: Handle multiple go-import meta tags Sarah Morgensen via Guix-patches via
2021-07-18  3:31 ` Maxim Cournoyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgukjo18.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=49591-done@debbugs.gnu.org \
    --cc=49591@debbugs.gnu.org \
    --cc=iskarian@mgsn.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).