summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinglu Chen <public@yoctocell.xyz>2021-05-17 22:11:15 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-22 23:39:27 +0200
commitcfec09a9928e171a724f630ba652ea0241d52e92 (patch)
treefdd87552bfe6246728d08cc00a1bf230c4730aeb
parentd900cbadfd03fdfca155531bf3b2f5b548582c65 (diff)
import: hackage: Prefix licenses with 'license:'.
* guix/import/hackage.scm (string->license): Prefix the value of the license field with ‘license:’. * tests/hackage.scm (match-ghc-foo, match-ghc-foo-6, match-ghc-foo-revision): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/import/hackage.scm27
-rw-r--r--tests/hackage.scm7
2 files changed, 18 insertions, 16 deletions
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 9f992ffe8ed..f94a1e7087a 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -4,6 +4,7 @@
4;;; Copyright © 2016 Nikita <nikita@n0.is> 4;;; Copyright © 2016 Nikita <nikita@n0.is>
5;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> 5;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
6;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net> 6;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
7;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
7;;; 8;;;
8;;; This file is part of GNU Guix. 9;;; This file is part of GNU Guix.
9;;; 10;;;
@@ -163,22 +164,22 @@ version."
163 ;; https://www.haskell.org 164 ;; https://www.haskell.org
164 ;; /cabal/release/cabal-latest/doc/API/Cabal/Distribution-License.html. 165 ;; /cabal/release/cabal-latest/doc/API/Cabal/Distribution-License.html.
165 (match-lambda 166 (match-lambda
166 ("GPL-2" 'gpl2) 167 ("GPL-2" 'license:gpl2)
167 ("GPL-3" 'gpl3) 168 ("GPL-3" 'license:gpl3)
168 ("GPL" "'gpl??") 169 ("GPL" "'gpl??")
169 ("AGPL-3" 'agpl3) 170 ("AGPL-3" 'license:agpl3)
170 ("AGPL" "'agpl??") 171 ("AGPL" "'agpl??")
171 ("LGPL-2.1" 'lgpl2.1) 172 ("LGPL-2.1" 'license:lgpl2.1)
172 ("LGPL-3" 'lgpl3) 173 ("LGPL-3" 'license:lgpl3)
173 ("LGPL" "'lgpl??") 174 ("LGPL" "'lgpl??")
174 ("BSD2" 'bsd-2) 175 ("BSD2" 'license:bsd-2)
175 ("BSD3" 'bsd-3) 176 ("BSD3" 'license:bsd-3)
176 ("BSD-3-Clause" 'bsd-3) 177 ("BSD-3-Clause" 'license:bsd-3)
177 ("MIT" 'expat) 178 ("MIT" 'license:expat)
178 ("ISC" 'isc) 179 ("ISC" 'license:isc)
179 ("MPL" 'mpl2.0) 180 ("MPL" 'license:mpl2.0)
180 ("Apache-2.0" 'asl2.0) 181 ("Apache-2.0" 'license:asl2.0)
181 ("PublicDomain" 'public-domain) 182 ("PublicDomain" 'license:public-domain)
182 ((x) (string->license x)) 183 ((x) (string->license x))
183 ((lst ...) `(list ,@(map string->license lst))) 184 ((lst ...) `(list ,@(map string->license lst)))
184 (_ #f))) 185 (_ #f)))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 77e333cbfcb..66a13d98817 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> 2;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
3;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net> 3;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
4;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -183,7 +184,7 @@ library
183 ('home-page "http://test.org") 184 ('home-page "http://test.org")
184 ('synopsis (? string?)) 185 ('synopsis (? string?))
185 ('description (? string?)) 186 ('description (? string?))
186 ('license 'bsd-3))) 187 ('license 'license:bsd-3)))
187 188
188(define* (eval-test-with-cabal test-cabal matcher #:key (cabal-environment '())) 189(define* (eval-test-with-cabal test-cabal matcher #:key (cabal-environment '()))
189 (define port (open-input-string test-cabal)) 190 (define port (open-input-string test-cabal))
@@ -232,7 +233,7 @@ library
232 ('home-page "http://test.org") 233 ('home-page "http://test.org")
233 ('synopsis (? string?)) 234 ('synopsis (? string?))
234 ('description (? string?)) 235 ('description (? string?))
235 ('license 'bsd-3))) 236 ('license 'license:bsd-3)))
236 237
237(test-assert "hackage->guix-package test 6" 238(test-assert "hackage->guix-package test 6"
238 (eval-test-with-cabal test-cabal-6 match-ghc-foo-6)) 239 (eval-test-with-cabal test-cabal-6 match-ghc-foo-6))
@@ -362,7 +363,7 @@ executable cabal
362 ('home-page "http://test.org") 363 ('home-page "http://test.org")
363 ('synopsis (? string?)) 364 ('synopsis (? string?))
364 ('description (? string?)) 365 ('description (? string?))
365 ('license 'bsd-3))) 366 ('license 'license:bsd-3)))
366 367
367(test-assert "hackage->guix-package test cabal revision" 368(test-assert "hackage->guix-package test cabal revision"
368 (eval-test-with-cabal test-cabal-revision match-ghc-foo-revision)) 369 (eval-test-with-cabal test-cabal-revision match-ghc-foo-revision))