Commit d553e31f authored by Eric Timmons's avatar Eric Timmons
Browse files

cleanup: move licenses reader into CLI system

parent d8dc44b4
......@@ -6,13 +6,46 @@
(uiop:define-package #:clpm-cli/license-info
(:use #:cl
#:clpm-cli/common-args
#:clpm-cli/interface-defs
#:clpm-licenses)
#:clpm-cli/interface-defs)
(:import-from #:uiop
#:*stdout*))
(in-package #:clpm-cli/license-info)
(defparameter *license-root-dir*
(asdf:system-relative-pathname :clpm-cli "licenses/")
"Points to the root directory of licenses in the CLPM source folder. Is
cleared when UIOP's clear configuration hook is run (such as on image dump).")
(defun clear-root-dir ()
(setf *license-root-dir* nil))
(uiop:register-clear-configuration-hook 'clear-root-dir)
(defparameter *licenses* (make-hash-table :test 'equalp)
"A hash table that maps project names to license strings.")
(defparameter *notices* (make-hash-table :test 'equalp)
"A hash table that maps project names to NOTICE strings.")
(defparameter *clpm-license* nil)
(defun load-licenses ()
"Load all licenses from *license-root-dir*."
(let ((files (uiop:directory* (uiop:wilden *license-root-dir*))))
(dolist (f files)
(let ((name (pathname-name f))
(type (pathname-type f))
(contents (uiop:read-file-string f)))
(unless (equal name "README")
(if (equal type "NOTICE")
(setf (gethash name *notices*) contents)
(setf (gethash name *licenses*) contents)))))
(setf *clpm-license* (uiop:read-file-string (asdf:system-relative-pathname :clpm "LICENSE")))))
(eval-when (:load-toplevel)
(load-licenses))
(defparameter *license-info-ui*
(adopt:make-interface
:name "clpm license-info"
......
;;;; CLPM-Licenses System Definition
(defsystem #:clpm-licenses
:description "System containing the licenses for CLPM and its dependencies."
:license "BSD-2-Clause"
:serial t
:depends-on (#:clpm-features)
:components ((:module "licenses"
:components ((:static-file "adopt")
(:static-file "alexandria")
(:static-file "anaphora")
(:static-file "archive")
(:static-file "asdf")
(:static-file "asdf-system-groveler")
(:static-file "babel")
(:static-file "bobbin")
(:static-file "bordeaux-threads")
(:static-file "cffi")
(:static-file "chipz")
(:static-file "chunga")
(:static-file "cl-base64")
(:static-file "cl-cookie")
(:static-file "cl-date-time-parser")
(:static-file "cl-fad")
(:static-file "cl-interpol")
(:static-file "cl-plus-ssl"
:if-feature :clpm-openssl)
(:static-file "cl-ppcre")
(:static-file "cl-reexport")
(:static-file "cl-semver")
(:static-file "cl-syntax")
(:static-file "cl-unicode")
(:static-file "cl-utilities")
(:static-file "clon")
(:static-file "closer-mop")
(:static-file "clpm-multi-http-client")
(:static-file "deploy")
(:static-file "deploy.NOTICE")
(:static-file "dexador")
(:static-file "do-urlencode")
(:static-file "documentation-utils")
(:static-file "drakma")
(:static-file "esrap")
(:static-file "exit-hooks")
(:static-file "fast-http")
(:static-file "fast-io")
(:static-file "flexi-streams")
(:static-file "ieee-floats")
(:static-file "ironclad")
(:static-file "iterate")
(:static-file "jsown")
(:static-file "lisp-invocation")
(:static-file "log4cl")
(:static-file "log4cl.NOTICE")
(:static-file "named-readtables")
(:static-file "nibbles")
(:static-file "openssl"
:if-feature :clpm-openssl)
(:static-file "parse-float")
(:static-file "proc-parse")
(:static-file "puri")
(:static-file "ql-clpi")
(:static-file "quri")
(:static-file "s-xml")
(:static-file "salza2")
(:static-file "sbcl")
(:static-file "smart-buffer")
(:static-file "split-sequence")
(:static-file "static-vectors")
(:static-file "trivial-features")
(:static-file "trivial-garbage")
(:static-file "trivial-gray-streams")
(:static-file "trivial-indent")
(:static-file "trivial-mimes")
(:static-file "trivial-types")
(:static-file "trivial-utf-8")
(:static-file "usocket")
(:static-file "uuid")
(:static-file "winhttp")
(:static-file "xsubseq")))
(:file "src/clpm-licenses/main")))
;;;; CLPM Licenses. This file contains code to load the licenses of CLPM's
;;;; dependencies into the image.
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-licenses
(:use #:cl)
(:export #:*clpm-license*
#:*licenses*
#:*notices*))
(in-package #:clpm-licenses)
(defparameter *license-root-dir*
(asdf:system-relative-pathname :clpm-licenses "licenses/")
"Points to the root directory of licenses in the CLPM source folder. Is
cleared when UIOP's clear configuration hook is run (such as on image dump).")
(defun clear-root-dir ()
(setf *license-root-dir* nil))
(uiop:register-clear-configuration-hook 'clear-root-dir)
(defparameter *licenses* (make-hash-table :test 'equalp)
"A hash table that maps project names to license strings.")
(defparameter *notices* (make-hash-table :test 'equalp)
"A hash table that maps project names to NOTICE strings.")
(defparameter *clpm-license* nil)
(defun load-licenses ()
"Load all licenses from *license-root-dir*."
(let ((files (uiop:directory* (uiop:wilden *license-root-dir*))))
(dolist (f files)
(let ((name (pathname-name f))
(type (pathname-type f))
(contents (uiop:read-file-string f)))
(unless (equal name "README")
(if (equal type "NOTICE")
(setf (gethash name *notices*) contents)
(setf (gethash name *licenses*) contents)))))
(setf *clpm-license* (uiop:read-file-string (asdf:system-relative-pathname :clpm-licenses "LICENSE")))))
(eval-when (:load-toplevel)
(load-licenses))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment