~ salmonella-environment-setup (master) a5188833bcdf60db01f3330c4b0216fecfa2b72c
commit a5188833bcdf60db01f3330c4b0216fecfa2b72c Author: Mario Domenech Goulart <mario@ossystems.com.br> AuthorDate: Thu Oct 10 14:35:38 2013 -0300 Commit: Mario Domenech Goulart <mario@ossystems.com.br> CommitDate: Thu Oct 10 14:35:38 2013 -0300 Remove run-salmonella.scm This script has been superseded by salmonella-run-publish (https://github.com/mario-goulart/salmonella-run-publish) diff --git a/run-salmonella.scm b/run-salmonella.scm deleted file mode 100755 index 5353691..0000000 --- a/run-salmonella.scm +++ /dev/null @@ -1,168 +0,0 @@ -#! /usr/local/chicken/bin/csi -s - -;; This script is to be run on a chroot environment - -(use posix utils) - -(define tmp-dir "/root/salmonella") ;; in the chroot env -(define chicken-major-release 4) -(define chicken-core-dir (make-pathname tmp-dir "chicken-core")) -(define chicken-prefix (make-pathname tmp-dir "chicken")) -(define chicken-bootstrap-bin "/usr/local/chicken-4.6.0rc1/bin") -(define chicken-bootstrap (make-pathname chicken-bootstrap-bin "chicken")) -(define csi-bootstrap (make-pathname chicken-bootstrap-bin "csi")) -(define chicken-core-git-uri "http://code.call-cc.org/git/chicken-core.git") -(define chicken-core-branch "master") -(define os-platform "linux") -(define hw-platform "x86") -(define make "make") -(define egg-locations-uri "http://code.call-cc.org/svn/chicken-eggs/release/4/egg-locations") -(define egg-locations-file "/root/salmonella/egg-locations") -(define eggs-dir (make-pathname tmp-dir "chicken-eggs")) -(define wiki-svn-uri - (conc "https://anonymous@code.call-cc.org/svn/chicken-eggs/wiki/eggref/" chicken-major-release)) -(define wiki-dir - (make-pathname tmp-dir "wiki")) -(define svn-credentials "--username anonymous --password ''") -(define www-dir "/root/www/salmonella-report") -(define debug-file (make-pathname tmp-dir "run-salmonella.log")) - -(define (debug . things) - (when debug-file - (with-output-to-file debug-file - (lambda () - (print (string-intersperse (map ->string things) ""))) - append:))) - -(define (pad-number n zeroes) - (define (pad num len) - (let ((str (if (string? num) num (number->string num)))) - (if (string-null? str) - "" - (if (>= (string-length str) len) - str - (string-pad str len #\0))))) - - (let ((len (string-length (->string n)))) - (if (= len zeroes) - (number->string n) - (pad n zeroes)))) - -(define (! cmd #!optional dir) - (let ((cmd (string-intersperse (map ->string cmd))) - (cwd (and dir (current-directory)))) - (when dir - (change-directory dir) - (debug "@" dir)) - (debug cmd) - (let* ((p (open-input-pipe (sprintf "~A 2>&1" cmd))) - (output (read-all p)) - (exit-status (arithmetic-shift (close-input-pipe p) -8))) - (when dir (change-directory cwd)) - (unless (zero? exit-status) - (debug "Command '" cmd "' exited abnormally with status " exit-status) - (debug output) - (exit exit-status)) - (cons exit-status output)))) - -(define (run-salmonella) - - ;; Remove previous run data - (for-each (lambda (file) - (! `(rm -rf ,file) tmp-dir)) - `(chicken-prefix - salmonella.log - salmonella.log.bz2 - salmonella.progress - salmonella-repo - run-salmonella.log - salmonella-report - ,chicken-core-dir - henrietta-cache.log - make-check.out.txt - )) - - ;; Get the most recent version of the chicken-core - (if (file-exists? chicken-core-dir) - (! `(git pull) chicken-core-dir) - (! `(git clone -b ,chicken-core-branch ,chicken-core-git-uri) tmp-dir)) - - ;; Get the most recent versions of wiki documentation - (if (file-exists? wiki-dir) - (! `(svn up ,svn-credentials) wiki-dir) - (! `(svn co ,svn-credentials ,wiki-svn-uri ,(pathname-strip-directory wiki-dir)) tmp-dir)) - - ;; Get the most recent versions of all eggs - (unless (file-exists? eggs-dir) - (create-directory eggs-dir 'with-parents)) - (! `(wget --user=anonymous --password= ,egg-locations-uri -O ,egg-locations-file)) - (! `(,(make-pathname chicken-bootstrap-bin "henrietta-cache") -c ,eggs-dir -e ,egg-locations-file)) - - ;; Build chicken - (! `(touch *.scm) chicken-core-dir) - (! `(,make ,(string-append "PLATFORM=" os-platform " CHICKEN=" chicken-bootstrap) boot-chicken) chicken-core-dir) - (! `(touch *.scm) chicken-core-dir) - (! `(,make ,(string-append "PLATFORM=" os-platform " PREFIX=" chicken-prefix " CHICKEN=./chicken-boot") spotless install) chicken-core-dir) - (with-output-to-file - (make-pathname tmp-dir "make-check.out.txt") - (lambda () - (print - (cdr (! `(,make ,(string-append "PLATFORM=" os-platform " PREFIX=" chicken-prefix " CHICKEN=./chicken-boot") check) chicken-core-dir))))) - - ;; Run salmonella - (! `(,(string-append - "LC_ALL=C LANG=C QTDIR=/usr PATH=" (make-pathname chicken-prefix "bin") ":$PATH" - " " - (make-pathname (pathname-directory chicken-bootstrap) "salmonella")) - "'(dont-ask #t)'" - "'(verbose #f)'" - "'(run-tests #t)'" - "'(skip-eggs (list \"macosx\" \"objc\" \"hfs+\" \"osxattr\"))'" - ,(string-append "'(base-uri \"" - (make-pathname "http://tests.call-cc.org" (time->string (seconds->local-time (current-seconds)) "%Y/%m/%d")) - "\")'") - "'(css-file \"http://wiki.call-cc.org/chicken.css\")'" - ,(string-append "'(chicken-install \"" (make-pathname chicken-prefix "bin/chicken-install") "\")'") - ,(string-append "'(csi \"" (make-pathname chicken-prefix "bin/csi") "\")'") - ,(string-append "'(chicken-eggs-dir \"" eggs-dir "\")'") - ,(string-append "'(wiki-dir \"" wiki-dir "\")'") - ))) - - -(define (publish-results) - (let* ((now (seconds->local-time)) - (day (pad-number (vector-ref now 3) 2)) - (month (pad-number (add1 (vector-ref now 4)) 2)) - (year (number->string (+ 1900 (vector-ref now 5)))) - (publish-dir (make-pathname (list www-dir chicken-core-branch os-platform hw-platform year month) day)) - (feeds-dir (make-pathname (list www-dir "feeds" chicken-core-branch os-platform) hw-platform)) - (today-path (make-pathname (list year month) day))) - - (unless (file-exists? publish-dir) - (create-directory publish-dir 'parents-too)) - - (unless (file-exists? feeds-dir) - (create-directory feeds-dir 'parents-too)) - - ;; Generate the atom feeds - (! `(,csi-bootstrap -s ,(make-pathname (pathname-directory chicken-bootstrap) "salmonella-log2atom") - salmonella.log ,feeds-dir ,today-path 1)) - - (! `(bzip2 -9 salmonella.log) tmp-dir) - - (for-each (lambda (file) - (! `(cp -R ,file ,publish-dir) tmp-dir)) - '("salmonella.log.bz2" - "salmonella-report" - "run-salmonella.log" - "make-check.out.txt")))) - -;; Create the tmp dir if it not exists -(unless (file-exists? tmp-dir) - (create-directory tmp-dir 'parents-too)) - -;; Change to the tmp dir -(change-directory tmp-dir) - -(run-salmonella) -(publish-results)Trap