Skip to content

Commit 0d5a767

Browse files
committed
Make RUN smarter about converting raw args to final args
This is to allow things like: (run "command" (when flagp "--flagp") (when foo (list "--foo" foo)))
1 parent 2417bec commit 0d5a767

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

commands.lisp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
(run-error-command condition)
2121
(run-error-arguments condition)))))
2222

23-
(defun stringify-command-argument (argument)
23+
(defun prepare-command-argument (argument)
2424
(typecase argument
2525
(null nil)
26-
(string argument)
27-
(pathname (native-namestring argument))
28-
(keyword (format nil "--~(~A~)" argument))
29-
(t (princ-to-string argument))))
26+
(list (mapcan #'prepare-command-argument argument))
27+
(string (list argument))
28+
(pathname (list (native-namestring argument)))
29+
(keyword (list (format nil "--~(~A~)" argument)))
30+
(t (list (princ-to-string argument)))))
3031

3132
(defun run (command &rest arguments)
32-
(let* ((arguments (remove nil
33-
(mapcar #'stringify-command-argument arguments)))
33+
(let* ((arguments (mapcan #'prepare-command-argument arguments))
3434
(process (run-program command arguments
3535
:search t
3636
:wait t

dist-cache.lisp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -252,26 +252,27 @@ if needed."
252252
"If true, a depcheck will fail if :author/:description/:license
253253
options are missing from a system.")
254254

255-
(defun depcheck (primary-system sub-system &key fasl-directory)
255+
(defvar *depcheck-fasl-output-directory* nil)
256+
257+
(defun depcheck (primary-system sub-system
258+
&key (fasl-directory *depcheck-fasl-output-directory*))
256259
(ensure-system-file-index)
257260
(ensure-in-anonymous-directory
258-
(let* ((win (temporary-pathname "depcheck-win.txt"))
259-
(fail (temporary-pathname "depcheck-fail.txt"))
260-
(args (mapcan #'identity
261-
(list
262-
(list :index (native (translate-logical-pathname *system-file-index-file*)))
263-
(list :project primary-system)
264-
(list :system sub-system)
265-
(list :dependency-file win)
266-
(list :errors-file fail)
267-
(when *system-metadata-required-p*
268-
(list :metadata-required))
269-
(when fasl-directory
270-
(list :fasl-directory fasl-directory))))))
261+
(let ((win (temporary-pathname "depcheck-win.txt"))
262+
(fail (temporary-pathname "depcheck-fail.txt")))
271263
(ignore-errors (delete-file win))
272264
(ignore-errors (delete-file fail))
273265
(ignore-errors
274-
(apply #'run "depcheck" args))
266+
(run "depcheck"
267+
:index (native (translate-logical-pathname *system-file-index-file*))
268+
:project primary-system
269+
:system sub-system
270+
:dependency-file win
271+
:errors-file fail
272+
(when *system-metadata-required-p*
273+
:metadata-required)
274+
(when fasl-directory
275+
(list :fasl-directory fasl-directory))))
275276
(let* ((won (probe-file win))
276277
(first-line (and won (ignore-errors (first-line-of win))))
277278
(result (and first-line (split-spaces first-line))))

0 commit comments

Comments
 (0)