summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-09-04 23:43:24 +0200
committerLudovic Courtès <ludo@gnu.org>2012-09-04 23:43:24 +0200
commit609354bf0a361cb9217a3b43f270c7a986b54f63 (patch)
tree670c6f2ee034038dcdff6422cfe38b1bd35e8081
parent5dba31494e218db8f155ebf95a2a01859c29f078 (diff)
downloadpatches-609354bf0a361cb9217a3b43f270c7a986b54f63.tar
patches-609354bf0a361cb9217a3b43f270c7a986b54f63.tar.gz
guix-build: Add `--derivations'.
* guix-build.in (show-help): Add `--derivations'. (%options): Likewise. (guix-build): Handle it.
-rw-r--r--guix-build.in31
1 files changed, 19 insertions, 12 deletions
diff --git a/guix-build.in b/guix-build.in
index c7cf2ff7eb..6440f0a4db 100644
--- a/guix-build.in
+++ b/guix-build.in
@@ -84,6 +84,8 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
(display (_ "
-S, --source build the packages' source derivations"))
(display (_ "
+ -d, --derivations return the derivation paths of the given packages"))
+ (display (_ "
-K, --keep-failed keep build tree of failed builds"))
(display (_ "
-n, --dry-run do not build the derivations"))
@@ -112,6 +114,9 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
(option '(#\S "source") #f #f
(lambda (opt name arg result)
(alist-cons 'source? #t result)))
+ (option '(#\d "derivations") #f #f
+ (lambda (opt name arg result)
+ (alist-cons 'derivations-only? #t result)))
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression
@@ -196,15 +201,17 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
#:build-cores (or (assoc-ref opts 'cores)
(current-processor-count)))
- (or (assoc-ref opts 'dry-run?)
- (and (build-derivations %store drv)
- (for-each (lambda (d)
- (let ((drv (call-with-input-file d
- read-derivation)))
- (format #t "~{~a~%~}"
- (map (match-lambda
- ((out-name . out)
- (derivation-path->output-path
- d out-name)))
- (derivation-outputs drv)))))
- drv)))))
+ (if (assoc-ref opts 'derivations-only?)
+ (format #t "~{~a~%~}" drv)
+ (or (assoc-ref opts 'dry-run?)
+ (and (build-derivations %store drv)
+ (for-each (lambda (d)
+ (let ((drv (call-with-input-file d
+ read-derivation)))
+ (format #t "~{~a~%~}"
+ (map (match-lambda
+ ((out-name . out)
+ (derivation-path->output-path
+ d out-name)))
+ (derivation-outputs drv)))))
+ drv))))))