@@ 27,6 27,13 @@
(let ((file (location-file (package-location package))))
(string-prefix? "guixrus/" file)))
+(define (commit-hash)
+ "Get HEAD commit hash for website."
+ (let* ((commit (open-input-pipe "git rev-parse HEAD"))
+ (str (get-string-all commit)))
+ (close-pipe commit)
+ str))
+
;;; HTML generator.
(define (package->sxml package)
@@ 41,9 48,6 @@
(define (sxml-page packages)
"Returns the guixrus HTML page for PACKAGES as an SXML tree."
- (let* ((commit (open-input-pipe "git rev-parse HEAD"))
- (str (get-string-all commit)))
- (close-pipe commit)
`(html (@ (lang "en"))
(meta (@ (charset "utf-8")))
(head
@@ 51,8 55,8 @@
(href "style.css")))
(title ,(number->string (length packages))))
(ol ,@(map package->sxml packages))
- (a (@ (href ,(string-append "https://git.sr.ht/~whereiseveryone/website/commit/" str)))
- ,(string-take str 7))))) ; Get short commit hash.
+ (a (@ (href ,(string-append "https://git.sr.ht/~whereiseveryone/website/commit/" (commit-hash))))
+ ,(string-take (commit-hash) 7)))) ; Get short commit hash.
(define (write-html-page packages port)
"Write the HTML page for PACKAGES to PORT."