-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsbag-tools-common.asd
89 lines (67 loc) · 2.69 KB
/
rsbag-tools-common.asd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
;;;; rsbag-tools-common.asd --- Common functions for rsbag-based utilities.
;;;;
;;;; Copyright (C) 2012-2018 Jan Moringen
;;;;
;;;; Author: Jan Moringen <[email protected]>
(cl:defpackage #:rsbag-tools-common-system
(:use
#:cl
#:asdf)
(:export
#:version/list
#:version/string))
(cl:in-package #:rsbag-tools-common-system)
;;; Version stuff
(defparameter +version-major+ 0
"Major component of version number.")
(defparameter +version-minor+ 19
"Minor component of version number.")
(let* ((version-file (merge-pathnames "version.sexp" *load-truename*))
stream)
(when (probe-file version-file)
(setf stream (open version-file)))
(defparameter +version-revision+ (if stream (read stream) 0)
"Revision component of version number.")
(defparameter +version-commit+ (when stream (read stream))
"Commit component of version number.")
(when stream (close stream)))
(defun version/list (&key
(revision? t)
commit?)
"Return a version of the form (MAJOR MINOR [REVISION [COMMIT]])
where REVISION and COMMIT are optional.
REVISION? controls whether REVISION should be included. Default
behavior is to include REVISION.
COMMIT? controls whether COMMIT should be included. Default behavior
is to not include COMMIT."
(append (list +version-major+ +version-minor+)
(when revision? (list +version-revision+))
(when (and commit? +version-commit+)
(list +version-commit+))))
(defun version/string (&rest args
&key
revision?
commit?)
"Return a version string of the form
\"MAJOR.MINOR[.REVISION[-.COMMIT]]\" where REVISION and COMMIT are
optional.
See `version/list' for details on keyword parameters."
(declare (ignore revision? commit?))
(format nil "~{~A.~A~^.~A~^-~A~}" (apply #'version/list args)))
;;; System definition
(asdf:defsystem "rsbag-tools-common"
:description "Common functions for RSBag-related systems."
:license "GPLv3" ; see COPYING file for details
:author "Jan Moringen <[email protected]>"
:maintainer "Jan Moringen <[email protected]>"
:version #.(version/string)
:depends-on ("alexandria"
"let-plus"
(:version "cl-rsbag" #.(version/string :revision? nil))
(:version "rsb-tools-common" #.(version/string :revision? nil)))
:components ((:module "common"
:pathname "src/common"
:serial t
:components ((:file "package")
(:file "help")
(:file "options")))))