mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
import: snix: Handle license attributes.
* guix/import/snix.scm (snix-derivation->guix-package)[license-variable]: Move to... (license-variable): ... here. Handle license attributes.
This commit is contained in:
parent
940a8c57be
commit
7dbe096c63
1 changed files with 24 additions and 11 deletions
|
@ -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 @@ (define (find-attribute-by-name name attributes)
|
|||
(_
|
||||
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 @@ (define (pretty-uri uri version)
|
|||
(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))
|
||||
|
|
Loading…
Reference in a new issue