aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-26 11:58:28 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-27 14:17:09 +0200
commitc17f74bf190db87b45acb516b40bba2a7e257b89 (patch)
tree5b7af3e90c84faf428c45f98cc220f2fa7c68c00
parent815e8060affe953e8fcc64f644864e9f0ebd2b21 (diff)
downloadcuirass-c17f74bf190db87b45acb516b40bba2a7e257b89.tar
cuirass-c17f74bf190db87b45acb516b40bba2a7e257b89.tar.gz
cuirass: Make specification argument optional.
* bin/cuirass.in (%options): Add 'specifications' option. (main): Use it instead of the non-option command line arguments. (show-help): Adapt. * README (Example): Adapt.
-rw-r--r--README13
-rw-r--r--bin/cuirass.in45
2 files changed, 35 insertions, 23 deletions
diff --git a/README b/README
index 3096bf6..c27c472 100644
--- a/README
+++ b/README
@@ -16,4 +16,15 @@ Example
A quick way to manually test Cuirass is to execute:
- ./pre-inst-env cuirass --one-shot tests/hello-subset.scm --database=test.db
+ ./pre-inst-env cuirass --specifications=tests/hello-singleton.scm --database=test.db
+
+This will read the file "tests/hello-singleton.scm" which contains a list of
+specifications and add them to the database "test.db" which is created if it
+doesn't already exist.
+
+cuirass then loops evaluating/building the specs. The database keeps track of
+the specifications in order to allow users to accumulate specifications. To
+resume the evaluation/build process you can execute the same command without
+the specifications option:
+
+ ./pre-inst-env cuirass --database=test.db
diff --git a/bin/cuirass.in b/bin/cuirass.in
index 9d8a39e..3fe957e 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -32,11 +32,13 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(ice-9 rdelim))
(define (show-help)
- (format #t "Usage: ~a [OPTIONS] SPECFILE~%" (%program-name))
- (display "Run build jobs from SPECFILE.
+ (format #t "Usage: ~a [OPTIONS]~%" (%program-name))
+ (display "Run build jobs from internal database.
--one-shot Evaluate and build jobs only once
--cache-directory=DIR Use DIR for storing repository data
+ -S --specifications=SPECFILE
+ Add specifications from SPECFILE to database.
-D --database=DB Use DB to store build results.
-I, --interval=N Wait N seconds between each evaluation
-V, --version Display version
@@ -45,12 +47,13 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(show-package-information))
(define %options
- '((one-shot (value #f))
- (cache-directory (value #t))
- (database (single-char #\D) (value #t))
- (interval (single-char #\I) (value #t))
- (version (single-char #\V) (value #f))
- (help (single-char #\h) (value #f))))
+ '((one-shot (value #f))
+ (cache-directory (value #t))
+ (specifications (single-char #\S) (value #t))
+ (database (single-char #\D) (value #t))
+ (interval (single-char #\I) (value #t))
+ (version (single-char #\V) (value #f))
+ (help (single-char #\h) (value #f))))
(define (fetch-repository spec)
"Get the latest version of repository specified in SPEC. Clone repository
@@ -143,8 +146,7 @@ if required."
;;;
(define* (main #:optional (args (command-line)))
- (let* ((opts (getopt-long args %options))
- (specfile (option-ref opts '() '())))
+ (let* ((opts (getopt-long args %options)))
(parameterize
((%program-name (car args))
(%package-database (option-ref opts 'database (%package-database)))
@@ -157,22 +159,21 @@ if required."
((option-ref opts 'version #f)
(show-version)
(exit 0))
- ((null? specfile)
- (display "You must provide a specification file as argument.")
- (newline)
- (exit 1))
(else
(let ((one-shot? (option-ref opts 'one-shot #f))
(interval (string->number (option-ref opts 'interval "60")))
- (specs (save-module-excursion
- (λ ()
- (set-current-module (make-user-module))
- (primitive-load (car specfile))))))
+ (specfile (option-ref opts 'specifications #f)))
(with-database db
- (for-each (λ (spec) (db-add-specification db spec)) specs)
- (let ((specs* (db-get-specifications db)))
+ (and specfile
+ (let ((new-specs (save-module-excursion
+ (λ ()
+ (set-current-module (make-user-module))
+ (primitive-load specfile)))))
+ (for-each (λ (spec) (db-add-specification db spec))
+ new-specs)))
+ (let ((specs (db-get-specifications db)))
(if one-shot?
- (process-specs db specs*)
+ (process-specs db specs)
(while #t
- (process-specs db specs*)
+ (process-specs db specs)
(sleep interval)))))))))))