summary refs log tree commit diff
path: root/guix-build.in
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-01 00:50:01 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-01 00:52:44 +0100
commit073c34d72f94adf6c4c307239b1de0d14bdb60f3 (patch)
treeb671d6032f3feb08513d80c1be4870053b5af671 /guix-build.in
parent111111d04662bb9056c8b56d11e634dc4506ee1e (diff)
downloadguix-073c34d72f94adf6c4c307239b1de0d14bdb60f3.tar.gz
Add (guix ui).
* guix/ui.scm: New file.
* Makefile.am (MODULES): Add it.
* po/POTFILES.in: Add it.

* guix-build.in: Use it.
  (_, N_, leave): Remove.
  (guix-build): Use `with-error-handling' instead of the `guard' form.
* guix-download.in: Use it.
  (_, N_, leave): Remove.
Diffstat (limited to 'guix-build.in')
-rw-r--r--guix-build.in21
1 files changed, 2 insertions, 19 deletions
diff --git a/guix-build.in b/guix-build.in
index 7089a74731..961545b146 100644
--- a/guix-build.in
+++ b/guix-build.in
@@ -30,6 +30,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0"    \
 ;;; along with Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix-build)
+  #:use-module (guix ui)
   #:use-module (guix store)
   #:use-module (guix derivations)
   #:use-module (guix packages)
@@ -43,9 +44,6 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0"    \
   #:autoload   (distro) (find-packages-by-name)
   #:export (guix-build))
 
-(define _ (cut gettext <> "guix"))
-(define N_ (cut ngettext <> <> <> "guix"))
-
 (define %store
   (open-connection))
 
@@ -73,12 +71,6 @@ When SOURCE? is true, return the derivations of the package sources."
   `((system . ,(%current-system))
     (substitutes? . #t)))
 
-(define-syntax-rule (leave fmt args ...)
-  "Format FMT and ARGS to the error port and exit."
-  (begin
-    (format (current-error-port) fmt args ...)
-    (exit 1)))
-
 (define (show-version)
   (display "guix-build (@PACKAGE_NAME@) @PACKAGE_VERSION@\n"))
 
@@ -206,16 +198,7 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
   (setvbuf (current-output-port) _IOLBF)
   (setvbuf (current-error-port) _IOLBF)
 
-  (guard (c ((package-input-error? c)
-             (let* ((package  (package-error-package c))
-                    (input    (package-error-invalid-input c))
-                    (location (package-location package))
-                    (file     (location-file location))
-                    (line     (location-line location))
-                    (column   (location-column location)))
-               (leave (_ "~a:~a:~a: error: package `~a' has an invalid input: ~s~%")
-                      file line column
-                      (package-full-name package) input))))
+  (with-error-handling
     (let* ((opts (parse-options))
            (src? (assoc-ref opts 'source?))
            (sys  (assoc-ref opts 'system))