aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/data.rst2
-rw-r--r--src/util.lisp22
2 files changed, 8 insertions, 16 deletions
diff --git a/doc/data.rst b/doc/data.rst
index 47783b4..faba8a3 100644
--- a/doc/data.rst
+++ b/doc/data.rst
@@ -74,7 +74,7 @@ can't decrypt the store. If a prerequisite data source wants to effectively
bypass caching and provide fresh data every time Consfigurator deploys the
host, it can use ``GET-UNIVERSAL-TIME`` as its first function.
-Versions are compared using ``dpkg --compare-versions``.
+Versions are compared using ``UIOP:VERSION<`` and ``UIOP:VERSION<=``.
Security issues
---------------
diff --git a/src/util.lisp b/src/util.lisp
index cbc21c2..60653da 100644
--- a/src/util.lisp
+++ b/src/util.lisp
@@ -249,28 +249,20 @@ previous output."
;;;; Version numbers
+(defun number->string (x)
+ (etypecase x (string x) (number (format nil "~D" x))))
+
(defun version< (x y)
- (dpkg-version-compare x "<<" y))
+ (uiop:version< (number->string x) (number->string y)))
(defun version> (x y)
- (dpkg-version-compare x ">>" y))
+ (version< y x))
(defun version<= (x y)
- (dpkg-version-compare x "<=" y))
+ (uiop:version<= (number->string x) (number->string y)))
(defun version>= (x y)
- (dpkg-version-compare x ">=" y))
-
-(defun dpkg-version-compare (x r y)
- (zerop (nth-value 2 (run-program `("dpkg" "--compare-versions"
- ,(etypecase x
- (string x)
- (number (format nil "~A" x)))
- ,r
- ,(etypecase y
- (string y)
- (number (format nil "~A" y))))
- :ignore-error-status t))))
+ (version<= y x))
;;;; Encoding of strings to filenames