aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-22 09:38:57 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-22 09:38:57 -0700
commitf393eeebe8cf6a31ecc2160658bee3d2c895a98b (patch)
treeb6c85fc026ffafc58f3c1479efadebb8ba699934 /src/data
parent2063385338300dfb11cd1a681ba0ca9e7b1aaf37 (diff)
downloadconsfigurator-f393eeebe8cf6a31ecc2160658bee3d2c895a98b.tar.gz
untabify
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/data')
-rw-r--r--src/data/asdf.lisp26
-rw-r--r--src/data/pgp.lisp54
2 files changed, 40 insertions, 40 deletions
diff --git a/src/data/asdf.lisp b/src/data/asdf.lisp
index 51ac344..67d405c 100644
--- a/src/data/asdf.lisp
+++ b/src/data/asdf.lisp
@@ -34,26 +34,26 @@
(defun asdf-data-source-check (iden1 system)
(when (and (string= iden1 "--lisp-system")
- (asdf:find-system system nil))
+ (asdf:find-system system nil))
(get-universal-time)))
(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 (ensure-directory-pathname
- (strcat (or (getenv "XDG_CACHE_HOME")
- (strcat (getenv "HOME") "/.cache"))
- "/consfigurator/systems")))
- (op 'asdf:monolithic-concatenate-source-op)
- (co (asdf:find-component system nil)))
+ (strcat (or (getenv "XDG_CACHE_HOME")
+ (strcat (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))
+ (t ,cache-dir)
+ :disable-cache
+ :ignore-inherited-configuration))
(asdf:operate op co)
(make-instance 'file-data :file (asdf:output-file op co)
- :mime "text/plain"
- :iden1 iden1
- :iden2 system
- :version (get-universal-time))))
+ :mime "text/plain"
+ :iden1 iden1
+ :iden2 system
+ :version (get-universal-time))))
diff --git a/src/data/pgp.lisp b/src/data/pgp.lisp
index 51e8a2d..a6b9339 100644
--- a/src/data/pgp.lisp
+++ b/src/data/pgp.lisp
@@ -31,46 +31,46 @@
(defmethod register-data-source ((type (eql :pgp)) &key location)
(unless (file-exists-p location)
(error 'missing-data-source
- :text (format nil "Could not open ~A" location)))
+ :text (format nil "Could not open ~A" location)))
(let ((mod (file-write-date location))
- (cache (read-store location)))
+ (cache (read-store location)))
(labels ((update-cache ()
- (let ((new-mod (file-write-date location)))
- (when (> new-mod mod)
- (setq mod new-mod
- cache (read-store location)))))
- (check (iden1 iden2)
- (update-cache)
- (cadr (data-assoc iden1 iden2 cache)))
- (extract (iden1 iden2)
- (update-cache)
- (let ((data (data-assoc iden1 iden2 cache)))
- (make-instance 'string-data
- :iden1 iden1 :iden2 iden2
- :string (cddr data) :version (cadr data)))))
+ (let ((new-mod (file-write-date location)))
+ (when (> new-mod mod)
+ (setq mod new-mod
+ cache (read-store location)))))
+ (check (iden1 iden2)
+ (update-cache)
+ (cadr (data-assoc iden1 iden2 cache)))
+ (extract (iden1 iden2)
+ (update-cache)
+ (let ((data (data-assoc iden1 iden2 cache)))
+ (make-instance 'string-data
+ :iden1 iden1 :iden2 iden2
+ :string (cddr data) :version (cadr data)))))
(cons #'check #'extract))))
(defun read-store (location)
(handler-case
(read-from-string
(run-program
- (escape-sh-command (list "gpg" "--decrypt" (unix-namestring location)))
- :output :string))
+ (escape-sh-command (list "gpg" "--decrypt" (unix-namestring location)))
+ :output :string))
(subprocess-error (error)
(error 'missing-data-source
- :text (format nil "While attempt to decrypt, gpg exited with ~A"
- (uiop:subprocess-error-code error))))))
+ :text (format nil "While attempt to decrypt, gpg exited with ~A"
+ (uiop:subprocess-error-code error))))))
(defun put-store (location data)
(run-program (list "gpg" "--encrypt")
- :input (make-string-input-stream (prin1-to-string data))
- :output (unix-namestring location)))
+ :input (make-string-input-stream (prin1-to-string data))
+ :output (unix-namestring location)))
(defun data-assoc (iden1 iden2 data)
(assoc (cons iden1 iden2) data
- :test (lambda (x y)
- (and (string= (car x) (car y))
- (string= (cdr x) (cdr y))))))
+ :test (lambda (x y)
+ (and (string= (car x) (car y))
+ (string= (cdr x) (cdr y))))))
(defun get-data (location iden1 iden2)
"Fetch a piece of prerequisite data.
@@ -83,9 +83,9 @@ Useful at the REPL."
Useful at the REPL."
(let ((data (delete-if
- (lambda (d)
- (and (string= (caar d) iden1) (string= (cdar d) iden2)))
- (and (file-exists-p location) (read-store location)))))
+ (lambda (d)
+ (and (string= (caar d) iden1) (string= (cdar d) iden2)))
+ (and (file-exists-p location) (read-store location)))))
(push (cons (cons iden1 iden2) (cons (get-universal-time) val)) data)
(put-store location data)))