guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: scripts: discover: Report Avahi errors.


From: guix-commits
Subject: branch master updated: scripts: discover: Report Avahi errors.
Date: Sat, 22 May 2021 08:06:03 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 7003b2d  scripts: discover: Report Avahi errors.
7003b2d is described below

commit 7003b2db526fc367664f3a7c4bdbe38a7c717da6
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Fri May 21 15:21:15 2021 +0200

    scripts: discover: Report Avahi errors.
    
    Fixes: <https://issues.guix.gnu.org/48561>.
    
    * guix/scripts/discover (guix-discover): Report Avahi errors.
---
 guix/scripts/discover.scm | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/discover.scm b/guix/scripts/discover.scm
index be1eaa6..dadade8 100644
--- a/guix/scripts/discover.scm
+++ b/guix/scripts/discover.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2020 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2020, 2021 Mathieu Othacehe <othacehe@gnu.org>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -26,6 +26,7 @@
   #:use-module (guix build syscalls)
   #:use-module (guix build utils)
   #:use-module (guix scripts publish)
+  #:use-module (avahi)
   #:use-module (ice-9 rdelim)
   #:use-module (srfi srfi-37)
   #:export (read-substitute-urls
@@ -138,5 +139,16 @@ to synchronize with the writer."
       (parameterize ((%publish-file publish-file))
         (mkdir-p (dirname publish-file))
         (false-if-exception (delete-file publish-file))
-        (avahi-browse-service-thread service-proc
-                                     #:types %services)))))
+        (catch 'avahi-error
+          (lambda ()
+            (avahi-browse-service-thread service-proc
+                                         #:types %services))
+          (lambda (key err function . _)
+            (cond
+             ((eq? err error/no-daemon)
+              (warning (G_ "Avahi daemon is not running, \
+cannot auto-discover substitutes servers.~%")))
+             (else
+              (report-error (G_ "an Avahi error was raised by `~a': ~a~%")
+                            function (error->string err))))
+            (exit 1)))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]