summaryrefslogtreecommitdiff
path: root/guix/import/snix.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-29 14:03:46 +0100
committerLudovic Courtès <ludo@gnu.org>2014-10-29 14:03:46 +0100
commit7dbe096c633dae2d2f8c0044368c5897bde47107 (patch)
tree2642765c8f27ff8dc83876283fc355fc08988408 /guix/import/snix.scm
parent940a8c57be7ecdd139ba450765f0cc26de5b8ec7 (diff)
downloadpatches-7dbe096c633dae2d2f8c0044368c5897bde47107.tar
patches-7dbe096c633dae2d2f8c0044368c5897bde47107.tar.gz
import: snix: Handle license attributes.
* guix/import/snix.scm (snix-derivation->guix-package)[license-variable]: Move to... (license-variable): ... here. Handle license attributes.
Diffstat (limited to 'guix/import/snix.scm')
-rw-r--r--guix/import/snix.scm35
1 files changed, 24 insertions, 11 deletions
diff --git a/guix/import/snix.scm b/guix/import/snix.scm
index bcc4d6b7a6..adcea43c88 100644
--- a/guix/import/snix.scm
+++ b/guix/import/snix.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2010, 2011, 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2010, 2011, 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -310,6 +310,29 @@ attributes, or #f if NAME cannot be found."
(_
attributes))))
+(define (license-variable license)
+ "Return the name of the (guix licenses) variable for LICENSE."
+ (match license
+ ("GPLv2+" 'gpl2+)
+ ("GPLv3+" 'gpl3+)
+ ("LGPLv2+" 'lgpl2.1+)
+ ("LGPLv2.1+" 'lgpl2.1+)
+ ("LGPLv3+" 'lgpl3+)
+ (('attribute-set _ ...)
+ ;; At some point in 2013, Nixpkgs switched to attribute sets to represent
+ ;; licenses. These are listed in lib/licenses.nix.
+ (match (and=> (find-attribute-by-name "shortName" license)
+ attribute-value)
+ ("AGPL-3.0+" 'agpl3+)
+ ("GPL-2.0+" 'gpl2+)
+ ("GPL-3.0+" 'gpl3+)
+ ("LGPL-2.0+" 'lgpl2.0+)
+ ("LGPL-2.1+" 'lgpl2.1+)
+ ("LGPL-3.0+" 'lgpl3+)
+ ((? string? x) x)
+ (_ license)))
+ (_ license)))
+
(define (package-source-output-path package)
"Return the output path of the \"src\" derivation of PACKAGE."
(derivation-source-output-path (attribute-value package)))
@@ -369,16 +392,6 @@ location of DERIVATION."
(x x))
uri))
- (define (license-variable license)
- ;; Return the name of the (guix licenses) variable for LICENSE.
- (match license
- ("GPLv2+" 'gpl2+)
- ("GPLv3+" 'gpl3+)
- ("LGPLv2+" 'lgpl2.1+)
- ("LGPLv2.1+" 'lgpl2.1+)
- ("LGPLv3+" 'lgpl3+)
- (_ license)))
-
(let* ((source (find-attribute-by-name "src" attributes))
(urls (source-urls source))
(sha256 (source-sha256 source))