From patchwork Tue Feb 20 19:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 60813 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C6ADD27BBEA; Tue, 20 Feb 2024 19:42:51 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4CC1327BBE2 for ; Tue, 20 Feb 2024 19:42:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcW0q-0004D1-VV; Tue, 20 Feb 2024 14:42:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcW0p-0004CB-D9 for guix-patches@gnu.org; Tue, 20 Feb 2024 14:42:43 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcW0p-00016F-4T; Tue, 20 Feb 2024 14:42:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcW18-0002ZM-Nj; Tue, 20 Feb 2024 14:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69291] [PATCH 1/5] scripts: substitute: Remove side effect warning from network-error?. References: <87le7flz89.fsf@cbaines.net> In-Reply-To: <87le7flz89.fsf@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 20 Feb 2024 19:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69291 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69291@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69291-submit@debbugs.gnu.org id=B69291.17084581769831 (code B ref 69291); Tue, 20 Feb 2024 19:43:02 +0000 Received: (at 69291) by debbugs.gnu.org; 20 Feb 2024 19:42:56 +0000 Received: from localhost ([127.0.0.1]:46675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcW11-0002YQ-Tc for submit@debbugs.gnu.org; Tue, 20 Feb 2024 14:42:56 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcW0x-0002Xo-AB for 69291@debbugs.gnu.org; Tue, 20 Feb 2024 14:42:51 -0500 Received: from localhost (unknown [212.132.255.10]) by mira.cbaines.net (Postfix) with ESMTPSA id EBE3527BBE2 for <69291@debbugs.gnu.org>; Tue, 20 Feb 2024 19:42:28 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 3127bf43 for <69291@debbugs.gnu.org>; Tue, 20 Feb 2024 19:42:28 +0000 (UTC) From: Christopher Baines Date: Tue, 20 Feb 2024 19:42:23 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Instead, display the warning from process-substitution and process-substitution/fallback in the relevant places. I'm looking at this because I want to make the substitute code less tied to the script and usable in the Guile guix-daemon. * guix/scripts/substitute.scm (network-error?): Move warning to… (process-substitution/fallback, process-substitution): here. Change-Id: I082b482c0e6ec7e02a8d437ba22dcefca5c40787 --- guix/scripts/substitute.scm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) base-commit: 3d061d9677027be7651f8e5a3a02e19daacd9a85 diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 37cd08e289..f3eed0eb44 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -613,13 +613,7 @@ (define network-error? (and (kind-and-args? exception) (memq (exception-kind exception) '(gnutls-error getaddrinfo-error))) - (and (http-get-error? exception) - (begin - (warning (G_ "download from '~a' failed: ~a, ~s~%") - (uri->string (http-get-error-uri exception)) - (http-get-error-code exception) - (http-get-error-reason exception)) - #t)))))) + (http-get-error? exception))))) (define* (process-substitution/fallback port narinfo destination #:key cache-urls acl @@ -647,7 +641,13 @@ (define* (process-substitution/fallback port narinfo destination (if (or (equivalent-narinfo? narinfo alternate) (valid-narinfo? alternate acl) (%allow-unauthenticated-substitutes?)) - (guard (c ((network-error? c) (loop rest))) + (guard (c ((network-error? c) + (when (http-get-error? c) + (warning (G_ "download from '~a' failed: ~a, ~s~%") + (uri->string (http-get-error-uri c)) + (http-get-error-code c) + (http-get-error-reason c))) + (loop rest))) (download-nar alternate destination #:status-port port #:deduplicate? deduplicate? @@ -675,6 +675,11 @@ (define* (process-substitution port store-item destination store-item)) (guard (c ((network-error? c) + (when (http-get-error? c) + (warning (G_ "download from '~a' failed: ~a, ~s~%") + (uri->string (http-get-error-uri c)) + (http-get-error-code c) + (http-get-error-reason c))) (format (current-error-port) (G_ "retrying download of '~a' with other substitute URLs...~%") store-item)