aboutsummaryrefslogtreecommitdiff
path: root/src/util.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-05-16 14:55:15 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-05-17 12:52:15 -0700
commit0dc93f41c87256a1bab12975e98ebbe2f9426ffa (patch)
treebb5f64b59c777f00552efe9b4f9990b42ca69973 /src/util.lisp
parent08b78ef52866754f93b977ebd73098047f54c49a (diff)
downloadconsfigurator-0dc93f41c87256a1bab12975e98ebbe2f9426ffa.tar.gz
use UIOP rather than dpkg(1) to compare prerequisite data versions
For both performance and portability reasons. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/util.lisp')
-rw-r--r--src/util.lisp22
1 files changed, 7 insertions, 15 deletions
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