From fe5ea9c022eb3f4cd7c2fa4c8f1a5a6a2b1ad52c Mon Sep 17 00:00:00 2001 From: Lionel Flandrin Date: Mon, 9 Nov 2009 12:59:11 +0100 Subject: [PATCH] Use the output of "git describe" in *version* when a ".git" exists. --- version.lisp.in | 8 ++++++-- wrappers.lisp | 22 ++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/version.lisp.in b/version.lisp.in index 7dfe360..205c784 100644 --- a/version.lisp.in +++ b/version.lisp.in @@ -28,9 +28,13 @@ (export '(*version* version)) (defparameter *version* - #.(concatenate 'string "@PACKAGE_VERSION@ Compiled On " + #.(concatenate 'string + (if (probe-file ".git") + (string-trim '(#\Newline) (run-shell-command "git describe" t)) + "@PACKAGE_VERSION@") + " Compiled On " (format-expand *time-format-string-alist* - *time-format-string-default*))) + *time-format-string-default*))) (defcommand version () () (message *version*)) diff --git a/wrappers.lisp b/wrappers.lisp index 58a0667..d7f9f99 100644 --- a/wrappers.lisp +++ b/wrappers.lisp @@ -88,10 +88,11 @@ #+clisp (with-output-to-string (s) ;; Arg. We can't pass in an environment so just set the DISPLAY ;; variable so it's inherited by the child process. - (setf (getenv "DISPLAY") (format nil "~a:~d.~d" - (screen-host (current-screen)) - (xlib:display-display *display*) - (screen-id (current-screen)))) + (when (current-screen) + (setf (getenv "DISPLAY") (format nil "~a:~d.~d" + (screen-host (current-screen)) + (xlib:display-display *display*) + (screen-id (current-screen))))) (let ((out (ext:run-program prog :arguments args :wait t :output :stream))) (loop for i = (read-char out nil out) until (eq i out) @@ -101,10 +102,15 @@ (sb-ext:run-program prog args :output s :error s :wait t ;; inject the DISPLAY variable in so programs show up ;; on the right screen. - :environment (cons (screen-display-string (current-screen)) - (remove-if (lambda (str) - (string= "DISPLAY=" str :end2 (min 8 (length str)))) - (sb-ext:posix-environ))))) + :environment + (let ((env (remove-if (lambda (str) + (string= "DISPLAY=" str :end2 (min 8 (length str)))) + (sb-ext:posix-environ))) + (current-screen (current-screen))) + (if current-screen + (cons (screen-display-string (current-screen)) + env) + env)))) #+ccl (with-output-to-string (s) (ccl:run-program prog (mapcar (lambda (s) (if (simple-string-p s) s (coerce s 'simple-string))) -- 1.6.5.2