X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=inline;f=downloads.lisp;h=bac84bb967207cebff3faabb25a06f40aefccea7;hb=cfdabc1cd9728054e3a0267e4b59d8b1bfa28a81;hp=36af36d49fe929bde551b40974232524ff2a6758;hpb=e0405e6089892e5d88082bf12838b73e63440125;p=lml2.git
diff --git a/downloads.lisp b/downloads.lisp
index 36af36d..bac84bb 100644
--- a/downloads.lisp
+++ b/downloads.lisp
@@ -26,51 +26,52 @@
(defun strip-dl-base (file base)
(let ((fdir (pathname-directory file))
- (bdir (pathname-directory base)))
+ (bdir (pathname-directory base)))
(make-pathname
:name (pathname-name file)
:type (pathname-type file)
- :directory
+ :directory
(when (> (length fdir) (length bdir))
- (append '(:absolute)
- (subseq fdir (length bdir) (length fdir)))))))
-
+ (append '(:absolute)
+ (subseq fdir (length bdir) (length fdir)))))))
+
(defun print-file (file dl-data)
(let ((size 0)
- (modtime (date-string (file-write-date file)))
- (basename (namestring
- (make-pathname :name (pathname-name file)
- :type (pathname-type file))))
- (dl-name (strip-dl-base file (dl-data-base dl-data)))
- (sig-path (concatenate 'string (namestring file) ".asc")))
+ (modtime (date-string (file-write-date file)))
+ (basename (namestring
+ (make-pathname :name (pathname-name file)
+ :type (pathname-type file))))
+ (dl-name (strip-dl-base file (dl-data-base dl-data)))
+ (sig-path (concatenate 'string (namestring file) ".asc")))
(when (plusp (length basename))
(with-open-file (strm file :direction :input)
- (setq size (round (/ (file-length strm) 1024))))
+ (setq size (round (/ (file-length strm) 1024))))
(lml-format "~A"
- (dl-data-url dl-data) dl-name basename)
+ (dl-data-url dl-data) dl-name basename)
(lml-princ "")
(lml-format " (~A, ~:D KB)" modtime size)
(when (probe-file sig-path)
- (setf (dl-data-signed dl-data) t)
- (lml-format " [Signature]"
- (dl-data-url dl-data) dl-name))
+ (setf (dl-data-signed dl-data) t)
+ (lml-format " [Signature]"
+ (dl-data-url dl-data) dl-name))
(html :br))))
(defun display-header (name url)
(lml-princ "
")
(lml-format "
Browse ~A Download Site
" name)
- (lml-format "
~A" url url))
+ (let ((*print-circle* nil))
+ (lml-format "
~A" url url)))
(defun display-footer (dl-data)
(when (dl-data-signed dl-data)
(lml-princ "
GPG Public Key
")
(lml-princ "Use this
key to verify file signtatures"))
(lml-princ "
"))
-
+
(defun print-sect-title (title dl-data)
(lml-format "")
@@ -110,64 +111,68 @@
(defun display-sections (sects dl-data)
(when sects
(let ((title (car sects))
- (value (cadr sects)))
+ (value (cadr sects)))
(if (consp title)
- (dolist (sect sects)
- (display-sections sect dl-data))
- (if (consp value)
- (progn
- (print-sect-title title dl-data)
- (incf (dl-data-indent dl-data))
- (display-sections value dl-data)
- (decf (dl-data-indent dl-data)))
- (display-one-section title value dl-data))))))
-
-(defun display-page (pkg-name pkg-base dl-base dl-url sects)
+ (dolist (sect sects)
+ (display-sections sect dl-data))
+ (if (consp value)
+ (progn
+ (print-sect-title title dl-data)
+ (incf (dl-data-indent dl-data))
+ (display-sections value dl-data)
+ (decf (dl-data-indent dl-data)))
+ (display-one-section title value dl-data))))))
+
+(defun display-page (pkg-name pkg-base dl-base dl-url giturl gitweb sects)
(let ((dl-data (make-dl-data :indent 3
- :base dl-base
- :url dl-url
- :name pkg-base
- :signed nil)))
+ :base dl-base
+ :url dl-url
+ :name pkg-base
+ :signed nil)))
(display-header pkg-name dl-url)
(dolist (sect sects)
(display-sections sect dl-data))
+ (when giturl
+ (lml-format "
Git Repository
~A" giturl)
+ (when gitweb
+ (lml-format " [
Browse]" gitweb)))
(display-footer dl-data)))
-(defun std-dl-page (pkg-name pkg-base dl-base dl-url)
+(defun std-dl-page (pkg-name pkg-base dl-base dl-url &optional giturl gitweb)
(let ((base (parse-namestring dl-base)))
(let ((tgz-path (make-pathname :defaults base :type "gz" :name :wild))
- (zip-path (make-pathname :defaults base :type "zip" :name :wild))
- (doc-path (make-pathname :defaults base :type "pdf" :name :wild)))
- (display-page pkg-name pkg-base dl-base dl-url
- `(("Manual" ,doc-path)
- ("Source Code"
- (("Unix (.tar.gz)" ,tgz-path)
- ("Windows (.zip)" ,zip-path))))))))
-
-(defun full-dl-page (pkg-name pkg-base dl-base dl-url)
+ (zip-path (make-pathname :defaults base :type "zip" :name :wild))
+ (doc-path (make-pathname :defaults base :type "pdf" :name :wild)))
+ (display-page pkg-name pkg-base dl-base dl-url giturl gitweb
+ `(("Manual" ,doc-path)
+ ("Source Code"
+ (("Unix (.tar.gz)" ,tgz-path)
+ ("Windows (.zip)" ,zip-path))))))))
+
+(defun full-dl-page (pkg-name pkg-base dl-base dl-url &optional giturl gitweb)
(let ((base (parse-namestring dl-base)))
(let ((tgz-path (make-pathname :defaults base :type "gz" :name :wild))
- (zip-path (make-pathname :defaults base :type "zip" :name :wild))
- (doc-path (make-pathname :defaults base :type "pdf" :name :wild))
- (deb-path (merge-pathnames
- (make-pathname :directory '(:relative "linux-debian")
- :type :wild :name :wild)
- base))
- (rpm-path (merge-pathnames
- (make-pathname :directory '(:relative "linux-rpm")
- :type :wild :name :wild)
- base))
- (w32-path (merge-pathnames
- (make-pathname :directory '(:relative "win32")
- :type :wild :name :wild)
- base)))
- (display-page pkg-name pkg-base dl-base dl-url
- `(("Manual" ,doc-path)
- ("Source Code"
- (("Unix (.tar.gz)" ,tgz-path)
- ("Windows (.zip)" ,zip-path)))
- ("Binaries"
- (("Linux Binaries"
- (("Debian Linux" ,deb-path)
- ("RedHat Linux" ,rpm-path)))
- ("Windows Binaries" ,w32-path))))))))
+ (zip-path (make-pathname :defaults base :type "zip" :name :wild))
+ (doc-path (make-pathname :defaults base :type "pdf" :name :wild))
+ (deb-path (merge-pathnames
+ (make-pathname :directory '(:relative "linux-debian")
+ :type :wild :name :wild)
+ base))
+ (rpm-path (merge-pathnames
+ (make-pathname :directory '(:relative "linux-rpm")
+ :type :wild :name :wild)
+ base))
+ (w32-path (merge-pathnames
+ (make-pathname :directory '(:relative "win32")
+ :type :wild :name :wild)
+ base)))
+ (display-page pkg-name pkg-base dl-base dl-url giturl gitweb
+ `(("Manual" ,doc-path)
+ ("Source Code"
+ (("Unix (.tar.gz)" ,tgz-path)
+ ("Windows (.zip)" ,zip-path)))
+ ("Binaries"
+ (("Linux Binaries"
+ (("Debian Linux" ,deb-path)
+ ("RedHat Linux" ,rpm-path)))
+ ("Windows Binaries" ,w32-path))))))))