import: utils: Add spdx-string->license.
* guix/import/utils.scm (spdx-string->license): New variable. * guix/licenses.scm (agpl1, fdl1.2+): New variables.
This commit is contained in:
		
							parent
							
								
									263ac57fc2
								
							
						
					
					
						commit
						59b2034787
					
				
					 2 changed files with 81 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
;;; GNU Guix --- Functional package management for GNU
 | 
					;;; GNU Guix --- Functional package management for GNU
 | 
				
			||||||
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
 | 
					;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
 | 
				
			||||||
 | 
					;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; This file is part of GNU Guix.
 | 
					;;; This file is part of GNU Guix.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
| 
						 | 
					@ -35,6 +36,7 @@
 | 
				
			||||||
            url-fetch
 | 
					            url-fetch
 | 
				
			||||||
            guix-hash-url
 | 
					            guix-hash-url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            spdx-string->license
 | 
				
			||||||
            license->symbol
 | 
					            license->symbol
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            snake-case
 | 
					            snake-case
 | 
				
			||||||
| 
						 | 
					@ -109,7 +111,75 @@ recursively apply the procedure to the sub-list."
 | 
				
			||||||
  "Return the hash of FILENAME in nix-base32 format."
 | 
					  "Return the hash of FILENAME in nix-base32 format."
 | 
				
			||||||
  (bytevector->nix-base32-string (file-sha256 filename)))
 | 
					  (bytevector->nix-base32-string (file-sha256 filename)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define (spdx-string->license str)
 | 
				
			||||||
 | 
					  "Convert STR, a SPDX formatted license identifier, to a license object.
 | 
				
			||||||
 | 
					   Return #f if STR does not match any known identifiers."
 | 
				
			||||||
 | 
					  ;; https://spdx.org/licenses/
 | 
				
			||||||
 | 
					  ;; The psfl, gfl1.0, nmap, repoze
 | 
				
			||||||
 | 
					  ;; licenses doesn't have SPDX identifiers
 | 
				
			||||||
  (match str
 | 
					  (match str
 | 
				
			||||||
 | 
					    ("AGPL-1.0"                    'license:agpl-1.0)
 | 
				
			||||||
 | 
					    ("AGPL-3.0"                    'license:agpl-3.0)
 | 
				
			||||||
 | 
					    ("Apache-1.1"                  'license:asl1.1)
 | 
				
			||||||
 | 
					    ("Apache-2.0"                  'license:asl2.0)
 | 
				
			||||||
 | 
					    ("BSL-1.0"                     'license:boost1.0)
 | 
				
			||||||
 | 
					    ("BSD-2-Clause-FreeBSD"        'license:bsd-2)
 | 
				
			||||||
 | 
					    ("BSD-3-Clause"                'license:bsd-3)
 | 
				
			||||||
 | 
					    ("BSD-4-Clause"                'license:bsd-4)
 | 
				
			||||||
 | 
					    ("CC0-1.0"                     'license:cc0)
 | 
				
			||||||
 | 
					    ("CC-BY-2.0"                   'license:cc-by2.0)
 | 
				
			||||||
 | 
					    ("CC-BY-3.0"                   'license:cc-by3.0)
 | 
				
			||||||
 | 
					    ("CC-BY-SA-2.0"                'license:cc-by-sa2.0)
 | 
				
			||||||
 | 
					    ("CC-BY-SA-3.0"                'license:cc-by-sa3.0)
 | 
				
			||||||
 | 
					    ("CC-BY-SA-4.0"                'license:cc-by-sa4.0)
 | 
				
			||||||
 | 
					    ("CDDL-1.0"                    'license:cddl1.0)
 | 
				
			||||||
 | 
					    ("CECILL-C"                    'license:cecill-c)
 | 
				
			||||||
 | 
					    ("Artistic-2.0"                'license:artistic2.0)
 | 
				
			||||||
 | 
					    ("ClArtistic"                  'license:clarified-artistic)
 | 
				
			||||||
 | 
					    ("CPL-1.0"                     'license:cpl1.0)
 | 
				
			||||||
 | 
					    ("EPL-1.0"                     'license:epl1.0)
 | 
				
			||||||
 | 
					    ("MIT"                         'license:expat)
 | 
				
			||||||
 | 
					    ("FTL"                         'license:freetype)
 | 
				
			||||||
 | 
					    ("GFDL-1.1"                    'license:fdl1.1+)
 | 
				
			||||||
 | 
					    ("GFDL-1.2"                    'license:fdl1.2+)
 | 
				
			||||||
 | 
					    ("GFDL-1.3"                    'license:fdl1.3+)
 | 
				
			||||||
 | 
					    ("Giftware"                    'license:giftware)
 | 
				
			||||||
 | 
					    ("GPL-1.0"                     'license:gpl1)
 | 
				
			||||||
 | 
					    ("GPL-1.0+"                    'license:gpl1+)
 | 
				
			||||||
 | 
					    ("GPL-2.0"                     'license:gpl2)
 | 
				
			||||||
 | 
					    ("GPL-2.0+"                    'license:gpl2+)
 | 
				
			||||||
 | 
					    ("GPL-3.0"                     'license:gpl3)
 | 
				
			||||||
 | 
					    ("GPL-3.0+"                    'license:gpl3+)
 | 
				
			||||||
 | 
					    ("ISC"                         'license:isc)
 | 
				
			||||||
 | 
					    ("IJG"                         'license:ijg)
 | 
				
			||||||
 | 
					    ("Imlib2"                      'license:imlib2)
 | 
				
			||||||
 | 
					    ("IPA"                         'license:ipa)
 | 
				
			||||||
 | 
					    ("IPL-1.0"                     'license:ibmpl1.0)
 | 
				
			||||||
 | 
					    ("LGPL-2.0"                    'license:lgpl2.0)
 | 
				
			||||||
 | 
					    ("LGPL-2.0+"                   'license:lgpl2.0+)
 | 
				
			||||||
 | 
					    ("LGPL-2.1"                    'license:lgpl2.1)
 | 
				
			||||||
 | 
					    ("LGPL-2.1+"                   'license:lgpl2.1+)
 | 
				
			||||||
 | 
					    ("LGPL-3.0"                    'license:lgpl3.0)
 | 
				
			||||||
 | 
					    ("LGPL-3.0+"                   'license:lgpl3.0+)
 | 
				
			||||||
 | 
					    ("MPL-1.0"                     'license:mpl1.0)
 | 
				
			||||||
 | 
					    ("MPL-1.1"                     'license:mpl1.1)
 | 
				
			||||||
 | 
					    ("MPL-2.0"                     'license:mpl2.0)
 | 
				
			||||||
 | 
					    ("MS-PL"                       'license:ms-pl)
 | 
				
			||||||
 | 
					    ("NCSA"                        'license:ncsa)
 | 
				
			||||||
 | 
					    ("OpenSSL"                     'license:openssl)
 | 
				
			||||||
 | 
					    ("OLDAP-2.8"                   'license:openldap2.8)
 | 
				
			||||||
 | 
					    ("CUA-OPL-1.0"                 'license:opl1.0)
 | 
				
			||||||
 | 
					    ("QPL-1.0"                     'license:qpl)
 | 
				
			||||||
 | 
					    ("Ruby"                        'license:ruby)
 | 
				
			||||||
 | 
					    ("SGI-B-2.0"                   'license:sgifreeb2.0)
 | 
				
			||||||
 | 
					    ("OFL-1.1"                     'license:silofl1.1)
 | 
				
			||||||
 | 
					    ("Sleepycat"                   'license:sleepycat)
 | 
				
			||||||
 | 
					    ("TCL"                         'license:tcl/tk)
 | 
				
			||||||
 | 
					    ("Unlicense"                   'license:unlicense)
 | 
				
			||||||
 | 
					    ("Vim"                         'license:vim)
 | 
				
			||||||
 | 
					    ("X11"                         'license:x11)
 | 
				
			||||||
 | 
					    ("ZPL-2.1"                     'license:zpl2.1)
 | 
				
			||||||
 | 
					    ("Zlib"                        'license:zlib)
 | 
				
			||||||
    (_ #f)))
 | 
					    (_ #f)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (license->symbol license)
 | 
					(define (license->symbol license)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@
 | 
				
			||||||
(define-module (guix licenses)
 | 
					(define-module (guix licenses)
 | 
				
			||||||
  #:use-module (srfi srfi-9)
 | 
					  #:use-module (srfi srfi-9)
 | 
				
			||||||
  #:export (license? license-name license-uri license-comment
 | 
					  #:export (license? license-name license-uri license-comment
 | 
				
			||||||
            agpl3 agpl3+
 | 
					            agpl1 agpl3 agpl3+
 | 
				
			||||||
            asl1.1 asl2.0
 | 
					            asl1.1 asl2.0
 | 
				
			||||||
            boost1.0
 | 
					            boost1.0
 | 
				
			||||||
            bsd-2 bsd-3 bsd-4
 | 
					            bsd-2 bsd-3 bsd-4
 | 
				
			||||||
| 
						 | 
					@ -91,6 +91,11 @@
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; Code:
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define agpl1
 | 
				
			||||||
 | 
					  (license "AGPL 1"
 | 
				
			||||||
 | 
					           "https://gnu.org/licenses/agpl.html"
 | 
				
			||||||
 | 
					           "https://gnu.org/licenses/why-affero-gpl.html"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define agpl3
 | 
					(define agpl3
 | 
				
			||||||
  (license "AGPL 3"
 | 
					  (license "AGPL 3"
 | 
				
			||||||
           "https://gnu.org/licenses/agpl.html"
 | 
					           "https://gnu.org/licenses/agpl.html"
 | 
				
			||||||
| 
						 | 
					@ -271,6 +276,11 @@ at URI, which may be a file:// URI pointing the package's tree."
 | 
				
			||||||
           "https://www.gnu.org/licenses/fdl-1.1"
 | 
					           "https://www.gnu.org/licenses/fdl-1.1"
 | 
				
			||||||
           "https://www.gnu.org/licenses/license-list#FDL"))
 | 
					           "https://www.gnu.org/licenses/license-list#FDL"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define fdl1.2+
 | 
				
			||||||
 | 
					  (license "FDL 1.2+"
 | 
				
			||||||
 | 
					           "https://www.gnu.org/licenses/fdl-1.2"
 | 
				
			||||||
 | 
					           "https://www.gnu.org/licenses/license-list#FDL"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define fdl1.3+
 | 
					(define fdl1.3+
 | 
				
			||||||
  (license "FDL 1.3+"
 | 
					  (license "FDL 1.3+"
 | 
				
			||||||
           "https://www.gnu.org/licenses/fdl.html"
 | 
					           "https://www.gnu.org/licenses/fdl.html"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue