Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

191 lines (163 sloc) 6.846 kb
(import irregex)
(use srfi-1 ports files posix)
(define (delete-path . paths)
;; We could simply use delete-directory giving it a truthy value as
;; second argument to make it recursive, but the recursive mode uses
;; find-files, which was broken before
;; ba01911d2644dd8ac40eced46a8451033e565d86. So, we implement a
;; simplified version of ##sys#find-files (find) and
;; delete-directory (rmdir).
(define (find dir)
;; simplified implementation of ##sys#find-files, which was broken
;; before
(let loop ((files (glob (make-pathname dir "?*")))
(all-files '()))
(if (null? files)
all-files
(let ((f (car files))
(rest (cdr files)))
(if (directory? f)
(cond ((member (pathname-file f) '("." ".."))
(loop rest all-files))
((and (symbolic-link? f))
(loop rest (cons f all-files)))
(else
(loop rest
(loop (glob (make-pathname f "?*"))
(cons f all-files)))))
(loop rest (cons f all-files)))))))
(define (rmdir name)
(let ((files (find name)))
(for-each
(lambda (f)
((cond ((symbolic-link? f) delete-file)
((directory? f) delete-directory)
(else delete-file))
f))
files)
(delete-directory name)))
(for-each (lambda (path)
(when (file-exists? path)
(if (directory? path)
(rmdir path)
(delete-file path))))
paths))
(define (get-egg-dependencies meta-data #!key with-test-dependencies?
with-versions?)
(define (deps key)
(or (and-let* ((d (assq key meta-data)))
(cdr d))
'()))
(map (lambda (dep)
(if with-versions?
dep
(if (pair? dep)
(car dep)
dep)))
(append (deps 'depends)
(deps 'needs)
(if with-test-dependencies?
(deps 'test-depends)
'()))))
(define (cmd-line-arg option args)
;; Returns the argument associated to the command line option OPTION
;; in ARGS or #f if OPTION is not found in ARGS or doesn't have any
;; argument.
(let ((val (any (lambda (arg)
(irregex-match
`(seq ,(->string option) "=" (submatch (* any)))
arg))
args)))
(and val (irregex-match-substring val 1))))
(define (die . msg)
(with-output-to-port (current-error-port)
(lambda ()
(for-each display msg)
(newline)
(flush-output)))
(exit 1))
(define (mktempdir)
;; For compatibility with older chickens.
;; `create-temporary-directory' has been introduced by 4.6.0
(let loop ()
(let ((dir (make-pathname
(current-directory)
(string-append "salmonella-tmp-"
(number->string (random 1000000) 16)))))
(if (file-exists? dir)
(loop)
(begin
(create-directory dir)
dir)))))
(define (usage #!key exit-code epidemy?)
(let ((this (pathname-strip-directory (program-name)))
(port (if (and exit-code (not (zero? exit-code)))
(current-error-port)
(current-output-port))))
(display #<#EOF
#this [ -h | --help ]
#this --version
#this [ [ <options> ] eggs ]
When called without eggs in the command line, salmonella will try to
find a .setup file in the current directory and process it (just like
chicken-install).
<options>:
--log-file=<logfile>
The name for the log file to be generated by salmonella
(default=salmonella.log).
--chicken-installation-prefix=<prefix dir>
If you want to test eggs using a chicken installed on a certain directory,
you can use this option (it should point to the same directory as given to
`PREFIX' when installing CHICKEN). If omitted, salmonella uses CHICKEN
tools from the current runtime's installation prefix.
--chicken-install-args=<install args>
This option can be used customize chicken-install's arguments. You can
use <repo> to indicate where you want the actual repository directory
to be replaced by salmonella.
--eggs-source-dir=<eggs dir>
By default, salmonella fetches eggs from the egg server. If you have a
local copy of eggs code, you can use this option to point to the directory
where they are located.
--eggs-doc-dir=<doc dir>
By default, salmonella checks if documentation for eggs exist by accessing
the CHICKEN wiki. If you have a local copy of the wiki documentation for
eggs, you can use this option to point to the directory where they can be
found.
--keep-repo
For each egg that salmonella tests, it sets the egg installation repository
empty and removes it at the end of its execution. This option makes
salmonella keep the egg installation repository after testing each egg and
after finishing its execution. This option can save a lot of time when
testing several eggs, at the cost of potentially making salmonella unable
to catch dependencies problems.
--skip-eggs=<comma-separated list of eggs to skip>
A comma-separated list of eggs to be skipped.
--repo-dir=<path to repo dir to be used>
Alternative location for the egg installation directory used by salmonella.
By default, salmonella generates a `salmonella-tmp-xxxxx' directory in the
current directory. This option can be useful when used with `--keep-repo'
to reuse egg installation repositories for several salmonella executions.
--clear-chicken-home
Remove Scheme files from <chicken-installation-prefix>/share/chicken.
WARNING: use this option with care. If you don't understand the
consequences of this option, DON'T USE IT. Extra care when you don't
use --chicken-installation-prefix -- in this case --clear-chicken-home
will remove Scheme files from your "host" CHICKEN installation.
This option is only effective when --keep-repo is NOT used.
--verbosity=<number>
A number to indicate salmonella's verbosity level. 0 means practically
silent. 1 is mostly silent and 2 (default) prints some useful information
while salmonella is running.
EOF
port)
(when epidemy?
(display #<#EOF
--instances=<number>
Number of salmonella instances to run in parallel.
--salmonella-prefix=<prefix dir>
Path to the directory where salmonella is installed. The default
value is the same prefix directory as salmonella-epidemy.
EOF
))
(newline)
(when exit-code (exit exit-code))))
Jump to Line
Something went wrong with that request. Please try again.