-
Notifications
You must be signed in to change notification settings - Fork 9
/
quicklisp.lisp
78 lines (72 loc) · 3.24 KB
/
quicklisp.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
(in-package :manifest)
(defun system-descriptions ()
"Temporary hack until Xach provides a way to get this programatically from Quicklisp."
(let ((h (make-hash-table :test #'equal)))
(with-open-file (in "descriptions.txt")
(loop for line = (read-line in nil nil)
while line do
(let* ((pos (search " - " line))
(name (subseq line 0 pos))
(description (subseq line (+ pos 3))))
(setf (gethash name h) description))))
h))
(defun quicklisp-page (request)
(let ((descriptions (system-descriptions)))
(with-response-body (s request)
(with-html-output (s)
(:html
(:head
(:title "Manifest: Quicklisp browser")
(:link :rel "stylesheet" :type "text/css" :href "manifest.css"))
(:body
(:h1 "Dists")
(loop for dist in (ql-dist:all-dists) do
(html
(:h2 (:print (ql-dist:name dist)))
(:table
(:thead
(:th "System")
(:th "Description")
(:th "Installed?"))
(:tbody
(loop for system in (ql-dist:provided-systems dist)
for name = (ql-dist:name system)
for installedp = (ql-dist:installedp system)
for (description descriptionp) = (multiple-value-list
(gethash name descriptions "NO DESCRIPTION!"))
do
(html
(:tr :class (:format "~:[not-documented~;~]" descriptionp)
(:td
(if (and installedp (find-package (case-invert-name name)))
(html (:a :href (:format "/package/~a" name) name))
(html name)))
(:td :class "docs"
description)
(:td
(if installedp
(html "✓")
(html (:a :href (:format "/quicklisp/install/~a" name) "Install")))))))))))))))))
#+(or)(defun foo ()
(let ((dist (ql-dist:find-dist "quicklisp"))
(systems (make-hash-table))
(in (make-hash-table))
(out (make-hash-table))
(all (make-hash-table)))
(flet ((record-dependency (system dep)
(setf (gethash system all) t)
(setf (gethash dep all) t)
(incf (gethash system out 0))
(incf (gethash dep in 0))))
(loop for release in (ql-dist:provided-releases dist) do
(loop for system in (ql-dist:provided-systems release) do
(loop for dep in (ql-dist:required-systems system) do
(format t "~&~a requires ~a" (ql-dist:name system) dep)))))))
(defun quicklisp-install (request)
(destructuring-bind (quicklisp install system &rest rest)
(split-sequence #\/ (subseq (request-path request) 1))
(declare (ignore rest))
(assert (string= quicklisp "quicklisp"))
(assert (string= install "install"))
(ql:quickload system)
(redirect request "/quicklisp")))