-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathinstall.lisp
104 lines (91 loc) · 5.12 KB
/
install.lisp
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
(defpackage #:qlot-tests/install
(:use #:cl
#:rove)
(:import-from #:qlot/install
#:install-qlfile
#:update-qlfile)
(:import-from #:qlot/utils/tmp
#:with-tmp-directory)
(:import-from #:qlot/utils/ql
#:parse-distinfo-file)
(:import-from #:alexandria
#:starts-with-subseq
#:set-equal)
(:import-from #:assoc-utils
#:aget))
(in-package #:qlot-tests/install)
(defun copy-qlfile (tmp-dir)
(uiop:copy-file (asdf:system-relative-pathname :qlot #P"tests/data/qlfile5")
(merge-pathnames #P"qlfile" tmp-dir))
(uiop:copy-file (asdf:system-relative-pathname :qlot #P"tests/data/qlfile5.lock")
(merge-pathnames #P"qlfile.lock" tmp-dir)))
(defun directory-name (path)
(car (last (pathname-directory path))))
(deftest install-qlfile-tests
(with-tmp-directory (tmp-dir)
(copy-qlfile tmp-dir)
(let ((qlhome (merge-pathnames #P".qlot/" tmp-dir))
(qlfile (merge-pathnames #P"qlfile" tmp-dir)))
(install-qlfile qlfile :quicklisp-home qlhome)
(ok (set-equal (mapcar #'directory-name
(uiop:subdirectories (merge-pathnames #P"dists/" qlhome)))
'("quicklisp"
"ultralisp"
"ironclad"
"cl-ppcre"
"lsx"
"fukamachi-lack"
"mito")
:test 'string=)
"dists are installed")
(let ((data (parse-distinfo-file (merge-pathnames "dists/quicklisp/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "2018-02-28")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/ultralisp/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "20190904101505")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/ironclad/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "git-66ddf32d8afc6581315c72422bf2343eab65009e")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/cl-ppcre/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "ql-2018-08-31")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/lsx/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "github-546032449c010e4153501accf1cac521")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/fukamachi-lack/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "ultralisp-20190904101505")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/mito/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "ql-upstream-8c795b7b4de7dc635f1d2442ef1faf8f23d283e6")))
;; Check if Dexador, qlot/distify depends on, is not installed in the local Quicklisp
(ng (find-if (lambda (name)
(starts-with-subseq "dexador-" name))
(uiop:subdirectories (merge-pathnames #P"dists/quicklisp/software/" qlhome))
:key #'directory-name))
(dolist (dist-name '("ironclad"
"cl-ppcre"
"lsx"
"fukamachi-lack"
"mito"))
(ok (uiop:directory-exists-p
(merge-pathnames (format nil "dists/~A/software/" dist-name)
qlhome))))
(let ((data (parse-distinfo-file (merge-pathnames "dists/fukamachi-lack/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "ultralisp-20190904101505")))
(update-qlfile qlfile
:quicklisp-home qlhome
:projects '("fukamachi-lack"))
(let ((data (parse-distinfo-file (merge-pathnames "dists/lsx/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "github-546032449c010e4153501accf1cac521")))
(update-qlfile qlfile
:quicklisp-home qlhome
:projects '("lsx"))
(let ((data (parse-distinfo-file (merge-pathnames "dists/quicklisp/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "2018-02-28")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/ultralisp/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "20190904101505")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/ironclad/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "git-66ddf32d8afc6581315c72422bf2343eab65009e")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/cl-ppcre/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "ql-2018-08-31")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/lsx/distinfo.txt" qlhome))))
(ng (equal (aget data "version") "github-546032449c010e4153501accf1cac521")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/fukamachi-lack/distinfo.txt" qlhome))))
(ng (equal (aget data "version") "ultralisp-20190904101505")))
(let ((data (parse-distinfo-file (merge-pathnames "dists/mito/distinfo.txt" qlhome))))
(ok (equal (aget data "version") "ql-upstream-8c795b7b4de7dc635f1d2442ef1faf8f23d283e6"))))))