GNU bug report logs - #50595
Faliure in guix import go

Previous Next

Package: guix;

Reported by: Stephen Paul Weber <singpolyma <at> singpolyma.net>

Date: Wed, 15 Sep 2021 00:33:02 UTC

Severity: normal

Done: Sarah Morgensen <iskarian <at> mgsn.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50595 in the body.
You can then email your comments to 50595 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#50595; Package guix. (Wed, 15 Sep 2021 00:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Paul Weber <singpolyma <at> singpolyma.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 15 Sep 2021 00:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: bug-guix <at> gnu.org
Subject: Faliure in guix import go
Date: Tue, 14 Sep 2021 19:32:42 -0500
[Message part 1 (text/plain, inline)]
$ guix import go -r bdd.fi/x/runitor

guix import: warning: Failed to import package "bdd.fi/x/runitor".
reason: ("struct-vtable" "Wrong type argument in position 1 (expecting struct): ~S" (#f) (#f)).
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#50595; Package guix. (Wed, 15 Sep 2021 02:28:02 GMT) Full text and rfc822 format available.

Message #8 received at 50595 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50595 <at> debbugs.gnu.org
Subject: Re: Failure in guix import go
Date: Tue, 14 Sep 2021 21:27:54 -0500
[Message part 1 (text/plain, inline)]
Getting a similar failure here:

$ guix import go github.com/cncf/udpa/go/

following redirection to `https://proxy.golang.org/github.com/cncf/udpa/go/@v/list'...
following redirection to `https://proxy.golang.org/github.com/cncf/udpa/go/@latest'...
following redirection to `https://proxy.golang.org/github.com/cncf/udpa/go/@v/v0.0.0-20210322005330-6414d713912e.mod'...
guix import: warning: Failed to import package "github.com/cncf/udpa/go/".
reason: ("vector-ref" "Wrong type argument in position 1 (expecting vector): ~S" (#f) (#f)).
guix import: error: failed to download meta-data for module 'github.com/cncf/udpa/go/'
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#50595; Package guix. (Fri, 17 Sep 2021 03:09:01 GMT) Full text and rfc822 format available.

Message #11 received at 50595 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50595 <at> debbugs.gnu.org
Subject: Re: bug#50595: Faliure in guix import go
Date: Thu, 16 Sep 2021 20:07:52 -0700
[Message part 1 (text/plain, inline)]
Hello,

Thanks for your report!

Stephen Paul Weber <singpolyma <at> singpolyma.net> writes:

> $ guix import go -r bdd.fi/x/runitor
>
> guix import: warning: Failed to import package "bdd.fi/x/runitor".
> reason: ("struct-vtable" "Wrong type argument in position 1 (expecting struct): ~S" (#f) (#f)).

It seems this is occurring because "https://bdd.fi/x/runitor?go-get=1"
does not have the

  <meta "go-import" ...>

tag in the <head> element, as the Go spec requires (it's a direct child
of the <html> element).  However, it seems fairly harmless to relax this
requirement in our importer, so the following patch should fix this.

[0001-import-go-Match-go-import-meta-tags-anywhere.patch (text/x-patch, inline)]
From ca17299a3011171d6889202003d1e888b22303ec Mon Sep 17 00:00:00 2001
Message-Id: <ca17299a3011171d6889202003d1e888b22303ec.1631842353.git.iskarian <at> mgsn.dev>
From: Sarah Morgensen <iskarian <at> mgsn.dev>
Date: Thu, 16 Sep 2021 18:27:09 -0700
Subject: [PATCH] import: go: Match "go-import" meta tags anywhere.

Some personal sites forget to put <meta name="go-import" ...> in a
<head> element, so look anywhere for them.

* guix/import/go.scm (fetch-module-meta-data): Match "go-import" meta
tags anywhere in the page.
---
 guix/import/go.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/import/go.scm b/guix/import/go.scm
index dad007d511..43abe004b3 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -480,7 +480,7 @@ build a package."
                          (strip-.git-suffix/maybe repo-url)))))
   ;; <meta name="go-import" content="import-prefix vcs repo-root">
   (let* ((meta-data (http-fetch* (format #f "https://~a?go-get=1" module-path)))
-         (select (sxpath `(// head (meta (@ (equal? (name "go-import"))))
+         (select (sxpath `(// (meta (@ (equal? (name "go-import"))))
                               // content))))
     (match (select (html->sxml meta-data #:strict? #t))
       (() #f)                           ;nothing selected

base-commit: 72297993a174586ee0a23b95b6b9ee2f3db34cf1
--
2.33.0


Information forwarded to bug-guix <at> gnu.org:
bug#50595; Package guix. (Fri, 17 Sep 2021 21:41:01 GMT) Full text and rfc822 format available.

Message #14 received at 50595 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50595 <at> debbugs.gnu.org
Subject: Re: bug#50595: Failure in guix import go
Date: Fri, 17 Sep 2021 14:39:58 -0700
[Message part 1 (text/plain, inline)]
Hello,

Stephen Paul Weber <singpolyma <at> singpolyma.net> writes:

> Getting a similar failure here:
>
> $ guix import go github.com/cncf/udpa/go/
>
> following redirection to `https://proxy.golang.org/github.com/cncf/udpa/go/@v/list'...
> following redirection to `https://proxy.golang.org/github.com/cncf/udpa/go/@latest'...
> following redirection to `https://proxy.golang.org/github.com/cncf/udpa/go/@v/v0.0.0-20210322005330-6414d713912e.mod'...
> guix import: warning: Failed to import package "github.com/cncf/udpa/go/".
> reason: ("vector-ref" "Wrong type argument in position 1 (expecting vector): ~S" (#f) (#f)).
> guix import: error: failed to download meta-data for module 'github.com/cncf/udpa/go/'

This one seems to be caused by the importer incorrectly using the
repository root instead of the module path in a couple places.  The
attached patch fixes this.

Hope that helps,
--
Sarah

[0001-import-go-Improve-handling-of-modules-in-VCS-subdire.patch (text/x-patch, inline)]
From b9ef64a641c20d331cf1886d71b85b81be910b30 Mon Sep 17 00:00:00 2001
Message-Id: <b9ef64a641c20d331cf1886d71b85b81be910b30.1631914185.git.iskarian <at> mgsn.dev>
From: Sarah Morgensen <iskarian <at> mgsn.dev>
Date: Thu, 16 Sep 2021 18:24:40 -0700
Subject: [PATCH] import: go: Improve handling of modules in VCS
 subdirectories.

Use the supplied module path (instead of the repository root) as the import
path for everything except source and homepage URLs.  For modules not in the
root of a VCS repository, set #:unpack-path to the repository root by default.

* guix/import/go.scm (go-module->guix-package): Use 'module-path'
instead of 'root-module-path' for #:import-path.  Emit #:unpack-path
when #:import-path is not equal to 'root-module-path'.
---
 guix/import/go.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/guix/import/go.scm b/guix/import/go.scm
index c6ecdbaffd..fe7387dec2 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -619,7 +619,7 @@ hint: use one of the following available versions ~a\n"
          (meta-data (fetch-module-meta-data root-module-path))
          (vcs-type (module-meta-vcs meta-data))
          (vcs-repo-url (module-meta-data-repo-url meta-data goproxy))
-         (synopsis (go-package-synopsis root-module-path))
+         (synopsis (go-package-synopsis module-path))
          (description (go-package-description module-path))
          (licenses (go-package-licenses module-path)))
     (values
@@ -630,7 +630,10 @@ hint: use one of the following available versions ~a\n"
          ,(vcs->origin vcs-type vcs-repo-url version*))
         (build-system go-build-system)
         (arguments
-         '(#:import-path ,root-module-path))
+         '(#:import-path ,module-path
+           ,@(if (string=? module-path root-module-path)
+                 '()
+                 `(#:unpack-path ,root-module-path))))
         ,@(maybe-propagated-inputs
            (map (match-lambda
                   ((name version)

base-commit: 72297993a174586ee0a23b95b6b9ee2f3db34cf1
--
2.33.0


Information forwarded to bug-guix <at> gnu.org:
bug#50595; Package guix. (Sat, 18 Sep 2021 21:13:01 GMT) Full text and rfc822 format available.

Message #17 received at 50595 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, 50595 <at> debbugs.gnu.org
Subject: Re: bug#50595: Faliure in guix import go
Date: Sat, 18 Sep 2021 23:12:41 +0200
Hi,

Sarah Morgensen <iskarian <at> mgsn.dev> skribis:

>>From b9ef64a641c20d331cf1886d71b85b81be910b30 Mon Sep 17 00:00:00 2001
> Message-Id: <b9ef64a641c20d331cf1886d71b85b81be910b30.1631914185.git.iskarian <at> mgsn.dev>
> From: Sarah Morgensen <iskarian <at> mgsn.dev>
> Date: Thu, 16 Sep 2021 18:24:40 -0700
> Subject: [PATCH] import: go: Improve handling of modules in VCS
>  subdirectories.
>
> Use the supplied module path (instead of the repository root) as the import
> path for everything except source and homepage URLs.  For modules not in the
> root of a VCS repository, set #:unpack-path to the repository root by default.
>
> * guix/import/go.scm (go-module->guix-package): Use 'module-path'
> instead of 'root-module-path' for #:import-path.  Emit #:unpack-path
> when #:import-path is not equal to 'root-module-path'.

[...]

>>From ca17299a3011171d6889202003d1e888b22303ec Mon Sep 17 00:00:00 2001
> Message-Id: <ca17299a3011171d6889202003d1e888b22303ec.1631842353.git.iskarian <at> mgsn.dev>
> From: Sarah Morgensen <iskarian <at> mgsn.dev>
> Date: Thu, 16 Sep 2021 18:27:09 -0700
> Subject: [PATCH] import: go: Match "go-import" meta tags anywhere.
>
> Some personal sites forget to put <meta name="go-import" ...> in a
> <head> element, so look anywhere for them.
>
> * guix/import/go.scm (fetch-module-meta-data): Match "go-import" meta
> tags anywhere in the page.

I went ahead and pushed these two patches on your behalf (after adding a
reference to this bug):

  281ede2e7d * import: go: Match "go-import" meta tags anywhere.
  b3907e304d * import: go: Improve handling of modules in VCS subdirectories.

Should we close this bug now, Sarah?

Thanks!

Ludo’.




Reply sent to Sarah Morgensen <iskarian <at> mgsn.dev>:
You have taken responsibility. (Sat, 18 Sep 2021 21:38:02 GMT) Full text and rfc822 format available.

Notification sent to Stephen Paul Weber <singpolyma <at> singpolyma.net>:
bug acknowledged by developer. (Sat, 18 Sep 2021 21:38:02 GMT) Full text and rfc822 format available.

Message #22 received at 50595-done <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, 50595-done <at> debbugs.gnu.org
Subject: Re: bug#50595: Faliure in guix import go
Date: Sat, 18 Sep 2021 14:37:40 -0700
Hi,

Ludovic Courtès <ludo <at> gnu.org> writes:

> I went ahead and pushed these two patches on your behalf (after adding a
> reference to this bug):
>
>   281ede2e7d * import: go: Match "go-import" meta tags anywhere.
>   b3907e304d * import: go: Improve handling of modules in VCS subdirectories.

Thanks (that was quick)!

> Should we close this bug now, Sarah?

Yes; I've closed it now.

If anyone has some time and free disk space, you might try importing
something which brings in complicated repos like AWS, and see if
anything else falls out.  Perhaps try github.com/cloudfoundry/cli?  I've
tried that one before and it was a mess.

--
Sarah




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Oct 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 309 days ago.

Previous Next


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