[PATCH] import/print: package->code: Fix license object.

  • Done
  • quality assurance status badge
Details
2 participants
  • itd
  • Ludovic Courtès
Owner
unassigned
Submitted by
itd
Severity
normal
I
(address . guix-patches@gnu.org)
87h7gr5r43.fsf@localhost
* guix/import/print.scm (package->code)<license->code>: Update generated
licence object to match record constructor.
---

Hi,

given the following example (please note the fake license):
```bash
(
printf '%s\n'\
"(define-module (out) #:use-module (guix packages) #:use-module (guix download))"\
"(define license (@@ (guix licenses) license))" # see commit 1597613488
guix import json /dev/stdin <<EOF
{
"name": "hello",
"version": "2.10",
"source": "mirror://gnu/hello/hello-2.10.tar.gz",
"build-system": "gnu",
"synopsis": "Hello, GNU world: An example GNU package",
"description": "GNU Hello prints a greeting.",
"license": "a-license",
"native-inputs": ["gettext"]
}
EOF
) > out.scm
guix build -L . hello
```

This example fails to build for me with error:
```bash
guix build: warning: failed to load '(out)':
Wrong type to apply: "hello"
```

I suspect this to be caused by the generated license definition:
```guile
(license
(license
(name "FSDG-compatible")
(uri "a-license")
(comment "")))))
```

After patching, the package builds successfully with the following
license definition:
```guile
(license
(license "FSDG-compatible" "a-license" ""))))
```

Regards
itd

guix/import/print.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (19 lines)
diff --git a/guix/import/print.scm b/guix/import/print.scm
index dcc38abc70..0310739b3a 100644
--- a/guix/import/print.scm
+++ b/guix/import/print.scm
@@ -60,9 +60,9 @@ when evaluated."
(if var
(symbol-append 'license: var)
`(license
- (name ,(license-name lic))
- (uri ,(license-uri lic))
- (comment ,(license-comment lic))))))
+ ,(license-name lic)
+ ,(license-uri lic)
+ ,(license-comment lic)))))
(define (search-path-specification->code spec)
`(search-path-specification
--
2.30.2
L
L
Ludovic Courtès wrote on 19 Jul 2021 16:57
(name . itd)(address . itd@net.in.tum.de)(address . 49627-done@debbugs.gnu.org)
87fswamjv3.fsf@gnu.org
Hi,

itd <itd@net.in.tum.de> skribis:

Toggle quote (3 lines)
> * guix/import/print.scm (package->code)<license->code>: Update generated
> licence object to match record constructor.

Applied, thanks!

Ludo’.
Closed
?