import: elpa: Return 'license:gpl3+ for ELPA only.

Fixes <https://bugs.gnu.org/30836>.
Reported by Konrad Hinsen <konrad.hinsen@fastmail.net>.

* guix/import/elpa.scm (elpa-package->sexp): Add LICENSE parameter and
honor it.
(elpa->guix-package): Pass 'license:gpl3+ only when REPO is 'gnu.
This commit is contained in:
Ludovic Courtès 2018-03-18 22:26:34 +01:00
parent e5425ed950
commit 9bb1838c3f
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -190,7 +190,7 @@ include VERSION."
url))) url)))
(_ #f)))) (_ #f))))
(define* (elpa-package->sexp pkg) (define* (elpa-package->sexp pkg #:optional license)
"Return the `package' S-expression for the Emacs package PKG, a record of "Return the `package' S-expression for the Emacs package PKG, a record of
type '<elpa-package>'." type '<elpa-package>'."
@ -234,12 +234,17 @@ type '<elpa-package>'."
(home-page ,(elpa-package-home-page pkg)) (home-page ,(elpa-package-home-page pkg))
(synopsis ,(elpa-package-synopsis pkg)) (synopsis ,(elpa-package-synopsis pkg))
(description ,(elpa-package-description pkg)) (description ,(elpa-package-description pkg))
(license license:gpl3+)))) (license ,license))))
(define* (elpa->guix-package name #:optional (repo 'gnu)) (define* (elpa->guix-package name #:optional (repo 'gnu))
"Fetch the package NAME from REPO and produce a Guix package S-expression." "Fetch the package NAME from REPO and produce a Guix package S-expression."
(let ((pkg (fetch-elpa-package name repo))) (match (fetch-elpa-package name repo)
(and=> pkg elpa-package->sexp))) (#f #f)
(package
;; ELPA is known to contain only GPLv3+ code. Other repos may contain
;; code under other license but there's no license metadata.
(let ((license (and (eq? 'gnu repo) 'license:gpl3+)))
(elpa-package->sexp package license)))))
;;; ;;;