Add spdx short identifiers, use it as asdf :license.

This commit is contained in:
2026-07-29 14:43:15 +03:00
parent e74c3eeb7b
commit f4578a5abb
4 changed files with 43 additions and 10 deletions
+20
View File
@@ -0,0 +1,20 @@
This directory contains license templates.
Template arguments are designated with an identifier inside
~{{}}~. Possible identifiers are:
- ~current-year~
- ~project-author~
- ~project-name~
* license sources
- [[https://choosealicense.com/licenses/]]
** [[https://spdx.org/licenses/][spdx]]
- [[https://spdx.org/licenses/Apache-2.0.html][Apache-2.0]]
- [[https://spdx.org/licenses/BSD-2-Clause.html][BSD-2-Clause]]
- [[https://spdx.org/licenses/BSD-3-Clause.html][BSD-3-Clause]]
- [[https://spdx.org/licenses/GPL-3.0-or-later.html][GPL-3.0-or-later]]
- [[https://spdx.org/licenses/MIT.html][MIT]]
- [[https://spdx.org/licenses/Unlicense.html][Unlicense]]
+1 -1
View File
@@ -2,7 +2,7 @@
:author "Emre Akan"
:description "Quickstart Common Lisp projects"
:license "GPL-3.0"
:version "0.0.6"
:version "0.0.7"
:depends-on ("uiop")
:pathname "src/"
:serial t
+20 -8
View File
@@ -11,7 +11,12 @@
:accessor license-file-name
:initform *license-default-filename*)
(writer :initform nil
:accessor license-writer)))
:accessor license-writer)
(spdx-short :initarg :license-spdx-short
:initform nil
:accessor license-spdx-short
:type (or string null)
:documentation "SPDX short identifier for the license. See at https://spdx.org/licenses/")))
(defun get-license (key)
(gethash key *licenses*))
@@ -28,10 +33,11 @@
(setf (gethash key *notices*) value)))
(eval-always
(defmacro deflicense (keys template-name &key file-name notice-name)
(defmacro deflicense (keys template-name &key file-name notice-name spdx)
(let ((sym (gensym "LICENSE")))
`(progn (let ((,sym (make-instance '<license>
:license-template-name ,template-name
:license-spdx-short ,spdx
,@(unless (null file-name)
`(:license-file-name ,file-name)))))
,@(loop for key in (uiop:ensure-list keys)
@@ -43,21 +49,27 @@
,@(loop for key in (uiop:ensure-list keys)
collect `(set-notice ,key ,sym)))))))))
(deflicense :mit "mit.txt")
(deflicense :mit "mit.txt"
:spdx "MIT")
(deflicense :gpl3+ "gpl-3.0-or-later.txt"
:file-name "COPYING"
:notice-name "gpl-3.0-or-later-notice.txt")
:notice-name "gpl-3.0-or-later-notice.txt"
:spdx "GPL-3.0-or-later")
(deflicense :apache2 "apache-2.0.txt"
:notice-name "apache-2.0-notice.txt")
:notice-name "apache-2.0-notice.txt"
:spdx "Apache-2.0")
(deflicense :unlicense "unlicense.txt"
:file-name "UNLICENSE")
:file-name "UNLICENSE"
:spdx "Unlicense")
(deflicense :bsd2 "bsd-2-clause.txt")
(deflicense :bsd2 "bsd-2-clause.txt"
:spdx "BSD-2-Clause")
(deflicense :bsd3 "bsd-3-clause.txt")
(deflicense :bsd3 "bsd-3-clause.txt"
:spdx "BSD-3-Clause")
(defmethod license-find-template ((license <license>))
(with-slots (template-name) license
+2 -1
View File
@@ -42,7 +42,8 @@
(format stream "defsystem ~S" name)
(format stream "~& :author ~S" author)
(format stream "~& :description ~S" description)
(format stream "~& :license ~S" license)
(let ((l (get-license license)))
(format stream "~& :license ~S" (license-spdx-short l)))
(format stream "~& :version ~S" version)
(unless (null pathname)
(format stream "~& :pathname ~S" pathname))