Hi all,
I recently had the need to automatically produce native binaries for
nemo, one of my applications written in Scheme. So I decided to try using
awful to construct a simple server script that can fetch the latest version
of nemo from svn, compile nemo and its dependencies, make a release
tarball, and allow clients to download the latest tarball. With Mario's
help, it all worked quite well, so I am attaching the resulting script for
posterity.
The only difficulty I had was creating a download page that can return
one of two types of content: 1) .tar.gz file with correct MIME type and
disposition or 2) an HTML page informing the client that a build is
currently in progress. The download page specification in awful ended up as
follows:
(define-page "/nemo-download"
(lambda ()
(let ((version.path (update-nemo-build)))
;; check if the build lock file exists, meaning a build is currently
;; in progress
(if (file-exists? (build-lock-path (car version.path)))
`(html (body (p "Build in progress, try again later.")))
;; otherwise return the .tar.gz file
(lambda ()
(let ((rel-path (release-file-path (car version.path))))
(parameterize ((root-path (pathname-directory rel-path)))
(send-file (pathname-strip-directory rel-path))))))))
no-template: #t)
The send-file procedure is based on send-static-file from spiffy, and its
implementation can be seen in the attached file. I hope this is useful for
some.
-Ivan
nemo-ci.scm
Description: Binary data
_______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
