unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45453: Error when I try to build a package using a JSON definition
@ 2020-12-27  0:38 Ryan Prior via Bug reports for GNU Guix
  2020-12-27  2:28 ` Julien Lepiller
  2020-12-27 10:38 ` Ricardo Wurmus
  0 siblings, 2 replies; 6+ messages in thread
From: Ryan Prior via Bug reports for GNU Guix @ 2020-12-27  0:38 UTC (permalink / raw)
  To: 45453

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

Hi guix! Today I wrote a package in Guile and then decided to try and
reproduce the same thing using JSON, but I hit a snag. I'm attaching
the package definition in its Guile and JSON forms, along with the error
I get when I try to build the package using `guix build -f countdown.json'.

Any idea what the issue here is or how I should go about debugging?

Thank you!
Ryan


[-- Attachment #2: countdown.scm --]
[-- Type: application/octet-stream, Size: 1434 bytes --]

;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>

(define-module (testing countdown)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages terminals)
  #:use-module (gnu packages textutils)
  #:use-module (guix build-system go)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

(define-public countdown
  (package
    (name "countdown")
    (version "1.0.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/antonmedv/countdown")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0pdaw1krr0bsl4amhwx03v2b02iznvwvqn7af5zp4fkzjaj14cdw"))))
    (build-system go-build-system)
    (arguments
     '(#:import-path "github.com/antonmedv/countdown"))
    (native-inputs
     `(("go-github.com-mattn-go-runewidth@0.0.4-1.703b5e6" ,go-github.com-mattn-go-runewidth)
       ("go-github.com-nsf-termbox-go@0.0.0-1.288510b" ,go-github.com-nsf-termbox-go)))
    (home-page "https://github.com/antonmedv/countdown")
    (synopsis "Counts to zero with a text user interface.")
    (description
     "Countdown provides a fancy text display while it counts down to zero from a starting point you provide.  The user can pause and resume the countdown from the text user interface.")
    (license license:expat)))

[-- Attachment #3: countdown.json --]
[-- Type: application/json, Size: 699 bytes --]

[-- Attachment #4: countdown-build.out.txt --]
[-- Type: text/plain, Size: 2002 bytes --]


Starting download of /tmp/guix-file.vO9g3u
From https://github.com/antonmedv/countdown/archive/v1.0.0.tar.gz...
following redirection to `https://codeload.github.com/antonmedv/countdown/tar.gz/v1.0.0'...
In procedure getaddrinfo: Name or service not known
failed to download "/tmp/guix-file.vO9g3u" from "https://github.com/antonmedv/countdown/archive/v1.0.0.tar.gz"
Backtrace:
In ice-9/boot-9.scm:
  1736:10 19 (with-exception-handler _ _ #:unwind? _ # _)
  1731:15 18 (with-exception-handler #<procedure 7f089852ec30 at ic…> …)
In guix/status.scm:
    780:4 17 (call-with-status-report _ _)
In ice-9/boot-9.scm:
  1736:10 16 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
   632:37 15 (thunk)
   1301:8 14 (call-with-build-handler #<procedure 7f089852e2d0 at g…> …)
In guix/scripts/build.scm:
    499:2 13 (_)
In srfi/srfi-1.scm:
   673:15 12 (append-map #<procedure 7f08966f20a0 at guix/scripts/b…> …)
   586:17 11 (map1 ((file . "countdown.json") (build-mode . 0) # # …))
In guix/scripts/build.scm:
   522:38 10 (_ _)
In guix/import/json.scm:
    90:21  9 (json->scheme-file _)
In ice-9/boot-9.scm:
  1731:15  8 (with-exception-handler #<procedure 7f0898531de0 at ic…> …)
In guix/import/json.scm:
    68:18  7 (_)
In srfi/srfi-1.scm:
   460:18  6 (fold #<procedure 7f0896697d68 at guix/import/json.scm…> …)
In guix/import/json.scm:
    77:54  5 (_ (("native-inputs" . #("go-github.com-mattn-g…" …)) …) …)
In guix/import/utils.scm:
   122:33  4 (alist->package (("native-inputs" . #("go-githu…" …)) …) …)
In ice-9/ports.scm:
   440:11  3 (call-with-input-file #f #<procedure 7f08973ad340 at g…> …)
In unknown file:
           2 (open-file #f "r" #:encoding #f #:guess-encoding #f)
In ice-9/boot-9.scm:
  1669:16  1 (raise-exception _ #:continuable? _)
  1669:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Wrong type (expecting string): #f

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45453: Error when I try to build a package using a JSON definition
  2020-12-27  0:38 bug#45453: Error when I try to build a package using a JSON definition Ryan Prior via Bug reports for GNU Guix
@ 2020-12-27  2:28 ` Julien Lepiller
  2020-12-27  3:19   ` Ryan Prior via Bug reports for GNU Guix
  2020-12-27 10:40   ` Ricardo Wurmus
  2020-12-27 10:38 ` Ricardo Wurmus
  1 sibling, 2 replies; 6+ messages in thread
From: Julien Lepiller @ 2020-12-27  2:28 UTC (permalink / raw)
  To: Ryan Prior, 45453

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

I'm surprised guix builds from a json file… doesn't it simply interpret it as a guile file, and fails at that?

Anyway, in the log you attached, it seems the issue is with downloading the sources. For some reason it cannot resolve the github.com domain. I wonder if this is just a transient network issue on your side? Have you tried again later?

If not, it could be that the source derivation is not fixed-output. After all, the json definition doesn't specify a hash (it's not even an origin record). Again I'm confused by the fact that guix lets you specify packages with json, so I'm not sure how that part is converted to a package object. Is that documented?

Le 26 décembre 2020 19:38:18 GMT-05:00, Ryan Prior via Bug reports for GNU Guix <bug-guix@gnu.org> a écrit :
>Hi guix! Today I wrote a package in Guile and then decided to try and
>reproduce the same thing using JSON, but I hit a snag. I'm attaching
>the package definition in its Guile and JSON forms, along with the
>error
>I get when I try to build the package using `guix build -f
>countdown.json'.
>
>Any idea what the issue here is or how I should go about debugging?
>
>Thank you!
>Ryan

[-- Attachment #2: Type: text/html, Size: 1448 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45453: Error when I try to build a package using a JSON definition
  2020-12-27  2:28 ` Julien Lepiller
@ 2020-12-27  3:19   ` Ryan Prior via Bug reports for GNU Guix
  2020-12-27 10:40   ` Ricardo Wurmus
  1 sibling, 0 replies; 6+ messages in thread
From: Ryan Prior via Bug reports for GNU Guix @ 2020-12-27  3:19 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 45453


Julien Lepiller <julien@lepiller.eu> writes:

> Anyway, in the log you attached, it seems the issue is with downloading the sources. For some reason it cannot
> resolve the github.com domain. I wonder if this is just a transient network issue on your side? Have you tried again
> later?

I did try it twice, some hours apart. And in the meanwhile, the package
defined using Guile downloads its sources and builds just fine.

> If not, it could be that the source derivation is not fixed-output. After all, the json definition doesn't specify a hash
> (it's not even an origin record). Again I'm confused by the fact that guix lets you specify packages with json, so I'm
> not sure how that part is converted to a package object. Is that
> documented?

It is in the manual (Search for "JSON representation"):
https://guix.gnu.org/manual/en/html_node/Invoking-guix-package.html

Not clear to me whether you can provide a source hash as part of a JSON
package definition.

Thanks & let me know if you turn up any other clues!
Ryan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45453: Error when I try to build a package using a JSON definition
  2020-12-27  0:38 bug#45453: Error when I try to build a package using a JSON definition Ryan Prior via Bug reports for GNU Guix
  2020-12-27  2:28 ` Julien Lepiller
@ 2020-12-27 10:38 ` Ricardo Wurmus
  2020-12-27 11:08   ` Ricardo Wurmus
  1 sibling, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2020-12-27 10:38 UTC (permalink / raw)
  To: Ryan Prior; +Cc: 45453


Hi Ryan,

> Any idea what the issue here is or how I should go about debugging?

You were *so* close!  The problem is with the license field.
Uncharacteristically, we are using spdx-string->license here, so “expat”
is not a valid license name.  When you replace it with “MIT” it will
work.

I’ll change this to use the Guixy license names first, and only fall
back to SPDX names when that fails.  And there should be a proper error
message, of course.

Thanks for the bug report!

-- 
Ricardo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45453: Error when I try to build a package using a JSON definition
  2020-12-27  2:28 ` Julien Lepiller
  2020-12-27  3:19   ` Ryan Prior via Bug reports for GNU Guix
@ 2020-12-27 10:40   ` Ricardo Wurmus
  1 sibling, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2020-12-27 10:40 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: rprior, 45453


Hey Julien,

> I'm surprised guix builds from a json file…

it’s a little known feature.  I added it a long time ago, half in jest,
half in the realization that this removes a common superficial objection
to Guix.

> If not, it could be that the source derivation is not
> fixed-output. After all, the json definition doesn't specify a hash
> (it's not even an origin record). Again I'm confused by the fact that
> guix lets you specify packages with json, so I'm not sure how that
> part is converted to a package object. Is that documented?

Yes, it’s all documented.  The manual has to indexed locations for
“JSON”.  One of them says that you don’t need to specify an origin
record, but you can if you feel like it:

--8<---------------cut here---------------start------------->8---
     The importer also supports a more explicit source definition using
     the common fields for ‘<origin>’ records:

          {
            ...
            "source": {
              "method": "url-fetch",
              "uri": "mirror://gnu/hello/hello-2.10.tar.gz",
              "sha256": {
                "base32": "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"
              }
            }
            ...
          }
--8<---------------cut here---------------end--------------->8---

-- 
Ricardo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45453: Error when I try to build a package using a JSON definition
  2020-12-27 10:38 ` Ricardo Wurmus
@ 2020-12-27 11:08   ` Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2020-12-27 11:08 UTC (permalink / raw)
  To: Ryan Prior; +Cc: 45453-done


Ricardo Wurmus <rekado@elephly.net> writes:

> I’ll change this to use the Guixy license names first, and only fall
> back to SPDX names when that fails.  And there should be a proper error
> message, of course.

This is now fixed with commit 5aae614868.

-- 
Ricardo




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-27 11:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27  0:38 bug#45453: Error when I try to build a package using a JSON definition Ryan Prior via Bug reports for GNU Guix
2020-12-27  2:28 ` Julien Lepiller
2020-12-27  3:19   ` Ryan Prior via Bug reports for GNU Guix
2020-12-27 10:40   ` Ricardo Wurmus
2020-12-27 10:38 ` Ricardo Wurmus
2020-12-27 11:08   ` Ricardo Wurmus

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).