(import irregex) (use srfi-1 ports files posix) (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)))) (display #<#EOF #this [ -h | --help ] #this [ [ ] 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). : --log-file= The name for the log file to be generated by salmonella (default=salmonella.log). --chicken-installation-prefix= 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= This option can be used customize chicken-install's arguments. You can use to indicate where you want the actual repository directory to be replaced by salmonella. --eggs-source-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= 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= A comma-separated list of eggs to be skipped. --repo-dir= 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. --verbosity= 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 ) (when epidemy? (display #<#EOF --instances= Number of salmonella instances to run in parallel. --salmonella-prefix= 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))))