summary refs log tree commit diff
path: root/guix/import/gem.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/import/gem.scm')
-rw-r--r--guix/import/gem.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index fc06b0d748..3d0c190656 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -29,7 +29,7 @@
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix base32)
   #:use-module (guix build-system ruby)
   #:export (gem->guix-package
@@ -155,6 +155,17 @@ package on RubyGems."
     ;; e.g. "https://rubygems.org/downloads/hashery-2.1.1.gem"
     (substring source-url 31 (string-rindex source-url #\-))))
 
+(define (string->license str)
+  "Convert the string STR into a license object."
+  (match str
+    ("GNU LGPL" license:lgpl2.0)
+    ("GPL" license:gpl3)
+    ((or "BSD" "BSD License") license:bsd-3)
+    ((or "MIT" "MIT license" "Expat license") license:expat)
+    ("Public domain" license:public-domain)
+    ((or "Apache License, Version 2.0" "Apache 2.0") license:asl2.0)
+    (_ #f)))
+
 (define (gem-package? package)
   "Return true if PACKAGE is a gem package from RubyGems."