summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-01-07 22:32:28 +0100
committerLudovic Courtès <ludo@gnu.org>2013-01-07 22:32:28 +0100
commite7aa73ef0970a35818728195748b4a3dae6809ef (patch)
treeab4a4dfcfd06a4c39507b0f950d018a7ab13ef78
parentab8ed44fcee9208ecb8d61a5060aa204a6fb6f06 (diff)
downloadguix-e7aa73ef0970a35818728195748b4a3dae6809ef.tar.gz
snix: Use (guix licenses) variables.
* guix/snix.scm (snix-derivation->guix-package)[license-variable]: New
  procedure.
  Use it to determine the variable name for the license.
-rw-r--r--guix/snix.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/guix/snix.scm b/guix/snix.scm
index 0196ce925b..977898989b 100644
--- a/guix/snix.scm
+++ b/guix/snix.scm
@@ -393,6 +393,16 @@ location of DERIVATION."
             `(string-append ,@items))
            (x x)))
 
+       (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))
@@ -426,7 +436,7 @@ location of DERIVATION."
               ,(and=> (find-attribute-by-name "longDescription" meta)
                       attribute-value))
              (license ,(and=> (find-attribute-by-name "license" meta)
-                              attribute-value)))
+                              (compose license-variable attribute-value))))
           loc))))))
 
 (define (nixpkgs->guix-package nixpkgs attribute)