;;;; Purpose: Generate downloads page
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Aug 2002
;;;;
;;;; Purpose: Generate downloads page
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Aug 2002
;;;;
;;;; (http://www.gnu.org/licenses/gpl.html)
;;;; *************************************************************************
;;;; (http://www.gnu.org/licenses/gpl.html)
;;;; *************************************************************************
- (modtime (date-string (file-write-date file)))
- (basename (namestring
- (make-pathname :name (pathname-name file)
- :type (pathname-type file))))
- (ftp-name (strip-ftp-base file))
- (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))
+ (sig-path (concatenate 'string (namestring file) ".asc")))
- (setq size (round (/ (file-length strm) 1024))))
- (lml-print "<a href=\"~A~A\">~A</a>" *ftp-url* ftp-name basename)
- (lml-print "<span class=\"modtime\">")
- (lml-print " (~A, <b>~:D <span style=\"font-size:90%;\">KB</span></b>)</span>" modtime size)
+ (setq size (round (/ (file-length strm) 1024))))
+ (lml-format "<a href=\"~A~A\">~A</a>" *dl-url* dl-name basename)
+ (lml-princ "<span class=\"modtime\">")
+ (lml-format " (~A, <b>~:D <span style=\"font-size:90%;\">KB</span></b>)</span>" modtime size)
- (lml-print "<h1>Download</h1>")
- (lml-print "<div class=\"mainbody\">")
- (lml-print "<h3>Browse ~A FTP Site</h3>" name)
- (lml-print "<a style=\"padding-left:20pt;\" href=\"~A\">~A</a>" url url))
+ (lml-princ "<h1>Download</h1>")
+ (lml-princ "<div class=\"mainbody\">")
+ (lml-format "<h3>Browse ~A Download Site</h3>" name)
+ (lml-format "<a style=\"padding-left:20pt;\" href=\"~A\">~A</a>" url url))
- (lml-print "<h3>GPG Public Key</h3>")
- (lml-print "Use this <a href=\"https://www.b9.com/key.asc\">key</a> to verify file signtatures"))
- (lml-print "</div>"))
-
+ (lml-princ "<h3>GPG Public Key</h3>")
+ (lml-princ "Use this <a href=\"https://www.b9.com/kevin.gpg.asc\">key</a> to verify file signtatures"))
+ (lml-princ "</div>"))
+
(defun match-base-name? (name)
(let ((len-base-name (length *base-name*)))
(when (>= (length name) len-base-name)
(defun match-base-name? (name)
(let ((len-base-name (length *base-name*)))
(when (>= (length name) len-base-name)
- (dotimes (i len-base-name)
- (declare (fixnum i))
- (unless (char= (char *base-name* i)
- (char name i))
- (return-from match-base-name? nil)))))
- t)
+ (string= name *base-name* :end1 len-base-name :end2 len-base-name))))
+
+(defun match-base-name-latest? (name)
+ (let* ((latest (concatenate 'string *base-name* "-latest"))
+ (len-latest (length latest)))
+ (when (>= (length name) len-latest)
+ (string= name latest :end1 len-latest :end2 len-latest))))
- (let ((filtered '()))
- (dolist (f files)
- (let ((name (pathname-name f)))
- (when (match-base-name? name)
- (push f filtered))))
- (when filtered
- (sort filtered #'(lambda (a b) (when (and a b)
- (string<
- (namestring a)
- (namestring b))))))))
+ (delete-if-not #'(lambda (f) (match-base-name? (pathname-name f))) files))
+
+(defun filter-latest (files)
+ (delete-if #'(lambda (f) (match-base-name-latest? (pathname-name f))) files))
+
+(defun sort-pathnames (list)
+ (sort list #'(lambda (a b) (string< (namestring a) (namestring b)))))
- (mapcar #'display-sections sects)
- (if (consp value)
- (progn
- (print-sect-title title)
- (incf *section-indent*)
- (display-sections value)
- (decf *section-indent*))
- (display-one-section title value))))))
-
-(defun display-page (pkg-name pkg-base ftp-base ftp-url sects)
+ (dolist (sect sects) (display-sections sect))
+ (if (consp value)
+ (progn
+ (print-sect-title title)
+ (incf *section-indent*)
+ (display-sections value)
+ (decf *section-indent*))
+ (display-one-section title value))))))
+
+(defun display-page (pkg-name pkg-base dl-base dl-url giturl gitweb sects)
- (*ftp-base* ftp-base)
- (*ftp-url* ftp-url)
- (*base-name* pkg-base)
- (*signed* nil))
- (display-header pkg-name ftp-url)
- (mapcar #'display-sections sects)
+ (*dl-base* dl-base)
+ (*dl-url* dl-url)
+ (*base-name* pkg-base)
+ (*signed* nil))
+ (display-header pkg-name dl-url)
+ (map nil #'display-sections sects)
+ (when giturl
+ (if gitweb
+ (lml-format "<h2>Git Repository</h2><tt><a href=\"~A\">~A</a></tt>" gitweb giturl)
+ (lml-format "<h2>Git Repository</h2><tt>~A</tt>" giturl)))
- (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 ftp-base ftp-url
- `(("Manual" ,doc-path)
- ("Source Code"
- (("Unix (.tar.gz)" ,tgz-path)
- ("Windows (.zip)" ,zip-path))))))))
-
-(defun full-dl-page (pkg-name pkg-base ftp-base ftp-url)
- (let ((base (parse-namestring ftp-base)))
+ (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)
+ (let ((base (parse-namestring dl-base)))
- (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 "w32")
- :type :wild :name :wild)
- base)))
- (display-page pkg-name pkg-base ftp-base ftp-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
+ `(("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))))))))