aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Craven <david@craven.ch>2016-09-22 11:33:46 +0200
committerDavid Craven <david@craven.ch>2016-09-28 13:15:31 +0200
commit59b2034787909cf7efa4e8d672a815b466d7d09d (patch)
treeadf9f63d76276f4cf3acdc2602109c35dc9b053b
parent263ac57fc22680395453bed34eaae8e63ea85bbb (diff)
downloadpatches-59b2034787909cf7efa4e8d672a815b466d7d09d.tar
patches-59b2034787909cf7efa4e8d672a815b466d7d09d.tar.gz
import: utils: Add spdx-string->license.
* guix/import/utils.scm (spdx-string->license): New variable. * guix/licenses.scm (agpl1, fdl1.2+): New variables.
-rw-r--r--guix/import/utils.scm70
-rw-r--r--guix/licenses.scm12
2 files changed, 81 insertions, 1 deletions
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 69e623a67f..ce0ba99fc0 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -35,6 +36,7 @@
url-fetch
guix-hash-url
+ spdx-string->license
license->symbol
snake-case
@@ -109,7 +111,75 @@ recursively apply the procedure to the sub-list."
"Return the hash of FILENAME in nix-base32 format."
(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
+ ("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)))
(define (license->symbol license)
diff --git a/guix/licenses.scm b/guix/licenses.scm
index 265f048278..8a98b0960a 100644
--- a/guix/licenses.scm
+++ b/guix/licenses.scm
@@ -27,7 +27,7 @@
(define-module (guix licenses)
#:use-module (srfi srfi-9)
#:export (license? license-name license-uri license-comment
- agpl3 agpl3+
+ agpl1 agpl3 agpl3+
asl1.1 asl2.0
boost1.0
bsd-2 bsd-3 bsd-4
@@ -91,6 +91,11 @@
;;;
;;; Code:
+(define agpl1
+ (license "AGPL 1"
+ "https://gnu.org/licenses/agpl.html"
+ "https://gnu.org/licenses/why-affero-gpl.html"))
+
(define agpl3
(license "AGPL 3"
"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/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+
(license "FDL 1.3+"
"https://www.gnu.org/licenses/fdl.html"