aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-02-16 18:39:13 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-02-16 18:39:13 -0700
commitb981a5e783d491de1aad59abb5db8469b73c1080 (patch)
treeca792a586eb97e89e77c304cd7c9a92df6be7920 /src/data
parentce5ab88ba012ae95c3916246d07e5de495a9edc0 (diff)
downloadconsfigurator-b981a5e783d491de1aad59abb5db8469b73c1080.tar.gz
move code into an src/ subdir
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/data')
-rw-r--r--src/data/asdf.lisp25
-rw-r--r--src/data/pgp.lisp8
2 files changed, 33 insertions, 0 deletions
diff --git a/src/data/asdf.lisp b/src/data/asdf.lisp
new file mode 100644
index 0000000..bca2346
--- /dev/null
+++ b/src/data/asdf.lisp
@@ -0,0 +1,25 @@
+(in-package :consfigurator.data.asdf)
+
+(defmethod register-data-source ((type (eql :asdf)) &key)
+ (add-data-source #'asdf-data-source-check #'get-path-to-concatenated-system))
+
+(defun asdf-data-source-check (iden1 system)
+ (and (string= iden1 "lisp-system")
+ (asdf:find-system system nil)))
+
+(Defun get-path-to-concatenated-system (iden1 system)
+ "Try to concatenate all the source code for SYSTEM, store it somewhere and
+return the filename."
+ (let ((cache-dir (uiop:ensure-pathname-directory
+ (strcat (or (uiop:getenv "XDG_CACHE_HOME")
+ (strcat (uiop:getenv "HOME") "/.cache"))
+ "/consfigurator/systems")))
+ (op 'asdf:monolithic-concatenate-source-op)
+ (co (asdf:find-component system nil)))
+ (ensure-directories-exist cache-dir)
+ (asdf:initialize-output-translations `(:output-translations
+ (t ,cache-dir)
+ :disable-cache
+ :ignore-inherited-configuration))
+ (asdf:operate op co)
+ (list :file (asdf:output-file op co))))
diff --git a/src/data/pgp.lisp b/src/data/pgp.lisp
new file mode 100644
index 0000000..c5affa5
--- /dev/null
+++ b/src/data/pgp.lisp
@@ -0,0 +1,8 @@
+(in-package :consfigurator.data.pgp)
+
+;;;; Simple PGP-encrypted file source of prerequisite data
+
+;; We provide an implementation of REGISTER-DATA-SOURCE and functions for the
+;; user to call at the REPL to add pieces of data, see what's there, etc. (a
+;; prerequisite data source which was some sort of external file-generating or
+;; secrets storage database might not provide any functions for the REPL).