guix-package: Use more (guix ui) features.
* guix-package.in (leave): Remove. (guix-package): Wrap body in `with-error-handling'.
This commit is contained in:
parent
cdd5d6f95f
commit
1275baeba7
|
@ -187,12 +187,6 @@ all of PACKAGES, a list of name/version/output/path tuples."
|
||||||
;; Alist of default option values.
|
;; Alist of default option values.
|
||||||
`((profile . ,%current-profile)))
|
`((profile . ,%current-profile)))
|
||||||
|
|
||||||
(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-help)
|
(define (show-help)
|
||||||
(display (_ "Usage: guix-package [OPTION]... PACKAGES...
|
(display (_ "Usage: guix-package [OPTION]... PACKAGES...
|
||||||
Install, remove, or upgrade PACKAGES in a single transaction.\n"))
|
Install, remove, or upgrade PACKAGES in a single transaction.\n"))
|
||||||
|
@ -322,6 +316,7 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
|
||||||
(setvbuf (current-error-port) _IOLBF)
|
(setvbuf (current-error-port) _IOLBF)
|
||||||
|
|
||||||
(let ((opts (parse-options)))
|
(let ((opts (parse-options)))
|
||||||
|
(with-error-handling
|
||||||
(parameterize ((%guile-for-build
|
(parameterize ((%guile-for-build
|
||||||
(package-derivation %store
|
(package-derivation %store
|
||||||
(if (assoc-ref opts 'bootstrap?)
|
(if (assoc-ref opts 'bootstrap?)
|
||||||
|
@ -338,7 +333,8 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
|
||||||
(_ #f))
|
(_ #f))
|
||||||
opts))
|
opts))
|
||||||
(drv (filter-map (match-lambda
|
(drv (filter-map (match-lambda
|
||||||
((name version sub-drv (? package? package))
|
((name version sub-drv
|
||||||
|
(? package? package))
|
||||||
(package-derivation %store package))
|
(package-derivation %store package))
|
||||||
(_ #f))
|
(_ #f))
|
||||||
install))
|
install))
|
||||||
|
@ -353,8 +349,8 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
|
||||||
(match tuple
|
(match tuple
|
||||||
((name version sub-drv _)
|
((name version sub-drv _)
|
||||||
(let ((output-path
|
(let ((output-path
|
||||||
(derivation-path->output-path drv
|
(derivation-path->output-path
|
||||||
sub-drv)))
|
drv sub-drv)))
|
||||||
`(,name ,version ,sub-drv ,output-path)))))
|
`(,name ,version ,sub-drv ,output-path)))))
|
||||||
install drv)))
|
install drv)))
|
||||||
(remove (filter-map (match-lambda
|
(remove (filter-map (match-lambda
|
||||||
|
@ -364,7 +360,8 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
|
||||||
opts))
|
opts))
|
||||||
(packages (append install*
|
(packages (append install*
|
||||||
(fold alist-delete
|
(fold alist-delete
|
||||||
(manifest-packages (profile-manifest profile))
|
(manifest-packages
|
||||||
|
(profile-manifest profile))
|
||||||
remove))))
|
remove))))
|
||||||
|
|
||||||
(show-what-to-build drv dry-run?)
|
(show-what-to-build drv dry-run?)
|
||||||
|
@ -382,7 +379,7 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
|
||||||
(symlink prof name)
|
(symlink prof name)
|
||||||
(when (file-exists? profile)
|
(when (file-exists? profile)
|
||||||
(delete-file profile))
|
(delete-file profile))
|
||||||
(symlink name profile))))))))))
|
(symlink name profile)))))))))))
|
||||||
|
|
||||||
;; Local Variables:
|
;; Local Variables:
|
||||||
;; eval: (put 'guard 'scheme-indent-function 1)
|
;; eval: (put 'guard 'scheme-indent-function 1)
|
||||||
|
|
Loading…
Reference in New Issue